bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Chris Moore
Subject: mv: cannot move `dir' to a subdirectory of itself, `../dir'
Date: Tue, 14 Aug 2007 18:50:02 +0200

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 chris    0 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 chris    0 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]