]> git.ipfire.org Git - thirdparty/coreutils.git/commit
mv: "mv A B" would sometimes succeed, yet A would remain, ...
authorJim Meyering <meyering@redhat.com>
Wed, 1 Feb 2012 20:42:45 +0000 (21:42 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 12 Feb 2012 11:21:53 +0000 (12:21 +0100)
commitb01355a1dc4939a3967ee82ac0a6dd19702778c3
treea8f6534979bebdda6d60a5985d9a7094322ae95b
parent31eeead93842c6581e0a9b21f6e8eb964d0c9309
mv: "mv A B" would sometimes succeed, yet A would remain, ...

But only when both A and B were hard links to the same symlink.
* src/copy.c (same_file_ok): Handle another special case: the one
in which we are moving a symlink onto a hard link to itself.
In this case, we must explicitly tell the caller to unlink the
source file.  Otherwise, at least the linux-3.x kernel rename
function would do nothing, as mandated by POSIX 2008.
* tests/mv/symlink-onto-hardlink-to-self: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Bernhard Voelker in http://bugs.gnu.org/10686
NEWS
src/copy.c
tests/Makefile.am
tests/mv/symlink-onto-hardlink-to-self [new file with mode: 0755]