|
From: | Eric Blake |
Subject: | bug#9823: request for more correct error reporting of mv |
Date: | Mon, 24 Oct 2011 10:15:34 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15 |
[re-adding the list] On 10/24/2011 02:06 AM, address@hidden 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 bmv: 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 address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |