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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 04.06.23 um 14:13 schrieb René Scharfe:
> Am 22.05.23 um 23:13 schrieb rsbecker@xxxxxxxxxxxxx:
>> 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é




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux