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 default.) 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. -- Torbjörn (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.)
