summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-27 00:29:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-27 03:16:02 (GMT)
commit3fa7c3da379bb47a0e7a52ffc13cb366add880a2 (patch)
treeefb1792b07bfd5823954bf11c852fb9567a2eb62
parent9524cf29930b4f91d68ad1384d7f984393a54c15 (diff)
downloadgit-3fa7c3da379bb47a0e7a52ffc13cb366add880a2.zip
git-3fa7c3da379bb47a0e7a52ffc13cb366add880a2.tar.gz
git-3fa7c3da379bb47a0e7a52ffc13cb366add880a2.tar.bz2
work around an obnoxious bash "safety feature" on OpenBSD
Bash (4.0.24) on OpenBSD 4.6 refuses to run this snippet: $ cat gomi.sh #!/bin/sh one="/var/tmp/1 1" rm -f /var/tmp/1 "/var/tmp/1 1" echo hello >$one $ sh gomi.sh; ls /var/tmp/1* /var/tmp/1 1 $ bash gomi.sh; ls /var/tmp/1* gomi.sh: line 4: $one: ambiguous redirect ls: /var/tmp/1*: No such file or directory Every competent shell programmer knows that a <$word in redirection is not subject to field splitting (POSIX.1 "2.7 Redirection" explicitly lists the kind of expansion performed: "... the word that follows the redirection operator shall be subjected to ...", and "Field Splitting" is not among them). Some clueless folks apparently decided that users need to be protected in the name of "security", however. Output from "git grep -e '> *\$' -- '*.sh'" indicates that rebase-i suffers from this bogus "safety". Work it around by surrounding the variable reference with a dq pair. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-rebase--interactive.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 19a608c..3e4fd14 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -378,7 +378,7 @@ update_squash_messages () {
sed -e 1d -e '2,/^./{
/^$/d
}' <"$SQUASH_MSG".bak
- } >$SQUASH_MSG
+ } >"$SQUASH_MSG"
else
commit_message HEAD > "$FIXUP_MSG" || die "Cannot write $FIXUP_MSG"
COUNT=2
@@ -387,7 +387,7 @@ update_squash_messages () {
echo "# The first commit's message is:"
echo
cat "$FIXUP_MSG"
- } >$SQUASH_MSG
+ } >"$SQUASH_MSG"
fi
case $1 in
squash)
@@ -403,7 +403,7 @@ update_squash_messages () {
echo
commit_message $2 | sed -e 's/^/# /'
;;
- esac >>$SQUASH_MSG
+ esac >>"$SQUASH_MSG"
}
peek_next_command () {