Thread (29 messages) 29 messages, 9 authors, 2017-05-16

Re: git rebase regression: cannot pass a shell expression directly to --exec

flat view

From: Johannes Schindelin <hidden>
Date: 2017-05-16 20:12:32

Hi Linus,

On Tue, 16 May 2017, Linus Torvalds wrote:
On Tue, May 16, 2017 at 10:23 AM, Jeff King [off-list ref] wrote:
quoted
I think the logic here would be more like:

  1. During prepare_shell_cmd(), even if we optimize out the shell call,
     still prepare a fallback argv (since we can't allocate memory
     post-fork).

  2. In the forked child, if we get ENOENT from exec and cmd->use_shell
     is set, then exec the fallback shell argv instead. Propagate its
     results, even if it's 127.

That still means we'd prefer a $PATH copy of a command to its shell
builtin variant, but that can't be helped (and I kind of doubt anybody
would care too much).
I think it would be better to just

 (a) get rid of the magic strcspn() entirely

 (b) make the 'can we optimize this' test be simply just looking up
'argv[0]' in $PATH
What about

	ABC=1 my-executable my-arg

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help