git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] Git 2.38.0-rc1 t1800 message text comparison

From
René Scharfe <l.s.r@web.de>
Date
Jun 4, 2023, 20:55 UTC
Message-ID
<28d808e4-77b4-d91e-8a86-c21287019b56@web.de>
In-Reply-To
<f5519f93-bca7-ecbc-9da3-b25ce8aef618@web.de>
Am 04.06.23 um 14:13 schrieb René Scharfe:
Show 24 quoted lines
> Am 22.05.23 um 23:13 schrieb rsbecker@nexbridge.com:
>> The following is a potential fix:
>>
>> diff --git a/run-command.c b/run-command.c
>> index 60c9419866..b76e117d35 100644
>> --- a/run-command.c
>> +++ b/run-command.c
>> @@ -846,7 +846,7 @@ int start_command(struct child_process *cmd)
>>                         execve(argv.v[0], (char *const *) argv.v,
>>                                (char *const *) childenv);
>>
>> -               if (errno == ENOENT) {
>> +               if (errno == ENOENT || errno == EACCES) {
>>                         if (cmd->silent_exec_failure)
>>                                 child_die(CHILD_ERR_SILENT);
>>                         child_die(CHILD_ERR_ENOENT);
>>
>> This does pass and should cover all POSIX interpretations.
>
> That would misreport execution failures due to missing permissions
> (think e.g. "chmod 0 file") as "No such file or directory".  So this
> should be only done if really needed, perhaps guarded by an access(2)
> check for verifying that EACCES is bogus, and only on affected
> platforms.

Actually the difference is a bit more subtle. With that patch and silent_exec_failure on, missing permissions wouldn't be reported anymore, and with it off the eventual message command would change from:

                error_errno("cannot exec '%s'", cmd->args.v[0]);
to:
                error_errno("cannot run %s", cmd->args.v[0]);

So the actual errno-based message would be the same, unless its suppressed.

What's the significance of "run" and "exec" here? Why do we have both variants? Is it to tell apart errors of the actual execve(2) call from those in code leading up to it (e.g. when searching the executable in $PATH)? But at this point we are after the call, so why is ENOENT from execve(2) a "run" thing, not an "exec" thing?

René
Previous: René ScharfeNext: Junio C Hamano
Message 9 of 13 in “[BUG] Git 2.28.0-rc1 t1800 message text comparison”
  1. rsbecker@nexbridge.comSep 22, 2022
  2. rsbecker@nexbridge.comSep 22, 2022
  3. rsbecker@nexbridge.comSep 23, 2022
  4. rsbecker@nexbridge.comDec 14, 2022
  5. René ScharfeMay 22, 2023
  6. rsbecker@nexbridge.comMay 22, 2023
  7. rsbecker@nexbridge.comMay 22, 2023
  8. René ScharfeJun 4, 2023
  9. René ScharfeJun 4, 2023
  10. Junio C HamanoJun 6, 2023
  11. 1/2 t1800: loosen matching of error message for bad shebangRené Scharfe, Jun 10, 2023
  12. Junio C HamanoJun 12, 2023
  13. 2/2 run-command: report exec error even on ENOENTRené Scharfe, Jun 10, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.