cvs commit: src/bin/mv mv.c
Bruce Evans
brde at optusnet.com.au
Thu Dec 27 13:54:15 PST 2007
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
More information about the cvs-src
mailing list