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

Re: [PATCH] tests: avoid syntax triggering old dash bug

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 28, 2018, 04:45 UTC
Message-ID
<xmqqo9a9stbs.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cS-_m8RBsCME_Gj15EEs1tcFcGn0Acfvq4HgxKiL9PaHg@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 16 quoted lines
> On Tue, Nov 27, 2018 at 11:43 AM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> Avoid a bug in dash that's been fixed ever since its
>> ec2c84d ("[PARSER] Fix clobbering of checkkwd", 2011-03-15)[1] first
>> released with dash v0.5.7 in July 2011.
>
> Perhaps enhance the commit message to explain the nature of the bug
> itself. It is not at all obvious from reading the above or from
> looking at the diff itself what the actual problem is that the patch
> is fixing. (And it wasn't even immediately obvious by looking at the
> commit message of ec2c84d in the dash repository.) To help readers of
> this patch avoid re-introducing this problem or diagnose such a
> failure, it might be a good idea to give an example of the syntax
> which trips up old dash (i.e. a here-doc followed immediately by a
> {...} expression) and the actual error message 'Syntax error: "}"
> unexpected'.

Indeed. From the patch text, I would not have even guessed. I was wondering if there were interactions with "" and $() inside it.

If having {...} immediately after a here-doc is a problem, then the patch should not touch existing code at all, but instead insert a new line, perhaps like

	: avoid open brace immediately after here-doc for old dash
immediately before {...}; that would have made it easier to grok.
Show 11 quoted lines
>@@ -892,8 +892,9 @@ test_expect_success 'get --expiry-date' '
> 	1510348087
> 	0
> 	EOF
>+	date_valid1=$(git config --expiry-date date.valid1) &&
> 	{
>-		echo "$rel_out $(git config --expiry-date date.valid1)"
>+		echo "$rel_out $date_valid1"
> 		git config --expiry-date date.valid2 &&
> 		git config --expiry-date date.valid3 &&
> 		git config --expiry-date date.valid4 &&
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 4 of 10 in “tests: avoid syntax triggering old dash bug”
  1. tests: avoid syntax triggering old dash bugÆvar Arnfjörð Bjarmason, Nov 27, 2018
  2. Eric SunshineNov 27, 2018
  3. Ævar Arnfjörð BjarmasonNov 27, 2018
  4. Junio C HamanoNov 28, 2018
  5. tests: avoid syntax triggering old dash bugÆvar Arnfjörð Bjarmason, Feb 13, 2019
  6. Junio C HamanoFeb 13, 2019
  7. SZEDER GáborFeb 13, 2019
  8. Ævar Arnfjörð BjarmasonFeb 14, 2019
  9. brian m. carlsonNov 28, 2018
  10. Torsten BögershausenNov 28, 2018

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.