Subject: bug#33644: [PATCH] cp --preserve=xattr: preserve NFSv4 ACL extended attributes

From: Kamil Dudka <[email-masked]>
Date: Tue, 12 Feb 2019 13:03:34 +0100

On Monday, February 11, 2019 7:30:42 PM CET Pádraig Brady wrote:
> On 11/02/19 03:50, Kamil Dudka wrote:
> > I think that the information in xattr.conf is correct.  system.nfs4_acl is
> > really an attribute one wants to copy when trying to preserve permissions.
> 
> Right. What I was getting at was attr_copy_file() from libattr seems
> to skip all entries in xattr.conf by default. I need to dig in to
> see what's preserving system.posix_acl_access (these might be
> implicitly generated upon attr reading for example).

I do not know the reasoning behind the default behavior of attr_copy_file().
There is a comment before the function definition but it does not talk about
NFSv4 ACLs:

http://git.savannah.nongnu.org/cgit/attr.git/tree/libattr/attr_copy_file.c?id=cb4786f1#n54

> My question was why does coreutils need to explicitly handle
> the nfs4 acls if it doesn't need to handle the posix ones.

I think the answer is obvious.  cp is able preserve POSIX ACLs at a higher
level (using gnulib's acl module, which uses libacl internally on Linux).
There is, unfortunately, no such module (neither library) for NFSv4 ACLs.
So copying the value of the low-level attribute is currently the only way
to make cp preserve NFSv4 ACLs.

Kamil