Subject: Re: Fix ".. " semantic =?us-ascii?Q?projec?=
To: Jean-Baptiste Campesato <camjelemon@gmail.com>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 03/05/2007 19:49:00
On Sun, Mar 04, 2007 at 09:27:54PM +0100, Jean-Baptiste Campesato wrote:
>
> In brief, when you chdir to a symlink (eg: /home/camje_lemon/test/
> which points to /home/camje_lemon/netbsd/code/) getcwd will return the
> pointed node path (/home/camje_lemon/netbsd/code/) and a chdir to ..
> will set your pwd to the parent node of the pointed node
> (/home/camje_lemon/netbsd/).
I somehow missed this first time around :-)
The current behaviour is absolutely correct, and the kernel should not,
under any circumstances, return any other value for the 'getcwd'
system calls.
See: http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html
"The getcwd() function shall place an absolute pathname of the current
working directory in the array pointed to by buf, and return buf. The
pathname copied to the array shall contain no components that are symbolic
links."
Shells may choose to support logical or physical views of the current
directory [1], and the login sequence may be such that the initial value
for $PWD matches that of $HOME.
David
[1] The SuS and Posix 1003.2b requires that 'cd -L path' and 'cd -P path'
treat the operationlogically or physically, but this is the shell buildin
and not the system call.
--
David Laight: david@l8s.co.uk