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

Re: [PATCH v2 0/3] diff: build parseopts array on demand

From
René Scharfe <l.s.r@web.de>
Date
Dec 1, 2022, 19:43 UTC
Message-ID
<3d9ccbda-201b-fdaf-5fa3-224ba10b8c40@web.de>
In-Reply-To
<CAPig+cTdSNfWwN-c7R3-MF6ipAD6-7aVjxRK9f9XaKzg4yhhyg@mail.gmail.com>
Am 01.12.2022 um 20:19 schrieb Eric Sunshine:
Show 21 quoted lines
> On Thu, Dec 1, 2022 at 2:11 PM René Scharfe <l.s.r@web.de> wrote:
>> t4205-log-pretty-formats.sh                      (Wstat: 256 Tests: 21 Failed: 0)
>>   Non-zero exit status: 1
>>   Parse errors: No plan found in TAP output
>>
>> The TAP error in t4205-log-pretty-formats.sh is fixed by the following
>> patch, but I can't explain it:
>>
>> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
>> @@ -156,7 +156,7 @@ test_expect_success 'NUL termination with --reflog --pretty=oneline' '
>>         for r in $revs
>>         do
>>                 git show -s --pretty=oneline "$r" >raw &&
>> -               cat raw | lf_to_nul || exit 1
>> +               cat raw | lf_to_nul || return 1
>>         done >expect &&
>
> Makes sense. The `exit 1` undesirably causes the entire script to
> abort, which means test_done() is never invoked, whereas `return 1`
> makes only the test fail. `exit 1` would be appropriate inside a
> subshell but there is no subshell here.
Right.  Here's how I got confused:

What's failing? "cat raw" works in the trash directory. lf_to_nul is not found. Of course, it's defined in test-lib-functions.sh. So source that. Then "cat raw | lf_to_nul" can be started and fails as expected. And it reports: "-bash: 4: Bad file descriptor". What?!

lf_to_nul calls perl, and test-lib-functions.sh defines "perl" as a function that redirects to &4. Which is not open in my shell.

But the confusion was at the beginning: Of course it's "git show" that's failing and triggering the exit from the test, not cat or lf_to_nul. Didn't even get to that point because I somehow thought the redirection magic was somehow broken.

So the lesson is to start searching at the beginning, I guess..
René
Previous: Eric SunshineNext: Ævar Arnfjörð Bjarmason
Message 18 of 23 in “diff: build parseopts array on demand”
  1. 0/3 diff: build parseopts array on demandRené Scharfe, Nov 30, 2022
  2. 1/3 diff: factor out add_diff_options()René Scharfe, Nov 30, 2022
  3. ZheNing HuDec 1, 2022
  4. 2/3 diff: let prep_parse_options() return parseopt arrayRené Scharfe, Nov 30, 2022
  5. 3/3 diff: remove parseopts member of struct diff_optionsRené Scharfe, Nov 30, 2022
  6. Junio C HamanoDec 1, 2022
  7. René ScharfeDec 1, 2022
  8. Junio C HamanoDec 1, 2022
  9. René ScharfeDec 1, 2022
  10. Junio C HamanoDec 1, 2022
  11. 0/3 diff: build parseopts array on demandRené Scharfe, Dec 1, 2022
  12. 1/3 diff: factor out add_diff_options()René Scharfe, Dec 1, 2022
  13. 2/3 diff: let prep_parse_options() return parseopt arrayRené Scharfe, Dec 1, 2022
  14. 3/3 diff: remove parseopts member from struct diff_optionsRené Scharfe, Dec 1, 2022
  15. Ævar Arnfjörð BjarmasonDec 1, 2022
  16. René ScharfeDec 1, 2022
  17. Eric SunshineDec 1, 2022
  18. René ScharfeDec 1, 2022
  19. Ævar Arnfjörð BjarmasonDec 1, 2022
  20. 0/3 diff: build parseopts array on demandRené Scharfe, Dec 1, 2022
  21. 1/3 diff: factor out add_diff_options()René Scharfe, Dec 1, 2022
  22. 2/3 diff: use add_diff_options() in diff_opt_parse()René Scharfe, Dec 1, 2022
  23. 3/3 diff: remove parseopts member from struct diff_optionsRené Scharfe, Dec 1, 2022

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.