4.3BSD rename() changes ctime

Chris Torek chris at mimsy.UUCP
Thu Aug 4 17:12:26 AEST 1988


In article <26657 at oliveb.olivetti.com> jerry at olivey.olivetti.com
(Jerry Aguirre) writes:
>Prior to the "rename" system call the mv command would change the ctime
>of a file even though the resulting data AND inode were identical.  This
>was an anavoidable consequence of the link and unlink process used to
>implement renaming.

>Well, now that we have rename, it still does! ...

>Is this a bug or is there some justification for rename updating the
>ctime?

There is certainly *some* justification: in fact, rename works
internally by adjusting the link count temporarily, so that if the
machine crashes, at least one of the two names will exist (but both
might exist).  If it were to do otherwise, fsck would not be able
to fix things.  One could argue that it should then go back and
reset the ctime after the rename completes, although there is no
kernel mechanism to do this (iupdat() insists on using the current
time: ip->i_ctime = time.tv_sec).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list