Subject: Re: build breaks w/ read-only sources
To: Kazushi Marukawa <jam@pobox.com>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 10/30/2003 14:49:12
> Thanks for the good advices.  I sniffed around little deeper.
> And, I think I find the solution.  A patch is this.  I
> submitted send-pr too.  I'm compiling everything again to
> see it works or not.  :-)
> 
> The key is pwd.  A "pwd" of our recent /bin/sh is internal
> command and the value is cached.
> 
> Index: build.sh
> ===================================================================
> RCS file: /cvsroot/src/build.sh,v
> retrieving revision 1.122
> diff -u -r1.122 build.sh
> --- build.sh	2003/10/26 03:12:21	1.122
> +++ build.sh	2003/10/30 04:09:30
> @@ -90,7 +90,7 @@
>  	if [ "${uname_s}" = "SunOS" ]; then
>  		TOP=$(pwd -P)
>  	else
> -		TOP=$(pwd)
> +		TOP=$(/bin/pwd)
>  	fi
>  
>  	# Set defaults.

I've just dug deeper into this morass...

Posix http://www.opengroup.org/onlinepubs/007904975/utilities/pwd.html
requires that pwd (whether a shell builtin, or the command) default
to 'pwd -L' and hence assume that $PWD is correct and that you can
use ".." to travervse backwards over a symlink.

This is contrary to historical practise for everything except ksh!

The shell ought also support 'cd -L' and 'cd -P', the current 'cd'
builtin is actually a hybrid of the two.
Again the default is the ksh semantics.

The shell could be made conformant by adding a 'set -o physical' option
(as is done in pdksh).

	David

-- 
David Laight: david@l8s.co.uk