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

Re: [PATCH] filter-branch: use sh -c instead of eval

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Jun 5, 2007, 19:02 UTC
Message-ID
<f44bvq$klu$1@sea.gmane.org>
In-Reply-To
<20070605165734.GA21708@moooo.ath.cx>
Matthias Lederhofer wrote:
Show 10 quoted lines
> If filters use variables with the same name as variables
> used in the script the script breaks.  Executing the filters
> in a separate process prevents accidential modification of
> the variables in the main process.
> @@ -349,21 +349,21 @@ while read commit; do
>  
>  eval "$(set_ident AUTHOR <../commit)"
>  eval "$(set_ident COMMITTER <../commit)"
> -     eval "$filter_env" < /dev/null
> +     sh -c "$filter_env" < /dev/null
NACK.

The eval is on purpose here. $filter_env must be able export GIT_AUTHOR* and GIT_COMMITTER* variables here.

Generally, it might be useful that one filter sets or exports variables that are then available for subsequent filters or the next commit. Therefore, I think it's actually a feature to have eval instead of sh -c even if there is a chance that the filter overwrites internal variables.

-- Hannes
Previous: Matthias LederhoferNext: Junio C Hamano
Message 2 of 3 in “filter-branch: use sh -c instead of eval”
  1. filter-branch: use sh -c instead of evalMatthias Lederhofer, Jun 5, 2007
  2. Johannes SixtJun 5, 2007
  3. Junio C HamanoJun 6, 2007

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.