cvs commit: src/sys/kern vfs_syscalls.c

Matthew Dillon dillon at apollo.backplane.com
Mon Aug 15 08:17:39 PDT 2005


: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."
:
:(See http://www.opengroup.org/onlinepubs/009695399/functions/rename.html
:for reference.  This could be found from the third paragraph of the
:DESCRIPTION section)
:
:I am not sure why POSIX requires this feature, though :-)  What do you
:think about it?
:
:Cheers,
:--=20
:Xin LI <delphij delphij net>  http://www.delphij.net/

    Rename is a namespace operation.  The idea that it should not do anything
    if the source and destination happen to be hardlinks to the same file
    is unexpected, non-intuitive, and, frankly, just plain stupid.  As much 
    as I prefer to adhere to standards, there's a limit to what I'm willing
    to put up with.  The code clearly was never originally intended to have
    that effect, it was simply trying to detect that the source and target
    were the same and doing a bad job of it.

    In any case, it's an obscure situation.  I don't think I've seen a
    program actually try to do this intentionally in all my years of
    programming, let alone depend on such a ridiculous side effect, so I
    am inclined to make the function behave intuitively in that case.

						-Matt





More information about the Commits mailing list