Re: git rebase regression: cannot pass a shell expression directly to --exec
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- May 16, 2017, 17:37 UTC
- Message-ID
- <20170516173707.GP27400@aiede.svl.corp.google.com>
- In-Reply-To
- <20170516164750.3tw6xlbcbyuu5t72@sigill.intra.peff.net>
Jeff King wrote:
>>> On Mon, May 15, 2017 at 11:25:03PM -0400, Jeff King wrote:
>>>> One hack would be to look for BASH_FUNC_* in the environment and disable >>>> the optimization in that case. I think that would make your case Just >>>> Work. It doesn't help other oddball cases, like:
[...]
Show 5 quoted lines
>> Hm. execvp explicitly does this when it hits ENOEXEC, but not for >> ENOENT. Do you know why that is? > > When execvp(foo) falls back on ENOEXEC, it is not running "sh -c foo". > It is actually running "sh foo" to run the script contents.
Oh --- now I get it. This is about the optimization to bypass the shell in prepare_shell_command. It has nothing to do with execvp --- our execvp emulation already does the right thing, and Brandon's patches did not make this problem any worse or better.
Unconditionally falling back to sh -c when we get ENOENT in the RUN_USING_SHELL case makes sense to me.
Sorry for the confusion, Jonathan