Re: [PATCH 2/2] git: continue alias lookup on EACCES errors
From: Frans Klaver <hidden>
Date: 2016-06-15 22:53:25
Hi, On Wed, Mar 28, 2012 at 9:40 PM, Jeff King [off-list ref] wrote:
On Wed, Mar 28, 2012 at 11:29:17AM -0700, Junio C Hamano wrote:quoted
quoted
That sounds sensible to me. I think it involves writing our own execvp, though, right? If we use stock execvp, we can't tell the difference between the two cases.The stock exec*p() will not hit "/bin/ls" in either case, so we will give "'ls' is not a git command", without having to differenciate it. That is what I meant by "we follow the usual rule to ignore it". We already have the code necessary to enumerate the possible commands from components of the PATH in order to give suggestion, so we can run it after seeing exec*p() failure to see if we did not see any "ls", or we saw "ls" but it was not executable. No need to penalize the normal case, no?Yes, we can differentiate after the fact. Though I think it ends up being almost the same code as just implementing execvp in the first place.
It will, but doesn't stock execv*() also provide access to shell builtins? If that's the case then I wouldn't be bothered by the extra bit of code we need to understand what execvp has been doing. I think it would be sane to keep sane_execvp a wrapper instead of a reimplementation.