$ rm -f a b $ touch a $ ln a b $ mv a b mv: 'a' and 'b' are the same file expected: mv is expected to overwrite b using a, which mean in this case, unlink a, rename a to b
POSIX says this behavior is correct. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mv.html "The specification ensures that mv a a will not alter the contents of file a, and allows the implementation to issue an error that a file cannot be moved onto itself. Likewise, when a and b are hard links to the same file, mv a b will not alter b, but if a diagnostic is not issued, then it is unspecified whether a is left untouched (as it would be by the rename() function) or unlinked (reducing the link count of b)."