bug-coreutils
[Top][All Lists]
Advanced

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

bug#36901: Enhance directory and file moves where target already exists


From: L A Walsh
Subject: bug#36901: Enhance directory and file moves where target already exists
Date: Fri, 02 Aug 2019 23:21:43 -0700
User-agent: Thunderbird


On 2019/08/02 23:10, Assaf Gordon wrote:

>>>> So when I look at the system call on linux for rename:
>>>>         oldpath can specify a directory.  In this case, newpath must
>>>>         either not
>>>>         exist, or it must specify an empty directory.
>>>>          (complying with POSIX_C_SOURCE >= 200809L)


>>>> So mv is violating POSIX - it didn't do the rename, but moved
>>>> A under B and neither dir had to be empty.
>>>>
>>>> Saying it has to follow POSIX when it doesn't appear to, seems
>>>> a bit contradictory?
> 
> I previously quoted one small part of the entire "mv" POSIX specification
> (item #3, regarding using the 'rename(2)' function).
> 
> It would be wise to read the entire specification before making claims
> about violating POSIX.
----
        One doesn't need to read all federal and state laws before 
making claims of law violation.


> 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.

But it isn't.  Note to mention -- which posix?  Different posix versions
are not the same.

It isn't 1 spec consistent spec, but changes overtime.  You quoted
a section saying it had to follow the behavior of rename, but it doesn't
do that:


And it doesn't follow the POSIX section quoted on the manpage.

>>>>         oldpath can specify a directory.  In this case, newpath must
>>>>         either not
>>>>         exist, or it must specify an empty directory.
>>>>          (complying with POSIX_C_SOURCE >= 200809L)

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.






reply via email to

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