Bug 91886 - "ls .." output diffesr from the output of "cd .. ; ls " in case the current working directory is a symlink.
"ls .." output diffesr from the output of "cd .. ; ls " in case the current w...
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: coreutils (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-05-29 06:25 EDT by jisingh
Modified: 2007-04-18 12:54 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-05-29 06:28:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description jisingh 2003-05-29 06:25:04 EDT
Description of problem:
"ls .." shows different directory content than "cd .. ; ls" when the current
directory is a symlink, pointing to another directory. This will create
confusion for an average user who is not aware of the fact that the current
directory is a symlink.

Version-Release number of selected component (if applicable):
4.5.3-19


How reproducible:

Steps to Reproduce:

1. say I've a directory as
/path1/foo
& another directory as
/path2


2. making a new symlink to /path1/foo

$ cd /path2/
$ ln -s /path1/foo/ bar
$ cd bar
/path2/bar
$ 


3. now executing the command "ls .." shows the content of the parent of target
directory (content of /path1, & not of /path2)
$ ls ..
foo

while "cd .." will lead me to /path2 
$ cd ..
$ pwd
/path2
$ ls
bar
$ 


.... this seem to be an inconsistency, considering the situation where a user is
not aware of that 'bar' is actually a symlink, what he sees is a completely
different output from seemingly trivial commands.


Actual results:
"ls .."  &  "cd .. ; ls" show different directory contents.

Expected results:
The contenst shown by "ls .." should be the content of the parent directory of
the symlink...

Additional info:
Comment 1 Tim Waugh 2003-05-29 06:28:28 EDT
No, this is correct behaviour.  Use 'cd -P' to prevent confusion.  When you have
used 'cd symlink', the 'parent' directory (the one you were just in) is only
known to bash, and not to ls.

Note You need to log in before you can comment on or make changes to this bug.