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

next in thread | raw e-mail | index | archive | help
>>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.

I wrote:
>This bug affects all mv's, not just ones across file systems.  I hope it

Actually it only affects cases when the final target dir is empty.  After
`mkdir a b a/a b/a'

	mv a b			# replaces b/a by the original a
	gnu-mv a b		# fails (under LInux)

After `mkdir a b a/a b/a a/a/a b/a/b', both mv's fail.  However, if b is
on a separate file system, then FreeBSD mv still tries to do the move,
and the move succeeds because it is reduced to cp -PRp and not to renam().

Other mv strangeness: after `mkdir a b', there seems to be no way using
gnu mv to rename a to b although the rename syscall would succeed because
the target is empty.

	mv a/ b/		# renames a to b
	gnu-mv a/ b/		# renames a to b/a (under Linux)

The trailing slashes somehow stops mv from concatenating the directory
names, and rename("a/", "b/") works right under FreeBSD.

Bruce



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