Re: ext2fs problem with rename() system call

Linus Torvalds (torvalds@transmeta.com)
Thu, 7 Jan 1999 10:21:22 -0800 (PST)


On Thu, 7 Jan 1999, Jamie Lokier wrote:
> >
> > No, it shouldn't - From POSIX.1, section 5.5.3.2:
> >
> > "If the _old_ argument and the _new_ argument both refer to links
> > to the same existing file, the rename() function shall return
> > successfully and perform no other action."
>
> I guess GNU `ln -fb a b' and `cp -flb a b' are broken then. They fail if
> `b' and `b~' point to the same file, which is quite likely in these cases.
> `ln -f a b' and `cp -fl a b' are fine.

Note that the above POSIX text is only relevant for the _system_call_.

What POSIX.2 says about the behaviour of the "ln"/"cp" commands is another
issue. I agree with you that it would _seem_ like their behaviour is less
than desireable, but whether it is a bug is not clear.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/