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

Re: [PATCH 3/3] difftool: Use eval to expand '--extcmd' expressions

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jan 15, 2010, 08:40 UTC
Message-ID
<4B502A0C.50108@viscovery.net>
In-Reply-To
<1263539762-8269-3-git-send-email-davvid@gmail.com>
David Aguilar schrieb:
> -		$GIT_DIFFTOOL_EXTCMD "$LOCAL" "$REMOTE"
> +		(eval $GIT_DIFFTOOL_EXTCMD "\"$LOCAL\"" "\"$REMOTE\"")

The new code is broken if $LOCAL or $REMOTE can contain double-quotes. How about this alternative:

		eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
which I find more readable as well.

What's the reason for the sub-shell? Do you want to protect from shell code in $GIT_DIFFTOOL_EXTCMD that modifies difftool's variables?

-- Hannes
Previous: David AguilarNext: David Aguilar
Message 8 of 9 in “t7800-difftool.sh: Simplify the --extcmd test”
  1. 1/3 t7800-difftool.sh: Simplify the --extcmd testDavid Aguilar, Jan 15, 2010
  2. 2/3 difftool: Add '-x' and as an alias for '--extcmd'David Aguilar, Jan 15, 2010
  3. Junio C HamanoJan 15, 2010
  4. Bill LearJan 15, 2010
  5. Junio C HamanoJan 16, 2010
  6. Bill LearJan 16, 2010
  7. 3/3 difftool: Use eval to expand '--extcmd' expressionsDavid Aguilar, Jan 15, 2010
  8. Johannes SixtJan 15, 2010
  9. David AguilarJan 15, 2010

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.