GNU bug report logs - #36901
mv: merge directories where target already exists

Previous Next

Package: coreutils;

Reported by: L A Walsh <coreutils <at> tlinx.org>

Date: Sat, 3 Aug 2019 03:35:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: L A Walsh <coreutils <at> tlinx.org>, Assaf Gordon <assafgordon <at> gmail.com>
Cc: 36901 <at> debbugs.gnu.org
Subject: bug#36901: Enhance directory and file moves where target already exists
Date: Tue, 6 Aug 2019 21:14:24 +0200
On 8/3/19 8:21 AM, L A Walsh wrote:
> On 2019/08/02 23:10, Assaf Gordon wrote:
>> Specifically, at the top of the page:
>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mv.html
>>    SYNOPSIS
>>       mv [-if] source_file target_file
>>       mv [-if] source_file... target_dir
>>    DESCRIPTION
>>       [...]
>>       In the second synopsis form, mv shall move each file named by a
>>       source_file operand to a destination file in the existing directory
>>       named by the target_dir operand [...] This second form is assumed
>>       when the final operand names an existing directory
>>
>> In this regard GNU 'mv' is compliant with POSIX.

[...]

> mkdir A B
> touch A/foo B/fee
> mv A B
> 
> It B exists and is not empty.  Ergo, it is not following the 
> requirement that the directory must be empty or not exist.

There no such condition in the POSIX citation (nor in the whole mv(1) spec)
about whether 'B' is empty or not.  The question is whether the target operant
is an existing directory (or a symlink which resolves to one).

Regards,
Berny




This bug report was last modified 5 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.