Skip to content

Commit 393050c

Browse files
committed
sh-setup: work around "unset IFS" bug in some shells
With an unset IFS, field splitting is supposed to act as if IFS is set to the usual SP HT LF, but Marc Branchaud reports that the shell on FreeBSD 7.2 gets this wrong. It is easy to set it to the default value manually, and it is also safer in case somebody tries to save the old value away and restore, e.g. $oIFS=$IFS IFS=something ... IFS=$oIFS while forgetting that the original IFS might be unset (which can be coded but would be more involved). Signed-off-by: Junio C Hamano <[email protected]>
1 parent a859d3e commit 393050c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

git-sh-setup.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# But we protect ourselves from such a user mistake nevertheless.
1313
unset CDPATH
1414

15-
# Similarly for IFS
16-
unset IFS
15+
# Similarly for IFS, but some shells (e.g. FreeBSD 7.2) are buggy and
16+
# do not equate an unset IFS with IFS with the default, so here is
17+
# an explicit SP HT LF.
18+
IFS='
19+
'
1720

1821
git_broken_path_fix () {
1922
case ":$PATH:" in

0 commit comments

Comments
 (0)