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

Re: [PATCH] rebase: exec leaks GIT_DIR to environment

From
Jacob Keller <jacob.keller@gmail.com>
Date
Oct 28, 2017, 22:35 UTC
Message-ID
<CA+P7+xqvHCi_aARgr0nXs7U_-P42vf8eiY7zPpG_0bp5GxokXQ@mail.gmail.com>
In-Reply-To
<alpine.DEB.2.21.1.1710281740070.6482@virtualbox>

On Sat, Oct 28, 2017 at 9:00 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 30 quoted lines
> Hi Jake,
>
> On Fri, 27 Oct 2017, Jacob Keller wrote:
>
>> From: Jacob Keller <jacob.keller@gmail.com>
>>
>> I noticed a failure with git rebase interactive mode which causes "exec"
>> commands to be run with GIT_DIR set. When GIT_DIR is in the environment,
>> then any command which results in running a git command in
>> a subdirectory will fail because GIT_DIR=".git".
>>
>> This unfortunately breaks one of my project's Makefiles, which uses
>> git-describe to find the version information, but does so from within
>> a sub directory.
>>
>> I'm in the process of running a bisect to find where this got
>> introduced, but I suspect it's part of the rebase--helper changes that
>> happened a while ago.
>
> A safe assumption. I do not know how the shell code managed that GIT_DIR
> reset, though:
>
> -- snip from v2.12.0's git-rebase--interactive.sh --
>         x|"exec")
>                 read -r command rest < "$todo"
>                 mark_action_done
>                 eval_gettextln "Executing: \$rest"
>                 "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
> -- snap --
>
>
> *However*, your test still fails with this, as
>

Yea I'm not surprised the test failed, I was in a hurry at the end of the workday when I spotted it, but wanted to get something on the mailing list before I left.

Show 8 quoted lines
> - your added test tries to remove the directory with -ff instead of -rf
>
> - it tries to run `git rebase --abort` afterwards, which fails with my fix
>   because there is no rebase in progress
>
> - instead of `cd subdir && ...`, it calls `>cd subdir && ...`, which
>   causes it to abort with a "subdir: not fonud"
>
<snip>
Show 7 quoted lines
>
> I only had time to write these two patches, and to verify that t3404
> passes now, but not that anything else passes, neither to write a proper
> commit message.
>
> Maybe you can take it from there?
>
Yep, thanks for spotting the fix!

Thanks, Jake

> Ciao,
> Dscho
Previous: Johannes SchindelinNext: Phillip Wood
Message 3 of 12 in “rebase: exec leaks GIT_DIR to environment”
  1. rebase: exec leaks GIT_DIR to environmentJacob Keller, Oct 28, 2017
  2. Johannes SchindelinOct 28, 2017
  3. Jacob KellerOct 28, 2017
  4. Phillip WoodOct 29, 2017
  5. Junio C HamanoOct 30, 2017
  6. Jacob KellerOct 30, 2017
  7. Junio C HamanoOct 30, 2017
  8. Jacob KellerOct 30, 2017
  9. Phillip WoodOct 30, 2017
  10. Johannes SchindelinOct 30, 2017
  11. Jacob KellerOct 31, 2017
  12. Jacob KellerOct 30, 2017

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.