diff options
author | Jeff King <peff@peff.net> | 2018-10-24 03:38:00 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-25 11:06:51 +0900 |
commit | 321fd82389742398d2924640ce3a61791fd27d60 (patch) | |
tree | 912f515f765b3fe082c8f4e4b6a941b87990282e /refs.c | |
parent | Git 2.14.5 (diff) | |
download | tgif-321fd82389742398d2924640ce3a61791fd27d60.tar.xz |
run-command: mark path lookup errors with ENOENT
Since commit e3a434468f (run-command: use the
async-signal-safe execv instead of execvp, 2017-04-19),
prepare_cmd() does its own PATH lookup for any commands we
run (on non-Windows platforms).
However, its logic does not match the old execvp call when
we fail to find a matching entry in the PATH. Instead of
feeding the name directly to execv, execvp would consider
that an ENOENT error. By continuing and passing the name
directly to execv, we effectively behave as if "." was
included at the end of the PATH. This can have confusing and
even dangerous results.
The fix itself is pretty straight-forward. There's a new
test in t0061 to cover this explicitly, and I've also added
a duplicate of the ENOENT test to ensure that we return the
correct errno for this case.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
0 files changed, 0 insertions, 0 deletions