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

Re: [PATCH] tests: make 'test_oid' print trailing newline

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 19, 2022, 00:48 UTC
Message-ID
<xmqqy1r4usjy.fsf@gitster.g>
In-Reply-To
<20221218162905.3508164-1-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> Unlike other test helper functions, 'test_oid' doesn't terminate its
> output with a LF, but, alas, the reason for this, if any, is not
> mentioned in 2c02b110da (t: add test functions to translate
> hash-related values, 2018-09-13)).

I (obviously) agree with the analysis in the proposed log message. Having to touch the sanity checking tests in 0-basic is a bit annoying, but having to do an artificial echo is even more annoying, so these changes may probably be a net win, I would say.

Having said that.
>       $ git grep '\stest_oid ' -- ':/t/*.sh'
>       $ git grep 'echo "\?$(test_oid ' -- ':/t/*.sh'

I found these examples in the log message a bit annoying to see, as both invite an undefined behaviour by having an ordinary character ('s' or '?') preceded by an unescaped backslash in a POSIXly correct implementation of BRE. GNU libc seems to be OK with it (I double checked by adding "-G" on the command line to make sure my experiments are not affected by any grep.patterntype), but they may fail for folks on stricter platforms.

Thanks.  Will queue.
Previous: SZEDER GáborNext: SZEDER Gábor
Message 2 of 7 in “tests: make 'test_oid' print trailing newline”
  1. tests: make 'test_oid' print trailing newlineSZEDER Gábor, Dec 18, 2022
  2. Junio C HamanoDec 19, 2022
  3. SZEDER GáborDec 22, 2022
  4. Junio C HamanoDec 23, 2022
  5. brian m. carlsonDec 19, 2022
  6. Ævar Arnfjörð BjarmasonDec 19, 2022
  7. Junio C HamanoDec 19, 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.