bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20849: documentation: difference between empty and non-empty dirs wi


From: Pádraig Brady
Subject: bug#20849: documentation: difference between empty and non-empty dirs with "mv --no-target-directory"
Date: Sun, 28 Jun 2015 04:30:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 19/06/15 11:23, Alexey Salmin wrote:
> Image you need to move the "$PWD/tmploc/a" directory into "$PWD/a" and
> ensure you don't end up with "$PWD/a/a" when "$PWD/a" already exists.
> The "mv --no-target-directory" (or "mv -T") does exactly that, however
> there are three different cases depending on a type of "$PWD/a":
> 
> A) Empty directory: mv silently overwrites "$PWD/a" with "$PWD/tmploc/a"
> B) Non-empty directory: mv fails with a "File exists" message
> C) File: mv fails with a "cannot overwrite non-directory ... with
> directory" message
> See steps to reproduce at the bottom of this e-mail.
> 
> I can see a reasoning behind this behavior and don't challenge it.
> However I would appreciate if it was clearly stated in the
> documentation.
> 
> At the moment it explains "-T" as "Do not treat the last operand
> specially when it is a directory or a symbolic link to a directory."
> [1] This sort of contradicts the fact that an empty directory (A) is
> treated specially compared to an empty file (C). And a difference
> between (A) and (B) is not mentioned at all.
> 
> Thank you,
> Alexey
> 
> 
> [1] http://www.gnu.org/software/coreutils/manual/coreutils.html#mv-invocation

The wording is intended to cater for mv and cp etc.
cp doesn't care about empty dirs for example.
TBH I think the behavior is not surprising, and splitting
out the docs might only confuse things.
If you can come up with a concise patch we'll consider it.

thanks,
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]