From nobody@www.freebsd.org  Thu Jun 20 12:02:48 2002
Return-Path: <nobody@www.freebsd.org>
Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by hub.freebsd.org (Postfix) with ESMTP id 9C90837B403
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Jun 2002 12:02:41 -0700 (PDT)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g5KJ2fhG065994
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Jun 2002 12:02:41 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.2/8.12.2/Submit) id g5KJ2fZt065993;
	Thu, 20 Jun 2002 12:02:41 -0700 (PDT)
Message-Id: <200206201902.g5KJ2fZt065993@www.freebsd.org>
Date: Thu, 20 Jun 2002 12:02:41 -0700 (PDT)
From: Steve Follmer <sffollmer@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ln -f fails to unlink
X-Send-Pr-Version: www-1.0

>Number:         39584
>Category:       i386
>Synopsis:       ln -f fails to unlink
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 20 12:10:01 PDT 2002
>Closed-Date:    Sun Jul 13 00:35:36 PDT 2003
>Last-Modified:  Sun Jul 13 00:35:36 PDT 2003
>Originator:     Steve Follmer
>Release:        4.5-RELEASE
>Organization:
>Environment:
FreeBSD edge1.stevefollmer.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Mar 25 18:09:02 PST 2002     root@edge1.stevefollmer.com:/usr/src/sys/compile/EDGE1  i386
>Description:
ln -f is supposed to force the unlink of the target directory.
It fails to do so and also reports no error.

man ln claims...
-f    If the target file already exists, then unlink it so that the link may occur. 

>How-To-Repeat:
edge1# mkdir d1
edge1# mkdir d2
edge1# ln -s l1 d1
edge1# ls -l
total 4
drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
edge1# ln -s d1 l1
edge1# ls -l
total 4
drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> d1
edge1# ln -fs d2 l1
edge1# ls -l
total 4
drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> d1
      
>Fix:
      
>Release-Note:
>Audit-Trail:

From: parv <parv@pair.com>
To: Steve Follmer <sffollmer@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: i386/39584: ln -f fails to unlink
Date: Thu, 20 Jun 2002 16:00:01 -0400

 in message <200206201902.g5KJ2fZt065993@www.freebsd.org>,
 wrote Steve Follmer thusly...
 >
 > 
 > >Release:        4.5-RELEASE
 > 
 > man ln claims...
 > -f    If the target file already exists, then unlink it so that the link may occur. 
 > 
 > >How-To-Repeat:
 > edge1# mkdir d1
 > edge1# mkdir d2
 > edge1# ln -s d1 l1
 > edge1# ln -fs d2 l1
 > edge1# ls -l
 > total 4
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
 > lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> d
 
 same thing happesn on 4.6-release, jun 16 2002; problems seem to be
 related only to directories, but not files.
 
 # touch f1 f2; ln -s f1 p1 ; ln -sf f2 p1 ; ls -Fl f1 f2 p1
 
 ...would show link between f2 & p1.
 
 
 -- 
  

From: "Crist J. Clark" <crist.clark@attbi.com>
To: Steve Follmer <sffollmer@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: i386/39584: ln -f fails to unlink
Date: Thu, 20 Jun 2002 13:43:25 -0700

 On Thu, Jun 20, 2002 at 12:02:41PM -0700, Steve Follmer wrote:
 [snip]
 
 > >Description:
 > ln -f is supposed to force the unlink of the target directory.
 > It fails to do so and also reports no error.
 > 
 > man ln claims...
 > -f    If the target file already exists, then unlink it so that the link may occur. 
 > 
 > >How-To-Repeat:
 > edge1# mkdir d1
 > edge1# mkdir d2
 > edge1# ln -s l1 d1
 > edge1# ls -l
 > total 4
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
 > edge1# ln -s d1 l1
 > edge1# ls -l
 > total 4
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
 > lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> d1
 > edge1# ln -fs d2 l1
 > edge1# ls -l
 > total 4
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:13 d1
 > drwxr-xr-x  2 root  wheel  512 Jun 20 11:12 d2
 > lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> d1
 
 You missed it.
 
   # ls -l d1
   total 0
   lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l2 -> d2
   lrwxr-xr-x  1 root  wheel    2 Jun 20 11:13 l1 -> l1
 
 When you run the last 'ln -fs d2 l1,' you are making a symbolic link
 to "d2" _inside_ l1. l1 is a symlink to d1, which is where the link
 was successfully made.
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Sun Jul 13 00:35:16 PDT 2003 
State-Changed-Why:  
The explanation in the audit trail seems to be correct. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39584 
>Unformatted:
