DragonFly BSD
DragonFly commits List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/kern vfs_syscalls.c

From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Mon, 15 Aug 2005 12:46:59 +0200
Mail-followup-to: commits@crater.dragonflybsd.org

On Mon, Aug 15, 2005 at 12:19:15PM +0200, Simon 'corecode' Schubert wrote:
> On 15.08.2005, at 12:10, Xin LI wrote:
> >>  But, in fact, the case CAN happen if you rename a file to another 
> >>that
> >>  happens to be a hardlink to the first.  The rename operations 
> >>appears to
> >The FreeBSD behavior was intentional.  I think this change violates
> >POSIX, which states:
> >
> >"If the old argument and the new argument resolve to the same existing
> >file, rename() shall return successfully and perform no other action."
> I think they mean "file name", not "physical data" (= inode). Like
> 	mv /usr/src/sys/sys/../Makefile.inc /sys/Makefile.inc
> which resolves to the same file (through a .. and a symlink)

Nope, there is one example given in SUS:
     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.

You have to include other operations on the inode which is referenced by
"x" here. E.g. when "x" has two links and one of them is removed in the
middle of the operation, there are race conditions possible which could
remove both references during rename over identical file.


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