sh-setup: protect from exported IFS
Many scripted Porcelains rely on being able to split words at the default $IFS characters, i.e. SP, HT and LF. If the user exports a non-default IFS to the environment, what they read from plumbing commands such as ls-files that use HT to delimit fields may not be split in the way we expect. Protect outselves by resetting it, just like we do so against CDPATH exported to the environment. Noticed by Andrew Dranse <adranse@oanda.com>. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 8, 2012 at 12:08 UTC
785063e02bb249ef3a39db88575fe626b310d4a7
1 file changed
+4
git-sh-setup.sh
+4
@@ -9,8 +9,12 @@
9
# you would cause "cd" to be taken to unexpected places. If you
10
# like CDPATH, define it for your interactive shell sessions without
11
# exporting it.
12
+# But we protect ourselves from such a user mistake nevertheless.
13
unset CDPATH
14
15
+# Similarly for IFS
16
+unset IFS
17
+
18
git_broken_path_fix () {
19
case ":$PATH:" in
20
*:$1:*) : ok ;;