I recently found the following bug with mv (GNU fileutils) 4.0 running on
"Linux cognac.bbn.com 2.2.10 #1 Sat Jul 3 12:42:11 EDT 1999 i686 unknown".
I also replicated the bug on a Red Hat GNU/Linux 2.2.12-20 system with the
same version of "mv".  The bug does not appear with mv (GNU fileutils) 3.16
on "Linux rum.bbn.com 2.0.35 #1 Mon Aug 10 12:52:28 EDT 1998 i686 unknown".

I hope I'm reporting this bug to the correct group of folks; if not, I
offer my apologies and ask that you tell me where to write instead.

Thanks!
        Robert MacIntyre
        BBN Technologies
        [EMAIL PROTECTED]

================================================================

The bug comes up given the following three conditions:
  1. one tries to move a list of files to a directory
  2. the list of files includes directories
  3. the destination directory is itself the last file on the list.

I find this bug somewhat disturbing, since I often use
   mkdir foo
   mv * foo
as a shortcut for adding a new level of directory structure.

It's probably easiest to describe the bug by example:

 setup:
  % mkdir a z
  % echo foo > myfile

 correct behavior:
  % mv * a
  mv: cannot move `a' to a subdirectory of itself, `a/a'
   (and as you would expect, all the other files are moved from ./ to a/)

 reset:
  % mv a/* .

 incorrect behavior:
  % mv * z
  mv: z/z/a: won't create hard link `z/z' to directory `(null)'

  In this second case, you'll see that "mv" ends up creating a _new_
  directory z/z/, which contains a _copy_ of myfile, in addition to doing
  what it was supposed to do (moving the other files to z/).

Reply via email to