diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-26 16:29:30 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-26 19:16:02 -0800 |
commit | 3fa7c3da379bb47a0e7a52ffc13cb366add880a2 (patch) | |
tree | efb1792b07bfd5823954bf11c852fb9567a2eb62 /t/t4017-diff-retval.sh | |
parent | fix portability issues with $ in double quotes (diff) | |
download | tgif-3fa7c3da379bb47a0e7a52ffc13cb366add880a2.tar.xz |
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>
Diffstat (limited to 't/t4017-diff-retval.sh')
0 files changed, 0 insertions, 0 deletions