Date: Sat, 9 Sep 1995 15:09:01 +1000 From: Bruce Evans <bde@zeta.org.au> To: davidg@freefall.freebsd.org, hackers@freefall.freebsd.org, julian@freefall.freebsd.org Subject: Re: bug in 4.4lite (fixed in lite2) Message-ID: <199509090509.PAA13536@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>[4.4lite]...
>is back to front.. all the t (to) variables should be f (from) and visa versa.
>touch a
>ln a b
>mv a b
>results in a remaining and b being deleted
I can't test this here, because I implemented the POSIX spec, which clearly
although probably incorrectly specifies that the rename() shall do nothing:
"
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.
"
4.4lite only does nothing if the old argument and the new argument refer
to the same directory entry. A `file' is quite different from a `directory
entry' in the context of functions such as unlink() and rename() that
operate on directory entries.
>[4.4lite2]
>get's it right..
>I just noticed this when adding rename to devfs..
>but 4.4l2 noticed before me :)
msdosfs is probably broken too (apart from msdosfs_rename() being broken
in other ways).
Bruce
*** vfs_syscalls.c~ Tue Aug 29 03:53:24 1995
--- vfs_syscalls.c Wed Sep 6 20:41:50 1995
***************
*** 1844,1847 ****
--- 1845,1849 ----
if (fvp == tdvp)
error = EINVAL;
+ #if 0
/*
* If source is the same as the destination (that is the
***************
*** 1854,1857 ****
--- 1856,1868 ----
fromnd.ni_cnd.cn_namelen))
error = -1;
+ #else
+ /*
+ * If the source is the same as the destination (that is, if they
+ * are links to the same vnode), then there is nothing to do.
+ * POSIX standard.
+ */
+ if (fvp == tvp)
+ error = -1;
+ #endif
out:
if (!error) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509090509.PAA13536>
