[Top][All Lists]

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

Re: mv silently does nothing for hard links

From: Paul Eggert
Subject: Re: mv silently does nothing for hard links
Date: Tue, 8 Apr 2003 17:14:40 -0700 (PDT)

> From: Jim Meyering <address@hidden>
> Date: Tue, 08 Apr 2003 22:46:18 +0200
> 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.

I could go along with that, but on the other hand the current POSIX
is what it is.  Perhaps this is case for POSIXLY_CORRECT?

> The rename rationale seems to support that interpretation, and
> thus seems to be inconsistent with the specification.

The rename rationale says: ``The specification that if old and new
refer to the same file is intended to guarantee that `rename("x",
"x")' does not remove the file.''  I take this to mean something like:

  `rename(FOO,BAR)' must do nothing if FOO and BAR are the same file;
  therefore, `rename' can't remove a file.

But this assertion is true regardless of whether one substitutes "the
same directory entry" for "the same file".  It is true that the
assertion is sharper with the substitution, but still I have to wonder
what the intent was.  (The fact that the POSIX rationale does not use
proper English grammar doesn't help much.)

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

Did you see Bruce Evans's comments in
He said that a nice property of POSIX rename() is that it never
changes the link count.  "Never changes the link count" is one way to
interpret the "does not remove the file" of the POSIX rationale for

Also, Bruce Evans wrote that GNU/Linux rename() was changed to conform
to POSIX 10 years ago.  It would be a bit disconcerting if GNU/Linux
rename() conformed to POSIX, but GNU mv did not.

reply via email to

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