bootstrap: don't let a user's CDPATH setting affect this script
authorJim Meyering <meyering@redhat.com>
Thu, 19 Apr 2012 14:02:23 +0000 (16:02 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 19 Apr 2012 14:07:12 +0000 (16:07 +0200)
When CDPATH is set, cd will sometimes generate output.
When "cd" is run in a subshell whose output matters, that
surprising-to-some output can cause malfunction.
Unsetting CDPATH turns off this shell "feature."
* build-aux/bootstrap (CDPATH): Unset.
Reported by Reuben Thomas in:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30435
and inspired by his patch here:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30440

ChangeLog
build-aux/bootstrap

index c980aa3..693ad24 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-04-19  Jim Meyering  <meyering@redhat.com>
+
+       bootstrap: don't let a user's CDPATH setting affect this script
+       When CDPATH is set, cd will sometimes generate output.
+       When "cd" is run in a subshell whose output matters, that
+       surprising-to-some output can cause malfunction.
+       Unsetting CDPATH turns off this shell "feature."
+       * build-aux/bootstrap (CDPATH): Unset.
+       Reported by Reuben Thomas in:
+       http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30435
+       and inspired by his patch here:
+       http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30440
+
 2012-04-16  Akim Demaille  <akim@lrde.epita.fr>
        and Jim Meyering  <meyering@redhat.com>
 
index 16dc15c..4afc6c4 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2012-04-16.16; # UTC
+scriptversion=2012-04-19.14; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -36,6 +36,10 @@ nl='
 LC_ALL=C
 export LC_ALL
 
+# Ensure that CDPATH is not set.  Otherwise, the output from cd
+# would cause trouble in at least one use below.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
 local_gl_dir=gl
 
 me=$0