[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9446: Bug in cp (or strange behaviour and unclear documentation)

From: Torbjorn Granlund
Subject: bug#9446: Bug in cp (or strange behaviour and unclear documentation)
Date: Mon, 05 Sep 2011 21:26:19 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (berkeley-unix)

On FreeBSD (tested on 8.1, but exact version is unlikely relevant)
copying a file from a ZFS file system to a tmpfs or tmpmfs filesystem,
the -p option causes cp to return with a non-zero exit status.

Sample run:

$ cp -p /etc/profile /tmp/foo || echo non-zero exit
cp: preserving permissions for `/tmp/foo': Invalid argument
non-zero exit

Some debugging shows that the function acl_access_nontrivial returns 1,
caused by the tag ACL_EVERYONE.  (It is present in every file by

ACLs are not supported on FreeBSD's tmpfs or tmpmfs file system types.

Perhaps this failure is intentional?  Then it should be clearly
documented for the -p/--preserve option.  I have read it carefully, and
I cannot see support for the observed behaviour.

Consider what happens under -p when copying a file owned by somebody
else.  The used and group owners can then not (typically) be preserved.
This is not considered an error in cp.

Similarly, when copying a file with the setuid bit set, and the user is
changed (per above) the setuid bit is not preserved, and this is also
not considered an error by cp.

The failure to preserve (partial) ACL data should IMHO not be considered
an error, except perhaps under some --preserve=blah options, where blah
denoted preservation of exactly this.


(Since I am the original author of cp, I suppose I should really fix the
problem myself.  But I think the ACL stuff was added later, and I am not
familiar with it.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]