ls .. not respecting symbolic links

Robb, Sam sam.robb@timesys.com
Tue Dec 10 08:36:00 GMT 2002


All,

  My apologies if this is a report of expected behavior.  I'm
primarily a Windows user, and despite spending the last year
in Linux/Cygwin lands, I'm still very new to some things :-/

  Create a symlink to a directory:

$ cd /tmp
$ ls
$ ln -s /cygdrive/c/TEMP c_temp
$ cd c_temp

  At this point, I'd expect "ls .." to give me a listing of /tmp.
Instead, I get a listing for /cygdrive/c:

$ ls -la ..
total 733
-rwxr-xr-x    1 sam.robb unknown         0 Sep  7  2001 AUTOEXEC.BAT
-rw-r--r--    1 sam.robb unknown         0 Sep  7  2001 CONFIG.SYS
(etc)

Similarly, "find .. -maxdepth 1" gives:

$ find .. -maxdepth 1
..
../AUTOEXEC.BAT
../boot.ini
../CONFIG.SYS
(etc)
  

  On the other hand, using "ls $PWD/.." gives the contents of /tmp,
as does "find $PWD/.. -maxdepth 1":

$ ls -la $PWD/..
total 4
drwxr-xr-x    2 sam.robb unknown         0 Dec 10 11:01 .
drwxr-xr-x   15 sam.robb unknown      4096 Dec  4 16:30 ..
lrwxrwxrwx    1 sam.robb unknown       103 Dec 10 11:01 c_temp -> /cygdrive/c/TEMP

$ find $PWD/.. -maxdepth 1
/tmp/c_temp/..
/tmp/c_temp/../c_temp

  I see the same behavior under Linux, so the question is:
is this a bash bug, or expected behavior?

-Samrobb

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list