Bug 223869

Summary: mv(1) command produces wrong error message
Product: [Fedora] Fedora Reporter: Tamal Kanti Nath <tamal.nath>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 6CC: meyering
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 5.97-12.5.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-19 08:25:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 207681    

Description Tamal Kanti Nath 2007-01-22 20:28:23 UTC
Description of problem:
The mv(1) command produces a wrong error message.

Version-Release number of selected component (if applicable):
coreutils-5.97-12.2.fc6

How reproducible:
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

Actual results:
mv: cannot move `b' to a subdirectory of itself, `a/b'

Expected results:
mv: directory 'a/b' already exists

Additional info:
Replacement successfully occurs if the destination directory is empty.

Comment 1 Jim Meyering 2007-01-22 20:40:16 UTC
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.

Comment 2 Tim Waugh 2007-01-23 10:22:17 UTC
If we do another coreutils update for FC6 it would be nice to get this fix in.

Comment 3 Jim Meyering 2007-01-23 20:06:59 UTC
The fix was on the trunk, between 5.92 and 6.0.  Looks safe.

    http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=36a288e41a6

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>.

Comment 4 Fedora Update System 2007-04-18 22:37:19 UTC
Fixed in update: coreutils-5.97-12.5.fc6