summaryrefslogtreecommitdiff
path: root/gnulib-tool
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2013-10-28 16:08:16 -0700
committerJim Meyering <meyering@fb.com>2013-10-28 17:05:26 -0700
commit5c508f686b9a0f986ac5d941d7be237ec047aedb (patch)
tree48d84b22af0110bb34b177297354ba38f02d7289 /gnulib-tool
parent233419c39c6d13d84439b95766328a238ffb6518 (diff)
downloadgnulib-5c508f686b9a0f986ac5d941d7be237ec047aedb.tar.gz
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.
Diffstat (limited to 'gnulib-tool')
-rwxr-xr-xgnulib-tool3
1 files changed, 3 insertions, 0 deletions
diff --git a/gnulib-tool b/gnulib-tool
index ed693e0163..669931c034 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,