Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 3967

Summary: su resolves symlinks to their source
Product: [Retired] Red Hat Linux Reporter: Matthew Galgoci <mgalgoci>
Component: sh-utilsAssignee: David Lawrence <dkl>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: mgalgoci
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-07-09 17:40:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Matthew Galgoci 1999-07-09 17:30:53 UTC
I don't know if this is proper behavior or not,
but su seems to follow symlinks to their source.

However, when you exit the shell that you su to, it


[mgalgoci@skuzzlebutt linux]$ pwd
[mgalgoci@skuzzlebutt linux]$ su
[root@skuzzlebutt linux-2.2.5]#
[root@skuzzlebutt linux-2.2.5]# exit
[mgalgoci@skuzzlebutt linux]$ ls -al ../linux
lrwxrwxrwx   1 root     root           11 Apr 24 14:13
../linux -> linux-2.2.5
[mgalgoci@skuzzlebutt linux]$

Comment 1 Jeff Johnson 1999-07-09 17:40:59 UTC
The function getcwd(3) recurses backward to / from the current
directory in order to discover the path. When the shell is first
invoked (by su in this case), getcwd is invoked to find the current
directory. Henceforth, the arg of each cd command is used to save the
current directory. So, in your case, to restore the prompt, you
would need to do
	cd ../linux
	cd /usr/src/linux
to restore the prompt value.