GNU bug report logs -
#6245
cp - copy files and directories, ls -Rld, chmod
Previous Next
Full log
View this message in rfc822 format
On 22/05/10 20:34, Bob Proulx wrote:
> estonoeshawaii <at> yahoo.com wrote:
>> course), because It does not preserve ownership (except if you are
>> root) . The problem is that it doesn't tell you anything when it
>> doesn't do it or that It shouldn't be supposed to preserve
>> ownership.
>
> This is related to this FAQ entry. It explains why only root can
> chown files.
>
> http://www.gnu.org/software/coreutils/faq/#Why-can-only-root-chown-files_003f
>
> The 'cp -a' option says:
>
> `-a'
> `--archive'
> Preserve as much as possible of the structure and attributes of the
> original files in the copy ...
>
> It is not possible to preserve the ownership of a file unless you are
> root. Therefore cp is preserving "as much as possible".
I noticed myself that `cp --preserve=owner` does not give an
error when running as non root. A pertinent comment from the source:
/* If non-root uses -p, it's ok if we can't preserve ownership.
But root probably wants to know, e.g. if NFS disallows it,
or if the target system doesn't support file ownership. */
Perhaps if "owner" is explicitly specified they we should warn?
I'm not sure it's worth diverging the warning characteristics
for this though.
cheers,
Pádraig.
This bug report was last modified 15 years and 82 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.