mv: allow moving symlink onto same-inode dest with >= 2 hard links
commitd1b0155d805ce51d8f155e648d1e9ad2edb95397
authorJim Meyering <meyering@redhat.com>
Thu, 5 Jan 2012 10:45:50 +0000 (5 11:45 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 30 Jan 2012 19:43:07 +0000 (30 20:43 +0100)
treeaa83b8c100173f6a5179eaf3e5503021c4337f63
parent67ebdb9f20465a0ba1084902230704f410edde3b
mv: allow moving symlink onto same-inode dest with >= 2 hard links

Normally, mv detects a few subtle cases in which proceeding with a
same-file rename would, with very high probability, cause data loss.
Here, we have found a corner case in which one of these same-inode
tests makes mv refuse to perform a useful operation.  Permit that
corner case.
* src/copy.c (same_file_ok): Detect/exempt this case.
* tests/mv/symlink-onto-hardlink: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Initially reported by: Matt McCutchen in http://bugs.gnu.org/6960.
Raised again by Anders Kaseorg due to http://bugs.debian.org/654596.
Improved-by: Paul Eggert.
NEWS
THANKS.in
src/copy.c
tests/Makefile.am
tests/mv/symlink-onto-hardlink [new file with mode: 0755]