Subject: Re: bug#64785: Package: coreutils Version: 8.32-4+b1 program=mv

From: Pádraig Brady <[email-masked]>
Date: Sat, 22 Jul 2023 11:19:33 +0100

On 21/07/2023 18:17, Nir Oren wrote:
> *mv: error message "Directory not empty" is confusing *
> 
> description: when you try to move a directory to a location already
> containing a directory with the same name it would just write "mv: cannot
> move 'A' to 'B': 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.

Well that's not exactly the case.
mv will replace empty dirs in the destination,
so it is significant if the dir in the destination is empty or not.

> second, 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 has some kind of attribute
> that would require it to be empty prior to moving.

I think it's unlikely that users would be confused as
to whether the source needs to be empty.

> I would suggest to change the error message to: "*a directory with the same
> name already exists at destination*"

More accurately the error would be:
"a populated directory with the same name already exists"

Now would could argue that the above info is implicit in:
"directory not empty"
(which BTW is just the standard error from ENOTEMPTY).

Given the subtleties in this area,
I'd be reluctant to adjust diagnostics here.

thanks,
Pádraig