-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Karl Berry on 12/4/2009 6:51 PM: > [coreutils 8.1, gnu/linux] > > $ touch foo > $ ln -s foo lnk > $ \cp --no-dereference foo lnk > cp: `foo' and `lnk' are the same file > > Well, no, they're not. > I expected the file foo to overwrite the symlink lnk. > I can imagine that error without --no-dereference, but with it ... ?
I'm not so sure it is a bug. cp --help | grep no-deref states: -d same as --no-dereference --preserve=links -P, --no-dereference never follow symbolic links in SOURCE But lnk is a DEST, not a SOURCE. Which means you effectively did 'cp foo foo'. On the other hand, not even -T/--no-target-directory is enough to make us try to blindly overwrite lnk, rather than stat()ing through it. And it almost seems like 'cp --no-deref -f foo lnk' should recognize failure to copy, perform the unlink(), and try again, thus succeeding to overwrite lnk with a regular file. So, I'm fuzzy on whether you found an actual bug. - -- Don't work too hard, make some time for fun as well! Eric Blake [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksZv9wACgkQ84KuGfSFAYAM2ACeNA/lkMNk7Q/udW78qNv0iVYn fdUAn0dWw3GaTgjPnVsk1c3L4faZ9iNX =ZrgT -----END PGP SIGNATURE-----
