#1004430 tar: `numeric-owner` not honored for ACLs

Package:
tar
Source:
tar
Description:
GNU version of the tar archiving utility
Submitter:
Fabian Grünbichler
Date:
2023-11-14 08:24:02 UTC
Severity:
normal
Tags:
#1004430#5
Date:
2022-01-27 14:53:36 UTC
From:
To:
filed upstream (with similar patch): http://savannah.gnu.org/bugs/?61934

ACL entries store references to numeric uids/gids. on platforms that have
libacl, use `acl_to_any_text` to generate ACL strings that preserve those
numeric identifiers if `numeric-owner` is set (instead of doing a conversion to
user/group name, like the acl_to_text function does).

reproducer (similar ones exist where a user/group of the stored name exists, but has a different numeric identifier):

system A with user foo with uid 1001
system B with no user foo
file with ACL referencing uid 1001 on system A

on A:
$ echo 'bar' > file
$ setfacl -m u:foo:r file
$ tar --acls --xattrs --numeric-owner -cf test.tar file
$ tar -vv --acls --xattrs -tf test.tar

expected output:
-rw-r--r--+ 0/0         4 2022-01-26 14:32 file
  a: user::rw-,user:1001:r--,group::r--,mask::r--,other::r--

actual output:
-rw-r--r--+ 0/0         4 2022-01-26 14:32 file
  a: user::rw-,user:fakeuser:r--,group::r--,mask::r--,other::r--

on B:
$ tar --acls --xattrs -xf test.tar
$ getfacl -n file

expected output (extraction) - none
expected output (getfacl):
 # file: file
 # owner: 0
 # group: 0
 user::rw-
 user:1001:r--
 group::r--
 other::r--

actual output (extraction):
tar: file: Warning: Cannot acl_from_text: Invalid argument

actual output (getfacl) - note the missing user entry:
 # file: file
 # owner: 0
 # group: 0
 user::rw-
 group::r--
 other::r--

attached patch changes the behaviour of archive creation to honor
`numeric-owner` iff libacl is available. the extraction side remains unchanged
(it handles both numeric and symbolic references in ACL entries).

#1004430#10
Date:
2023-07-25 20:51:14 UTC
From:
To:
Hi,

just for your information, upstream has recently accepted the following
patch:

http://git.savannah.gnu.org/cgit/tar.git/commit/?id=5461025569c2d946fb31b79f16f60e923bbd79f9

#1004430#15
Date:
2023-11-14 08:20:07 UTC
From:
To:
and accordingly, this is now fixed upstream in v1.35 :)