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

Re: [PATCH 1/3] t4216: avoid unnecessary subshell in test_bloom_filters_not_used

From
Junio C Hamano <gitster@pobox.com>
Date
May 20, 2020, 15:04 UTC
Message-ID
<xmqqr1vewsug.fsf@gitster.c.googlers.com>
In-Reply-To
<20200520034444.47932-2-carenas@gmail.com>
Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:
Show 6 quoted lines
> Seems to trigger a bug in at least OpenBSD's 6.7 sh where it is
> interpreted as a history lookup and therefore fails 125-126, 128,
> 130.
>
> Remove the subshell and get a space between ! and grep, so tests
> pass successfully.

It's strange that somebody thinks of doing history lookup in non-interactive use.

But even more curious is why we have this in a subshell in the first place. I do not see a reason why we need subshell, nor use of the double-quote in the outer layer that forces us to use backslashes.

Show 5 quoted lines
>  test_bloom_filters_not_used () {
>  	log_args=$1
>  	setup "$log_args" &&
> -	!(grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf") &&
> +	! grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf" &&

This is obviously the minimum fix, so I'm willing to take the change as-is, but if we were writing it today, perhaps

	! grep 'statistics:{"filter_not_present":' "$TRASH_DIRECTORY/trace.perf" &&

is how we write it. I do not see any reason why we want to use the "-q" option either.

Previous: Carlo Marcelo Arenas BelónNext: Carlo Marcelo Arenas Belón
Message 3 of 11 in “openbsd: fixes for 2.27.0-RC0”
  1. 0/3 openbsd: fixes for 2.27.0-RC0Carlo Marcelo Arenas Belón, May 20, 2020
  2. 1/3 t4216: avoid unnecessary subshell in test_bloom_filters_not_usedCarlo Marcelo Arenas Belón, May 20, 2020
  3. Junio C HamanoMay 20, 2020
  4. 2/3 bisect: remove CR characters from revision in replayCarlo Marcelo Arenas Belón, May 20, 2020
  5. Junio C HamanoMay 20, 2020
  6. Carlo Marcelo Arenas BelónMay 20, 2020
  7. Junio C HamanoMay 20, 2020
  8. Christopher Warrington (CHRISTOPHER)May 20, 2020
  9. Junio C HamanoMay 20, 2020
  10. 3/3 t5520: avoid alternation in grep's BRE (not POSIX)Carlo Marcelo Arenas Belón, May 20, 2020
  11. Junio C HamanoMay 20, 2020

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.