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
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
Date
May 22, 2023, 20:49 UTC
Message-ID
<013501d98cee$e58dc980$b0a95c80$@nexbridge.com>
In-Reply-To
<2e3be2e9-191d-fbfd-54c6-a3958e35637c@web.de>
On Monday, May 22, 2023 4:39 PM, René Scharfe wrote:
Show 50 quoted lines
>Am 14.12.22 um 06:53 schrieb rsbecker@nexbridge.com:
>> On September 23, 2022 4:43 PM, I wrote:
>>> On September 22, 2022 3:03 PM, I wrote:
>>>> On September 22, 2022 3:02 PM, I wrote:
>>>>> Rc1 is looking good except for this test.
>>>>>
>>>>> We get a diff as follows:
>>>>>
>>>>> -fatal: cannot run bad-hooks/test-hook: ...
>>>>> +fatal: cannot exec 'bad-hooks/test-hook': Permission denied
>>>>>
>>>>> It looks like the pattern
>>>>> sed -e s/test-hook: .*/test-hook: .../
>>>>>
>>>>> needs to be a bit extended. Adding
>>>>>
>>>>> sed -e s/exec/run/ | send -e s/["']//g
>>>>>
>>>>> might help clear off the other noise.
>>>
>>> A patch that might work is as follows:
>>>
>>> diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh index
>>> 43fcb7c0bf..9a723631a2
>>> 100755
>>> --- a/t/t1800-hook.sh
>>> +++ b/t/t1800-hook.sh
>>> @@ -173,7 +173,10 @@ test_expect_success 'git hook run a hook with a
>>> bad shebang' '
>>>                -c core.hooksPath=bad-hooks \
>>>                hook run test-hook >out 2>err &&
>>>        test_must_be_empty out &&
>>> -       sed -e "s/test-hook: .*/test-hook: .../" <err >actual &&
>>> +       quot=`echo "\047"` &&
>>> +       sed -e "s/exec/run/" <err | \
>>> +               sed -e "s/$quot//g" | \
>>> +               sed -e "s/test-hook: .*/test-hook: .../" >actual &&
>>>        test_cmp expect actual
>>> '
>>>
>>> This does not require setting up a prerequisite for NonStop and the
>> technique
>>> might make the MING code easier but adding a change from spawn to run.
>>
>> This is still broken on NonStop. Is there any hope of a resolution?
>
>So trying to execute an executable file consisting only of the line
>"#!/bad/path/no/spaces" causes NonStop to report "Permission denied"?
>That message text belongs to error code EACCES, not to EPERM ("Operation not
>permitted"), right?
That should be correct, although the OS Devs I spoke to about this said "EPERM". I am experimenting.
>POSIX allows execve to return EACCES if the file to execute is not a regular file and
>executing that file type is not supported or if permissions are missing to one of its
>path components.
Part of the OS Dev's response was that POSIX is actually ambiguous on this point. Linux made the decision to use ENOENT. NonStop decided to use EPERM (although it may actually be EACCESS - I will report back.
Show 20 quoted lines
>Either you have something called /bad that is not a regular file (e.g. a
>directory) -- then it's just a matter of changing the test to use a different supposedly
>non-existing filename, perhaps by creating and deleting a temporary file for just that
>purpose.
>
>Or NonStop correctly returns ENOEXEC on the first execve(2) call in run-command.c
>and returns ENOACCES on the fallback with SHELL_PATH (default value
>/usr/coreutils/bin/bash), because you are not allowed to execute that shell.  Then
>SHELL_PATH needs to be corrected.
>
>Or valid shells need to be placed in some kind of allow list to be accepted in #!-lines,
>lest NonStop returns ENOACCES on them.  Or NonStop is simply reporting a bogus
>error code for some reason.  In those cases you probably need an execve) compat/
>wrapper that corrects the error code.
>
>Or I'm missing something here, which is a relatively safe bet.  Anyway, depending on
>the cause of the "Permission denied" message, loosening the textual comparison in
>the test might not be enough.  There may not be a point for end users to distinguish
>between "exec" vs. "run", but the silent_exec_failure feature of run-command
>depends on the error code being ENOENT.

I will report my debug findings. --Randall

Previous: René ScharfeNext: rsbecker@nexbridge.com
Message 6 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.