bug-coreutils
[Top][All Lists]
Advanced

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

Re: mv silently does nothing for hard links


From: Jim Meyering
Subject: Re: mv silently does nothing for hard links
Date: Tue, 08 Apr 2003 22:46:18 +0200

Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> The UNLINK_SRC-prompted unlink always happens before
>> any attempt to rename, so an unlink failure should be diagnosed.
>
> OK, sorry, I misunderstood.
>
> However, I looked into what POSIX says about this and think that we
> still have a problem here, because POSIX requires that "mv A B" must
> do nothing (and must succeed) if A and B are hard links.
> <http://www.opengroup.org/onlinepubs/007904975/utilities/mv.html> says
> that mv "shall perform actions equivalent to the rename() function".

I agree that that is what the POSIX spec currently requires.
But I think that the wording of the POSIX spec for rename is
inadequate and should allow `mv A B' to unlink when A and B
are hard links that do not refer to the same directory entry.
The rename rationale seems to support that interpretation, and
thus seems to be inconsistent with the specification.

That's why last week I brought up the issue of Andries Brouwer's
posting from 1999.

Besides, the POSIX-mandated behavior doesn't make sense :-)

> It also says "If this succeeds, mv shall do nothing more with the
> current source_file and go on to any remaining source_files."  So mv
> shouldn't do anything tricky with unlink() either before or after the
> rename(), regardless of whether we're talking about regular files or
> symlinks.




reply via email to

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