t/lib-gpg: quote path to ${GNUPGHOME}/trustlist.txt
authorTodd Zullinger <tmz@pobox.com>
Fri, 8 Feb 2019 03:17:45 +0000 (22:17 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Feb 2019 18:01:39 +0000 (10:01 -0800)
When gpgsm is installed, lib-gpg.sh attempts to update trustlist.txt to
relax the checking of some root certificate requirements. The path to
"${GNUPGHOME}" contains spaces which cause an "ambiguous redirect"
warning when bash is used to run the tests:

$ bash t7030-verify-tag.sh
/git/t/lib-gpg.sh: line 66: ${GNUPGHOME}/trustlist.txt: ambiguous redirect
ok 1 - create signed tags
ok 2 # skip create signed tags x509 (missing GPGSM)
...

No warning is issued when using bash called as /bin/sh, dash, or mksh.

Quote the path to ensure the redirect works as intended and sets the
GPGSM prereq. While we're here, drop the space after ">>".

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-gpg.sh
index 3fe02876c1fc7e4f7488c1534a4745f5760f1ca0..d90160eb0b51aa478c2c70c9521a19484e3ffc97 100755 (executable)
@@ -60,7 +60,7 @@ then
                gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K \
                        | grep fingerprint: | cut -d" " -f4 | tr -d '\n' > \
                        ${GNUPGHOME}/trustlist.txt &&
-               echo " S relax" >> ${GNUPGHOME}/trustlist.txt &&
+               echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
                (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
                echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
                        -u committer@example.com -o /dev/null --sign - 2>&1 &&