Subject: toolchain/17313: build.sh fails with bash and symbolic links
To: None <gnats-bugs@gnats.netbsd.org>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 06/19/2002 16:25:05
>Number:         17313
>Category:       toolchain
>Synopsis:       build.sh fails with bash and symbolic links
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 19 00:05:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ian Dall
>Release:        NetBSD 1.5ZC
>Organization:
private
>Environment:
	
	
System: Linux sibyl.beware.dropbear.id.au 2.4.7-10custom #3 Sun Nov 4 21:08:55 CST 2001 i686 unknown
Architecture: unknown
Machine: i686
>Description:
	
Build.sh sets MAKEOBJDIR to "\${.CURDIR:C,^$cwd,$OPTARG,}". So make tests
if ${.CURDIR} starts with $cwd. When /bin/sh is bash (as on linux) the built
in pwd returns PWD, if set and pointing to the current working directory.
The path in PWD need not be the cannonical path and may include symbolic links.
This causes the test to fail and for the object directories to not be made.
>How-To-Repeat:
	
create a symbolic link eg

  bash
  ln -s /foo .../netbsd
  cd /foo/src
  bash ./build.sh -O <object dirs>

>Fix:
	

Index: netbsd/src/build.sh
diff -c netbsd/src/build.sh:1.1.1.8 netbsd/src/build.sh:1.4
*** netbsd/src/build.sh:1.1.1.8	Wed Jun 12 11:46:22 2002
--- netbsd/src/build.sh	Wed Jun 19 00:48:51 2002
***************
*** 16,21 ****
--- 16,23 ----
  [ -d usr.bin/make ] || bomb "build.sh must be run from the top source level"
  [ -f share/mk/bsd.own.mk ] || bomb "src/share/mk is missing; please re-fetch the source tree"
  
+ # Eliminate confusion if PWD has symbolic links in the path.
+ unset PWD
  TOP=`pwd`
  
  getarch () {
>Release-Note:
>Audit-Trail:
>Unformatted: