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.