Today I found something really interesting (at least to me) on one of our test servers:
I can change into an existing directory from my actual working directory using a relative path, but that very same directory is not listed when using ls -a
.
Here is the shell session (as root
):
$ pwd
/you/are/here
$ ls -a
. .. <-- Note: "somedir" is not shown to root
$ echo $CDPATH
$ cd somedir <-- But still: "cd" works fine
$ pwd
/you/are/here/somedir
$ cd ..
$ pwd
/you/are/here
$ ls -a
. ..
Could someone tell me, how is this possible at all? I have checked: ls
is from /bin/ls
, and pwd
is /bin/pwd
, both from their original package (I mean: not hacked).
/you
is a mounted EMC disk (ext3). And somedir
exists as I can list the contents of it (there are several subdirs, files). Its name does not start with a dot.
Some more shell session, with more info about the commands and the ls
output:
root@U-TEST@AT$/bin/ls -ali
total 4
16515074 drwxrwxr-x 2 U8000966 test 2048 Sep 1 07:39 .
16515073 drwxrwxr-x 3 U8000966 test 2048 Apr 27 2006 ..
root@U-TEST@AT$ls -ali somewhere | head -5
total 182
16515075 drwxrwxr-x 43 U8000966 test 2048 Sep 1 07:39 .
16515074 drwxrwxr-x 2 U8000966 test 2048 Sep 1 07:39 ..
16519169 drwxrwxrwx 4 U8000966 test 2048 Jul 25 2007 AAA
16515124 drwxrwxr-x 3 U8000966 test 2048 May 12 2006 BBB
root@U-TEST@AT$type ls
ls is aliased to `/bin/ls $LS_OPTIONS'
root@U-TEST@AT$type pwd
pwd is a shell builtin
root@U-TEST@AT$/bin/pwd
/you/are/here
root@U-TEST@AT$cd somewhere
root@U-TEST@AT$/bin/pwd
/you/are/here/somewhere
root@U-TEST@AT$type cd
cd is a shell builtin
Please note the Total 4 after the first ls -ali
. (I don't know if it's relevant...)
Some more tests:
root@UR-TEST@AT$ls
. ..
root@U-TEST@AT$touch somewhere/testfile
root@U-TEST@AT$ls
. ..
root@U-TEST@AT$cp somewhere/testfile ./
root@U-TEST@AT$ls
. .. testfile
root@U-TEST@AT$du .
2 .
root@URBIS-TEST@AT$
And EMC is: http://www.emc.com/products/family/disk-library-family.htm , but they are only a disk provider in this case, with hard disks, formatted as ext3.
UPDATE
(Sorry, but yesterday I had to leave)
I did check echo *
, and its output is: . ..
. Here are the LS_OPTIONS
: -a -N --color=tty -T 0
.
I had checked the automount thing mentioned by Gilles, but as I had changed to somewhere
and issued a mount|grep somewhere
there were no output.
Here is the lsattr
and strace
output as suggested: http://gist.github.com/566947
somedir
indeed exists? Any clues when typingls -a /you/are/here/somedir
?ls -a
does not listsomedir
(toroot
), but stillcd somedir
works just fine.ls is aliased to /bin/ls $LS_OPTIONS
. So, what doesecho $LS_OPTIONS
give you then? (Though I doubt that is relevant while you were also explicitely using/bin/ls
with the same result, and the intriguing "total 4"...)echo *
,ls -ld somedir
,ls -lb
orls -l|cat -v
show anything helpful?