Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: rsbecker@nexbridge.com, git@vger.kernel.org
Subject: Re: [BUG] Git 2.38.0-rc1 t1800 message text comparison
Date: Sun, 4 Jun 2023 22:55:54 +0200	[thread overview]
Message-ID: <28d808e4-77b4-d91e-8a86-c21287019b56@web.de> (raw)
In-Reply-To: <f5519f93-bca7-ecbc-9da3-b25ce8aef618@web.de>

Am 04.06.23 um 14:13 schrieb René Scharfe:
> 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é

  reply	other threads:[~2023-06-04 20:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 19:01 [BUG] Git 2.28.0-rc1 t1800 message text comparison rsbecker
2022-09-22 19:02 ` [BUG] Git 2.38.0-rc1 " rsbecker
2022-09-23 20:43 ` rsbecker
2022-12-14  5:53   ` rsbecker
2023-05-22 20:39     ` René Scharfe
2023-05-22 20:49       ` rsbecker
2023-05-22 21:13         ` rsbecker
2023-06-04 12:13           ` René Scharfe
2023-06-04 20:55             ` René Scharfe [this message]
2023-06-06  0:31               ` Junio C Hamano
2023-06-10 14:51                 ` [PATCH 1/2] t1800: loosen matching of error message for bad shebang René Scharfe
2023-06-12 18:01                   ` Junio C Hamano
2023-06-10 14:51                 ` [PATCH 2/2] run-command: report exec error even on ENOENT René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28d808e4-77b4-d91e-8a86-c21287019b56@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).