From olear@tele80.Colorado.EDU  Wed Sep  4 08:21:26 1996
Received: from tele80.Colorado.EDU (root@tele80.Colorado.EDU [128.138.149.80])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA16780
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 4 Sep 1996 08:21:25 -0700 (PDT)
Received: (from olear@localhost) by tele80.Colorado.EDU (8.7.5/8.7.3) id JAA01777; Wed, 4 Sep 1996 09:21:24 -0600 (MDT)
Message-Id: <199609041521.JAA01777@tele80.Colorado.EDU>
Date: Wed, 4 Sep 1996 09:21:24 -0600 (MDT)
From: Mark.OLear@Colorado.EDU
Reply-To: Mark.OLear@Colorado.EDU
To: FreeBSD-gnats-submit@freebsd.org
Subject: Moving a file to it's link completely removes file
X-Send-Pr-Version: 3.2

>Number:         1565
>Category:       bin
>Synopsis:       Moving a file to it's link completely removes file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    wosch
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep  4 08:30:01 PDT 1996
>Closed-Date:    Tue Mar 9 00:08:01 PST 1999
>Last-Modified:  Tue Mar  9 00:33:54 PST 1999
>Originator:     Mark O'Lear
>Release:        FreeBSD 2.2-960501-SNAP i386
>Organization:
>Environment:

	FreeBSD 2.2-960501-SNAP i386
		  and
	FreeBSD 2.2-960801-SNAP i386

>Description:

	If /tmp/aaa is a link to /usr/tmp/aaa
	(lrwxrwxrwt  1 bin  bin  12 Aug 21 16:53 /tmp/aaa@ -> /usr/tmp/aaa)
	doing a 'mv /usr/tmp/aaa /tmp/aaa' removes /usr/tmp/aaa,
	but /tmp/aaa is still a link to /usr/tmp/aaa.

>How-To-Repeat:

        tele80> ls -lF /tmp/aaa
        lrwxrwxrwt  1 bin  bin  12 Aug 21 16:53 /tmp/aaa@ -> /usr/tmp/aaa

        tele80> ls -lF /usr/tmp/aaa
        -rw-------  1 olear  wheel  48 Aug 21 16:59 /usr/tmp/aaa

        tele80> mv /usr/tmp/aaa /tmp/aaa

        tele80> ls -lF /tmp/aaa
        lrwxrwxrwt  1 bin  bin  12 Aug 21 16:53 /tmp/aaa@ -> /usr/tmp/aaa

        tele80> cat /tmp/aaa
        cat: /tmp/aaa: No such file or directory

        tele80> ls -lF /usr/tmp/aaa
        ls: /usr/tmp/aaa: No such file or directory

>Fix:
	

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: wosch 
State-Changed-When: Thu Sep 26 17:13:11 PDT 1996 
State-Changed-Why:  

This is a general cross-device link problem. mv(1) does not 
check the target if the source and the target are on 
different disks. mv(1) should unlink the target before copying  
if the target is a symbolic link. Bruce? 

State-Changed-From-To: analyzed->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Mar 9 00:08:01 PST 1999 
State-Changed-Why:  
Fixed at undetermined date. mv(1) file to its link replaces the link with 
the file. 
Responsible-Changed-From-To: freebsd-bugs->wosch 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Mar 9 00:33:05 PST 1999 
Responsible-Changed-Why:  
Closed with his permission. 
>Unformatted:
