Created attachment 463974 [details] Patch for the issue Description of problem: If directory is moved to another existing directory that is not empty, rename sets errno to ENOTEMPTY. Coreutils in rhel5 considers this to be a case when directory is moved to a subdirectory of itself although it clearly is not the case. Therefore I propose attached patch that fixed this confussion for me. Version-Release number of selected component (if applicable): coreutils-5.97-23.el5_4.2 How reproducible: Always Steps to Reproduce: 1. mkdir a{a,b} 2. touch aa/1 3. mkdir ab/aa 4. touch ab/aa/2 5. mv ab/aa ./ Actual results: mv: cannot move `ab/aa' to a subdirectory of itself, `./aa' Expected results: mv: cannot move `ab/aa' to `./aa': Directory not empty Additional info: RHEL6 already has this behaviour. This bug was found thanks to xfstests test no. 245. Example without patch(/bin/mv) and with patch(/usr/bin/mv): [root@dell-pesc1420-01 test]# mkdir a{a,b} [root@dell-pesc1420-01 test]# touch aa/1 [root@dell-pesc1420-01 test]# mkdir ab/aa [root@dell-pesc1420-01 test]# touch ab/aa/2 [root@dell-pesc1420-01 test]# /bin/mv ab/aa ./ /bin/mv: cannot move `ab/aa' to a subdirectory of itself, `./aa' [root@dell-pesc1420-01 test]# /usr/bin/mv ab/aa ./ /usr/bin/mv: cannot move `ab/aa' to `./aa': Directory not empty [root@dell-pesc1420-01 test]# Patch does not brake the case when directory is moved to its subdirectory: [root@dell-pesc1420-01 test]# mv ab ab/aa mv: cannot move `ab' to a subdirectory of itself, `ab/aa/ab' [root@dell-pesc1420-01 test]# /usr/bin/mv ab ab/aa /usr/bin/mv: cannot move `ab' to a subdirectory of itself, `ab/aa/ab' [root@dell-pesc1420-01 test]#
Thanks for patch, even EIO check could be dropped... upstream commit is here: http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=36a288e41a6534c816090dce1a6ed139a60e87b7
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: When moving a directory into another non-empty directory, the mv utility returned a confusing "cannot move [directory] to a subdirectory of itself" error message. This bug has been fixed and the correct "Directory not empty" error message is now given instead.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-1074.html