git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] t/lib-gpg: quote path to ${GNUPGHOME}/trustlist.txt

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Feb 8, 2019, 20:11 UTC
Message-ID
<20190208201105.GA10587@szeder.dev>
In-Reply-To
<20190208031746.22683-2-tmz@pobox.com>
On Thu, Feb 07, 2019 at 10:17:45PM -0500, Todd Zullinger wrote:
> 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:
s/error/warning/
Show 7 quoted lines
>   $ 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.
Likewise.

POSIX says that no field splitting should be performed on the result of a parameter expansion that is used as the target of a redirection, but Bash doesn't conform in this respect (unless in POSIX mode).

Show 23 quoted lines
> 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>
> ---
>  t/lib-gpg.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
> index f1277bef4f..207009793b 100755
> --- a/t/lib-gpg.sh
> +++ b/t/lib-gpg.sh
> @@ -63,7 +63,7 @@ then
>  		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 &&
> -- 
> Todd
Previous: Todd ZullingerNext: Todd Zullinger
Message 4 of 15 in “t/lib-gpg: a gpgsm fix, a minor improvement, and a question”
  1. 0/2 t/lib-gpg: a gpgsm fix, a minor improvement, and a questionTodd Zullinger, Feb 8, 2019
  2. 2/2 t/lib-gpg: drop redundant killing of gpg-agentTodd Zullinger, Feb 8, 2019
  3. 1/2 t/lib-gpg: quote path to ${GNUPGHOME}/trustlist.txtTodd Zullinger, Feb 8, 2019
  4. SZEDER GáborFeb 8, 2019
  5. Todd ZullingerFeb 8, 2019
  6. SZEDER GáborFeb 8, 2019
  7. Henning SchildFeb 8, 2019
  8. Junio C HamanoFeb 8, 2019
  9. SZEDER GáborFeb 9, 2019
  10. Todd ZullingerFeb 9, 2019
  11. SZEDER GáborFeb 11, 2019
  12. Todd ZullingerFeb 14, 2019
  13. Jeff KingFeb 12, 2019
  14. Junio C HamanoFeb 12, 2019
  15. SZEDER GáborFeb 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.