Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2007 08:54:10 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Diomidis Spinellis <dds@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/bin/mv mv.c
Message-ID:  <20071228083650.L17488@delplex.bde.org>
In-Reply-To: <200712271133.lBRBXhjY038891@repoman.freebsd.org>
References:  <200712271133.lBRBXhjY038891@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Dec 2007, Diomidis Spinellis wrote:

> dds         2007-12-27 11:33:42 UTC
>
>  FreeBSD src repository
>
>  Modified files:
>    bin/mv               mv.c
>  Log:
>  - Roll-back attempts to mimic rename(2) atomicity introduced in 1.47,
>    and follow the letter of the POSIX specification.
>
>  - Moving a directory to an existing non-empty directory will now fail,
>    as required.

It should be noted that the previous behaviour was very dangerous.  It
could destroy target directory trees of any size in order to replace
them with a typo, but of course a local rename() can only destroy the
target directory tree if that tree consists of an empty target directory.
The destroyed target directory tree cannot quite be /, but it can be
almost as important:

 	mkdir /tmp/usr
 	cd /tmp
 	mv usr /		# when /tmp and /usr are on different fs's.
 				# this replaced /usr by the empty usr,
 				# using esentially the following:
 	mv /usr /usr.backup
 	cp -pRp usr /
 	rm -rf /usr.backup
 	rm -rf usr

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071228083650.L17488>