GNU bug report logs -
#9823
request for more correct error reporting of mv
Previous Next
Reported by: francky.leyn <at> telenet.be
Date: Fri, 21 Oct 2011 12:48:02 UTC
Severity: normal
Tags: moreinfo
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[re-adding the list]
On 10/24/2011 02:06 AM, francky.leyn <at> telenet.be wrote:
> Hello Eric,
>
> This is a sequence which reproduces my situation.
>
>> rm -rf ?
>> mkdir -p a b/a
>> touch b/a/file1 a/file2
>> mv a b
> mv: cannot move `a' to `b/a': Directory not empty
Thanks for your formula. In fact, you don't even have to touch a/file2;
simply touching b/a/file1 is enough to reproduce the setup (and even
makes it more confusing, as then ./a is empty). The problem is that the
recursion ends up trying to move the directory ./a (empty or otherwise)
from the source, and rename(2) it onto the existing directory ./b/a/ on
the destination; but rename(2) can only succeed if the destination
directory is empty.
>
> Ok, in this example it's very clear.
> However in my situation it was power play with an account of 120GiB.
> When mv says "Directory not empty" you interpret the error message
> as that of rmdir, and you go looking at dir a, which of course isn't
> empty. It's not immediatly apparent that you have to go looking
> after the dir b/a.
>
> This is the problem I want to address. Would it not be possible
> to add to the error image the following message: "Dir b/a already
> exists" or something similar making the real problem clear right
> from the start?
Like I said earlier, POSIX allows either ENOTEMPTY or EEXIST, and Linux
happened to choose ENOTEMPTY. Maybe special-casing that error and
converting to EEXIST would produce better output. But someone would
have to submit a patch.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
This bug report was last modified 6 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.