]> Kevux Git Server - rit/commit
t: work around multibyte bug in quoted heredocs with Dash v0.5.13
authorPatrick Steinhardt <ps@pks.im>
Thu, 2 Apr 2026 06:51:18 +0000 (08:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Apr 2026 18:39:42 +0000 (11:39 -0700)
commit0c8424c259b417c6aadc23f5398e55edd7b047a2
tree4ac6377887b49a395f1aee238400d2f6088de944
parent67ad42147a7acc2af6074753ebd03d904476118f
t: work around multibyte bug in quoted heredocs with Dash v0.5.13

When executing our test suite with Dash v0.5.13.2 one can observe
several test failures that all have the same symptoms: we have a quoted
heredoc that contains multibyte characters, but the final data does not
match what we actually wanted to write. One such example is in t0300,
where we see the diffs like the following:

  --- expect-stdout 2026-04-01 07:25:45.249919440 +0000
  +++ stdout 2026-04-01 07:25:45.254919509 +0000
  @@ -1,5 +1,5 @@
   protocol=https
   host=example.com
  -path=perĂº.git
  +path=perĂº.git
   username=foo
   password=bar

While seemingly the same, the data that we've written via the heredoc
contains some invisible bytes. The expected hex representation of the
string is:

  7065 72c3 ba2e 6769 74                 per...git

But what we actually get instead is this string:

  7065 7285 02c3 ba02 852e 6769 74       per.......git

What's important to note here is that the multibyte character exists in
both versions. But in the broken version we see that the bytes are
wrapped in a sequence of "85 02" and "02 85". This is the CTLMBCHAR byte
sequence of Dash, which it uses internally to quote multibyte sequences.

As it turns out, this bug was introduced in c5bf970 (expand: Add
multi-byte support to pmatch, 2024-06-02), which adds multibyte support
to more contexts of Dash. One of these contexts seems to be in heredocs,
and Dash _does_ correctly unquote these multibyte sequences when using
an unquoted heredoc. But the bug seems to be that this unquoting does
not happen in quoted heredocs, and the bug still exists on the latest
"master" branch.

For now, work around the bug by using unquoted heredocs instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0300-credentials.sh
t/t3430-rebase-merges.sh
t/t3902-quoted.sh
t/t4014-format-patch.sh
t/t4201-shortlog.sh
t/t9001-send-email.sh