Subject: Re: toolchain/32983: pwd -P, found in build.sh, doesn't work with GNU/Linux
To: None <gnats-bugs@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 03/04/2006 14:10:24
On Sat, 04 Mar 2006, cagney@gnu.org wrote:
> >Synopsis:       pwd -P, found in build.sh, doesn't work with GNU/Linux

Does this patch work?

Index: build.sh
===================================================================
--- build.sh	3 Feb 2006 12:29:41 -0000	1.146
+++ build.sh	4 Mar 2006 12:07:50 -0000
@@ -68,6 +68,16 @@
 	${runcmd} echo "===> $@" | tee -a "${results}"
 }
 
+# If system supports "/bin/pwd -P", then use it, else just use /bin/pwd.
+pwd_P()
+{
+	if /bin/pwd -P >/dev/null 2>/dev/null; then
+		/bin/pwd -P
+	else
+		/bin/pwd
+	fi
+}
+
 initdefaults()
 {
 	cd "$(dirname $0)"
@@ -87,7 +97,7 @@
 	# XXX Except that doesn't work on Solaris.
 	#
 	unset PWD
-	TOP=$(/bin/pwd -P 2>/dev/null)
+	TOP="$(pwd_P 2>/dev/null)"
 
 	# Set defaults.
 	#