Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Nov 1995 14:10:09 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.ORG, tege@matematik.su.se
Subject:   Re: Bogus mv behaviour
Message-ID:  <199511210310.OAA26445@godzilla.zeta.org.au>

index | next in thread | raw e-mail

>When moving directories across filesystems, e.g., "mv SOURCEDIR/A DESTDIR",
>if DESTDIR/A exists, SOURCEDIR/A will be made into DESTDIR/A/A.  That's very
>surprising, in particular when many directories are moved in the same
>command, and they end up at different levels.

This bug affects all mv's, not just ones across file systems.  I hope it
only affects the top level, so you can recover fairly easily.   This
behaviour is almost documented for mv's across file systems :-).  The
effect is supposed to be equivalent to

	rm -f DESTDIR && \
	cp -pRP SOURCEDIR/A DESTDIR && \
	rm -rf SOURCEDIR

cp will change DESTDIR to DESTDIR/A and do the wrong thing if DESTDIR/A
already exists.  However, the rm -f can't work for directories and
apparently isn't done.

mv across file systems is so fundamentally broken that I think it
shouldn't be available.  cp -pRP has several bugs (it snaps links and
doesn't preserve all possible file times) and there is no way the mv
can be atomic.

Bruce


home | help

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