From: Jim Meyering Date: Mon, 28 Oct 2013 23:08:16 +0000 (-0700) Subject: gnulib-tool: protect against CDPATH X-Git-Tag: snapshot-start~48 X-Git-Url: http://erislabs.net/gitweb/?p=gnulib.git;a=commitdiff_plain;h=5c508f686b9a0f986ac5d941d7be237ec047aedb gnulib-tool: protect against CDPATH * gnulib-tool: Many "cd" built-in functions print a directory name to stdout when CDPATH is set, e.g., $ bash -c 'CDPATH=/; cd tmp' /tmp Unset it, when possible. Prompted by a comment from Bruce Korb. --- diff --git a/ChangeLog b/ChangeLog index 6fca0c7d7..0c564db88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2013-10-28 Jim Meyering + gnulib-tool: protect against CDPATH + * gnulib-tool: Many "cd" built-in functions print a directory name + to stdout when CDPATH is set, e.g., + $ bash -c 'CDPATH=/; cd tmp' + /tmp + Unset it, when possible. Prompted by a comment from Bruce Korb. + maint.mk: restore functionality removed by recent change... Sunday's change, v0.0-8062-g6b24f60, may have appeared correct from the context of a shallow-cloned gnulib repository: "git describe" diff --git a/gnulib-tool b/gnulib-tool index ed693e016..669931c03 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -898,6 +898,9 @@ if test "X$1" = "X--no-reexec"; then shift fi +# Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + # Command-line option processing. # Removes the OPTIONS from the arguments. Sets the variables: # - mode one of: list, find, import, add-import, remove-import,