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