From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Eric Sunshine" <sunshine@sunshineco.com>,
hsed@unimetic.com, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2] tests: avoid syntax triggering old dash bug
Date: Wed, 13 Feb 2019 12:59:51 +0100 [thread overview]
Message-ID: <20190213115951.12096-1-avarab@gmail.com> (raw)
In-Reply-To: <xmqqo9a9stbs.fsf@gitster-ct.c.googlers.com>
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. This failing test was
introduced in 5f9674243d ("config: add --expiry-date", 2017-11-18).
This fixes 1/2 tests failing on Debian Lenny & Squeeze. The other
failure is due to 1b42f45255 ("git-svn: apply "svn.pathnameencoding"
before URL encoding", 2016-02-09).
The dash bug is triggered by this test because the heredoc contains a
command embedded in "$()" with a "{}" block coming right after
it. Refactoring the "$()" to e.g. be a variable that was set earlier
will also work around it, but let's instead break up the "EOF" and the
"{}".
An earlier version of this patch[2] mitigated the issue by breaking
the "$()" out of the "{}" block, that worked, but just because it
broke up the "EOF" and "{}" block. Putting e.g. "echo &&" between the
two would also work.
1. https://git.kernel.org/pub/scm/utils/dash/dash.git/
2. https://public-inbox.org/git/20181127164253.9832-1-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
On Wed, Nov 28 2018, Junio C Hamano wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
>> 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
Late re-roll. Now using a variant of that suggestion, and with an
updated commit message explaining what the issue in dash is exactly
and why it was triggered.
This isn't a 2.21 regression, but sending it in the rc window anyway
in case you'd like to queue an obviously working minor portability
fix.
t/t1300-config.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 9652b241c7..428177c390 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -892,6 +892,7 @@ test_expect_success 'get --expiry-date' '
1510348087
0
EOF
+ : "work around heredoc parsing bug fixed in dash 0.5.7 (in ec2c84d)" &&
{
echo "$rel_out $(git config --expiry-date date.valid1)"
git config --expiry-date date.valid2 &&
--
2.20.1.611.gfbb209baf1
next prev parent reply other threads:[~2019-02-13 12:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 16:42 [PATCH] tests: avoid syntax triggering old dash bug Ævar Arnfjörð Bjarmason
2018-11-27 19:16 ` Eric Sunshine
2018-11-27 19:37 ` Ævar Arnfjörð Bjarmason
2018-11-28 4:45 ` Junio C Hamano
2019-02-13 11:59 ` Ævar Arnfjörð Bjarmason [this message]
2019-02-13 21:43 ` [PATCH v2] " Junio C Hamano
2019-02-13 21:48 ` SZEDER Gábor
2019-02-14 9:51 ` Ævar Arnfjörð Bjarmason
2018-11-28 1:47 ` [PATCH] " brian m. carlson
2018-11-28 7:06 ` Torsten Bögershausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190213115951.12096-1-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hsed@unimetic.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).