From delphij@FreeBSD.org  Sat Dec  1 01:37:56 2007
Return-Path: <delphij@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5161716A419;
	Sat,  1 Dec 2007 01:37:56 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F01113C455;
	Sat,  1 Dec 2007 01:37:56 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from freefall.freebsd.org (delphij@localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lB11bufJ008372;
	Sat, 1 Dec 2007 01:37:56 GMT
	(envelope-from delphij@freefall.freebsd.org)
Received: (from delphij@localhost)
	by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lB11buH3008371;
	Sat, 1 Dec 2007 01:37:56 GMT
	(envelope-from delphij)
Message-Id: <200712010137.lB11buH3008371@freefall.freebsd.org>
Date: Sat, 1 Dec 2007 01:37:56 GMT
From: Xin LI <delphij@FreeBSD.org>
Reply-To: Xin LI <delphij@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: dds@FreeBSD.org
Subject: mv(1) behaves differently when handling with different file systems
X-Send-Pr-Version: 3.113
X-GNATS-Notify: delphij@FreeBSD.org

>Number:         118367
>Category:       bin
>Synopsis:       mv(1) behaves differently when handling with different file systems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dds
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 01 01:40:01 UTC 2007
>Closed-Date:    Sun Jan 27 08:10:34 UTC 2008
>Last-Modified:  Sun Jan 27 08:10:34 UTC 2008
>Originator:     Xin LI
>Release:        FreeBSD 7.0-BETA3 i386
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD freefall.freebsd.org 7.0-BETA3 FreeBSD 7.0-BETA3 #30: Fri Nov 30 23:12:12 UTC 2007 simon@freefall.freebsd.org:/usr/src/sys/i386/compile/FREEFALL i386


>Description:
	mv(1) behaves differently when operating on same file system vs on
different system, which is not desired.  Also it conflicts with the manpage
documented behavior.

>How-To-Repeat:
Test1: Moving within one filesystem:

mkdir -p t/a/b
mkdir -p b/c/d
cd t/
mv ../b a

Resulting tree:
	t/
		a/
			b/
				c/
					d/

However, with different filesystems:

mkdir -p t/a/b
mkdir -p /tmp/b/c/d
cd t
mv /tmp/b a

We get:

	t/
		a/
			b/
				b/
					c/
						d/
>Fix:

	N/A at the moment.  PR sent because dds@ shows some interest.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dds 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Sat Dec 1 02:02:17 UTC 2007 
Responsible-Changed-Why:  
dds@ has interest on this so assign to him. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118367 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118367: commit references a PR
Date: Sun, 16 Dec 2007 14:14:37 +0000 (UTC)

 dds         2007-12-16 14:14:31 UTC
 
   FreeBSD src repository
 
   Modified files:
     bin/mv               mv.c 
   Log:
   When moving a directory across devices to a place where a directory
   with the same name exists, delete that directory first, before performing
   the copy.  This ensures that mv(1) across devices follows the semantics
   of rename(2), as required by POSIX.
   
   This change could introduce the potential of data loss, even if the
   copy fails, violating the atomicity properties of rename(2).  This is
   (mostly) mitigated by first renaming the destination and obliterating
   it only after a succesfull copy.
   
   The above logic also led to the introduction of code that will cleanup
   the results of a partial copy, if a cross-device copy fails.
   
   PR:             bin/118367
   MFC after:      1 month
   
   Revision  Changes    Path
   1.47      +83 -23    src/bin/mv/mv.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: dds 
State-Changed-When: Sun Dec 16 14:24:10 UTC 2007 
State-Changed-Why:  
Fixed in mv.c revision 1.47 


http://www.freebsd.org/cgi/query-pr.cgi?pr=118367 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118367: commit references a PR
Date: Sun, 27 Jan 2008 07:37:08 +0000 (UTC)

 dds         2008-01-27 07:37:01 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     bin/mv               mv.c 
   Log:
   MFC revisions 1.47-1.50.
   
   - Follow POSIX specification when moving a directory to an existing
     directory across devices.
   
   - Improve consistency and remove some style bugs of earlier versions.
   
   This version passes all tests of tools/regression/bin/mv/regress.sh 1.6
   
   PR:             bin/118367
   
   Revision  Changes    Path
   1.45.2.2  +59 -18    src/bin/mv/mv.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/118367: commit references a PR
Date: Sun, 27 Jan 2008 07:38:44 +0000 (UTC)

 dds         2008-01-27 07:38:39 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     bin/mv               mv.c 
   Log:
   MFC revisions 1.47-1.50.
   
   - Follow POSIX specification when moving a directory to an existing
     directory across devices.
   
   - Improve consistency and remove some style bugs of earlier versions.
   
   This version passes all tests of tools/regression/bin/mv/regress.sh 1.6
   
   PR:             bin/118367
   
   Revision  Changes    Path
   1.46.2.1  +59 -18    src/bin/mv/mv.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: dds 
State-Changed-When: Sun Jan 27 08:08:28 UTC 2008 
State-Changed-Why:  
Code passes regression test demonstrating the original problem, and MFCd. 

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