Felipe Sateler wrote: > fel...@pcfelipe:musica% ls -ld cumbias > lrwxrwxrwx 1 felipe felipe 28 2009-05-16 15:46 cumbias -> > /home/felipe/Desktop/cumbias > fel...@pcfelipe:musica% cd cumbias > fel...@pcfelipe:cumbias% ls -ld ../cumbias > drwxr-xr-x 2 felipe felipe 4.0K 2009-04-08 13:34 ../cumbias > fel...@pcfelipe:cumbias% > > ls seems to ignore the fact that I came through a symlink and use the > real dir's parent.
Symlinks violate some principles of least surprise. Therefore it is no surprise that it is impossible to make all uses of symlinks unsurprising. What you are seeing is not a bug but is simply the way symlinks work. You changed directory through a symlink and arrived at /home/felipe/Desktop/cumbias. When you listed "../cumbias" that was relative to your new location. It has no knowledge of how you got there. Note that '.' and '..' are real directory entries. They are not pseudo entries. When 'ls .' or 'ls ..' is invoked those real directory entries are listed. The shell covers them with fake entries for the purpose of 'cd' to change the behavior into logical paths when symlinks are in use. But that does not remove the underyling entries. All operating system kernel system calls use the real entries. The fake entries are an imaginary world created within the process model of new-style, symlink-aware command shells. When ls is called upon to list a file that contains ".." in the path ls doesn't (and shouldn't) do anything special. It simply hands the filename off to the kernel call to get the directory listing. The shell now (the current shell today in contrast to the classic shell of previous decades) tries to create an imaginary world that preserves the concept of logical paths. It does this because most people want it do so. It tries to track this information using the shell $PWD variable. It would show that you are in the symlink path. But that path does not actually exist. In reality at this point you are actually in "/home/felipe/Desktop/cumbias" and it doesn't matter that you got there by following the symlink. Often people go through this process of discovery and then decide that the imaginary world created by the shell and layered on top of the physical filesystem is the source of trouble and turn off logical paths in the shell. (See the bash 'set -o physical' option.) Then after using the system that way for a while they miss the ability to "back out" of directories they arrived at through a symlink by using "cd ..". They then restore the default shell behavior and live in the imaginary world again. They have learned that it is imaginary but also now know the real boundaries of it and can work around the inconsistencies. Bob -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org