-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mv: error message "Directory not empty" is confusing #5102
Comments
could you please provide an example how to reproduce this ? |
sure: $:rm -rf /tmp/node_modules |
so, if I understand correctly, this issue also happen on the GNU side? |
I'm sorry, I'm not that much familiar with the separation of responsibility among linux packages. I know that linux' utils are based on GNU, in general, I was looking for the source code of whomever maintains the 'mv' utility, I looked at the source code (I'm not a Rust developer, but it wasn't too complicated) and the same error messages and apparently the same logic seemed to be related with the file and line I have pointed. |
The issue is that the directory is non-empty and you are attempting to overwrite data.
|
The utils that we maintain here are probably not on your system. That would most likely be the GNU utils. GNU does not operate on GitHub, but they have mailing lists where you can submit suggestions: https://www.gnu.org/software/coreutils/coreutils.html#mailinglists Our goal is to match the GNU behaviour, so if you get GNU to change this behaviour, we'll follow suit :) |
yes, you are right, it's GNU: thanks for your reference. I sent it to gnu. apparently it has to be done via email |
my issue was about improving the phrasing of the error message |
Yeah I understand the confusion but it might just be your understanding of how mv works. There can be a destination directory that shares the same name - It just can't have anything in it, hence their error. |
exactly. your second example would trigger the suboptimal error message |
@niron1 do you have a link to the mailing list message? I'd love to follow the discussion there. |
I guess not. I initially opened the bug by sending an email, then I
responded to subsequent emails using "reply all"....
…On Thu, Jul 27, 2023 at 12:34 PM Terts Diepraam ***@***.***> wrote:
@niron1 <https://github.com/niron1> do you have a link to the mailing
list message? I'd love to follow the discussion there.
—
Reply to this email directly, view it on GitHub
<#5102 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGG4CULOFD556UIR7SBAMODXSIY4FANCNFSM6AAAAAA2RKEYVM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Found it :) https://lists.gnu.org/archive/html/bug-coreutils/2023-07/msg00030.html I quite like the solution proposed there. |
I like that solution. Changing
into
Or something similar. |
in file coreutils/src/uu/mv/src/mv.rs:488
when you try to move a directory to a location already containing a directory with the same name it would just write "Directory not empty"
first, this is technically a wrong error message because there is no requirement that the destination would be empty.
the destination might as well be populated with some content, we just require that it would not contain a directory with the same name.
also, the error message is confusing because it doesn't state that the problem is with the destination. One can think that the problem is actually with the source, and that the source directory having some kind of attribute that would require it to be empty prior to moving.
I would suggest to change the error message to: "a directory with the same name already exists at destination"
The text was updated successfully, but these errors were encountered: