Red Hat Bugzilla – Bug 223869
mv(1) command produces wrong error message
Last modified: 2007-11-30 17:11:53 EST
Description of problem:
The mv(1) command produces a wrong error message.
Version-Release number of selected component (if applicable):
When I attempt to replace a non-empty directory with another directory, this
wrong error message occurs.
Steps to Reproduce:
1. mkdir -p a/b b
2. date > a/b/c.txt
3. mv b a
mv: cannot move `b' to a subdirectory of itself, `a/b'
mv: directory 'a/b' already exists
Replacement successfully occurs if the destination directory is empty.
FWIW, upstream (coreutils-6.7) gets this right now: It prints this:
mv: cannot move `b' to `a/b': Directory not empty
Tim, I don't see off-hand where I made that fix. Let me know if you'd like details.
If we do another coreutils update for FC6 it would be nice to get this fix in.
The fix was on the trunk, between 5.92 and 6.0. Looks safe.
Here's the log entry:
* src/copy.c (copy_internal): Don't work around old NFS clients like
SunOS-4.1.4 and Irix 5.3 that set errno to values like EIO and
ENOTEMPTY upon failed rename. Otherwise, we risk misinterpreting
a banal failure as a recursive move-into-self failure.
Reported by Florent Bayle in <http://bugs.debian.org/376749>.
Fixed in update: coreutils-5.97-12.5.fc6