Mail Archives: djgpp-workers/1999/11/16/10:03:22
> > Are getwd and getcwd documented somewhere to return the
> > symlink name, rather than the actual directory name? If not,
> > perhaps we are better off without recording the symlink in
> > some hidden variable?
> It's up to implementation. If we do or do not do that we got following
> difference, as pointed out by Alain when we discussed it earlier:
> --------
> When you say chdir() should be adjust, how ? see two different
> behaviours below (Solaris vs GNU/Linux) of chdir() :
Are you sure this difference is not because of a different configuration
of Bash? IIRC, Bash has an option to change its behaviour regarding
this. From a (probably old) Bash Info-file:
Node: Bash Variables
...
`nolinks'
If present, says not to follow symbolic links when doing commands
that change the current working directory. By default, bash
follows the logical chain of directories when performing commands
such as `cd' which change the current directory.
For example, if `/usr/sys' is a link to `/usr/local/sys' then:
$ cd /usr/sys; echo $PWD
/usr/sys
$ cd ..; pwd
/usr
If `nolinks' exists, then:
$ cd /usr/sys; echo $PWD
/usr/local/sys
$ cd ..; pwd
/usr/local
See also the description of the `-P' option to the `set' builtin,
*Note The Set Builtin::.
...
Node: The Set Builtin
...
`-P'
If set, do not follow symbolic links when performing commands
such as `cd' which change the current directory. The
physical directory is used instead.
Maybe we should leave this option to Bash, not libc.
Groente, Michel.
- Raw text -