Re: mv: cannot move `dir' to a subdirectory of itself, `../dir'

2007-08-14 Thread Andreas Schwab
Phillip Susi <[EMAIL PROTECTED]> writes:

> Andreas Schwab wrote:
>> "Chris Moore" <[EMAIL PROTECTED]> writes:
>>
>>> $ mv dir ..
>>> mv: cannot move `dir' to a subdirectory of itself, `../dir'
>>
>> With coreutils 6.9 you'll get "Directory not empty".
>
> That also seems incorrect.  Shouldn't the error be "A file ( directory )
> with that name already exists"?

No.  If the directory was empty it would just be overwritten, so the
non-emptyness is the key for the error (and it's directly the error the
kernel returns).

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: mv: cannot move `dir' to a subdirectory of itself, `../dir'

2007-08-14 Thread Phillip Susi

Andreas Schwab wrote:

"Chris Moore" <[EMAIL PROTECTED]> writes:


$ mv dir ..
mv: cannot move `dir' to a subdirectory of itself, `../dir'


With coreutils 6.9 you'll get "Directory not empty".


That also seems incorrect.  Shouldn't the error be "A file ( directory ) 
with that name already exists"?




___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: mv: cannot move `dir' to a subdirectory of itself, `../dir'

2007-08-14 Thread Andreas Schwab
"Chris Moore" <[EMAIL PROTECTED]> writes:

> $ mv dir ..
> mv: cannot move `dir' to a subdirectory of itself, `../dir'

With coreutils 6.9 you'll get "Directory not empty".

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


mv: cannot move `dir' to a subdirectory of itself, `../dir'

2007-08-14 Thread Chris Moore
mv seems to think that ../dir is a subdirectory of dir, not realising that
.. has a special meaning.

Here's a shell transcript that produces the incorrect error message in
coreutils 5.97-5.2ubuntu3 (ubuntu 7.04):

$ cd
$ mkdir test
$ cd test
$ mkdir ../dir
$ mkdir dir
$ touch ../dir/x dir/y
$ ls -al ../dir dir
dir:
total 20
drwxr-xr-x 2 chris chris 4096 2007-08-14 18:37 .
drwxr-xr-x 3 chris chris 4096 2007-08-14 18:36 ..
-rw-r--r-- 1 chris chris0 2007-08-14 18:37 y

../dir:
total 28
drwxr-xr-x   2 chris chris  4096 2007-08-14 18:37 .
drwx-- 104 chris chris 12288 2007-08-14 18:36 ..
-rw-r--r--   1 chris chris 0 2007-08-14 18:37 x
$ mv dir ..
mv: cannot move `dir' to a subdirectory of itself, `../dir'
$ rm ../dir/x
$ ls -al ../dir dir
dir:
total 20
drwxr-xr-x 2 chris chris 4096 2007-08-14 18:37 .
drwxr-xr-x 3 chris chris 4096 2007-08-14 18:36 ..
-rw-r--r-- 1 chris chris0 2007-08-14 18:37 y

../dir:
total 24
drwxr-xr-x   2 chris chris  4096 2007-08-14 18:38 .
drwx-- 104 chris chris 12288 2007-08-14 18:36 ..
$ mv dir ..
$ ls -al ../dir dir
ls: dir: No such file or directory
../dir:
total 28
drwxr-xr-x   2 chris chris  4096 2007-08-14 18:37 .
drwx-- 104 chris chris 12288 2007-08-14 18:36 ..
-rw-r--r--   1 chris chris 0 2007-08-14 18:37 y
$

Perhaps it's correct behaviour not to allow me to move ./dir into the parent
directory when the parent directory contains a non-empty directory with the
same name, but the error message that is shown is misleading - ../dir isn't
a subdirectory of ./dir
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils