NetBSD Problem Report #568
From gnats Fri Nov 11 12:28:54 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA02718 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Fri, 11 Nov 1994 12:28:53 -0800
Message-Id: <199411110438.XAA00946@kolvir.blrc.ma.us>
Date: Thu, 10 Nov 1994 23:38:58 -0500
From: John Kohl <jtk@kolvir.blrc.ma.us>
Reply-To: jtk@kolvir.blrc.ma.us
To: gnats-bugs@NetBSD.ORG, current-users@NetBSD.ORG
Subject: rename of one linked file onto its brother removes the target!
X-Send-Pr-Version: 3.2
>Number: 568
>Category: kern
>Synopsis: rename of one linked file onto its brother removes the target
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 11 12:35:03 +0000 1994
>Closed-Date: Tue Jan 03 01:23:55 +0000 1995
>Last-Modified:
>Originator: John Kohl
>Release: 1.0
>Organization:
>Environment:
System: NetBSD kolvir 1.0 NetBSD 1.0 (KOLVIR) #0: Thu Nov 10 20:10:51 EST 1994 jtk@kolvir:/u1/NetBSD-1.0/src/sys/arch/i386/compile/KOLVIR i386
>Description:
If you link two files, and do a rename("a", "b"), "a" is retained while
"b" is unlinked. Whoops!
>How-To-Repeat:
% cd /tmp
% mkdir bar
% cd bar
% cp /etc/motd .
% ln motd xxx
% ls -lai
total 4
7 drwxr-xr-x 2 jtk wheel 512 Nov 10 23:34 .
2 drwxrwxrwt 4 root wheel 512 Nov 10 23:34 ..
8 -rw-r--r-- 2 jtk wheel 54 Nov 10 23:34 motd
8 -rw-r--r-- 2 jtk wheel 54 Nov 10 23:34 xxx
% mv motd xxx
% ls -lai
total 3
7 drwxr-xr-x 2 jtk wheel 512 Nov 10 23:34 .
2 drwxrwxrwt 4 root wheel 512 Nov 10 23:34 ..
8 -rw-r--r-- 1 jtk wheel 54 Nov 10 23:34 motd
>Fix:
The short-circuit code in ufs_vnops.c:ufs_rename() which calls
to VOP_REMOVE() is short-circuiting the wrong entry. A quick look
convinced me that I need to think carefully about locking/flags/etc
before touching this code.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: cgd
State-Changed-When: Mon Jan 2 17:23:55 PST 1995
State-Changed-Why:
fixed
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.