On 22/05/10 20:34, Bob Proulx wrote: > estonoeshaw...@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.