From owner-freebsd-bugs Mon Nov 20 19:14:18 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id TAA16583 for bugs-outgoing; Mon, 20 Nov 1995 19:14:18 -0800 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id TAA16572 for ; Mon, 20 Nov 1995 19:14:13 -0800 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id OAA26445; Tue, 21 Nov 1995 14:10:09 +1100 Date: Tue, 21 Nov 1995 14:10:09 +1100 From: Bruce Evans Message-Id: <199511210310.OAA26445@godzilla.zeta.org.au> To: freebsd-bugs@FreeBSD.ORG, tege@matematik.su.se Subject: Re: Bogus mv behaviour Sender: owner-bugs@FreeBSD.ORG Precedence: bulk >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