From owner-freebsd-hackers Fri Sep 8 22:14:47 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id WAA03314 for hackers-outgoing; Fri, 8 Sep 1995 22:14:47 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id WAA03308 ; Fri, 8 Sep 1995 22:14:40 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id PAA13536; Sat, 9 Sep 1995 15:09:01 +1000 Date: Sat, 9 Sep 1995 15:09:01 +1000 From: Bruce Evans Message-Id: <199509090509.PAA13536@godzilla.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) Sender: hackers-owner@FreeBSD.org Precedence: bulk >[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) {