t6020: fix incompatible parameter expansion
commiteb87c6f559f0d7550a5f078a5b78159c290b0256
authorJiang Xin <worldhello.net@gmail.com>
Thu, 17 Jun 2021 03:14:11 +0000 (17 11:14 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jun 2021 05:09:43 +0000 (17 14:09 +0900)
tree3f2613d7c6625dde194619f1c3aae3c8a00ff3b6
parenta5828ae6b52137b913b978e16cd2334482eb4c1f
t6020: fix incompatible parameter expansion

Ævar reported that the function `make_user_friendly_and_stable_output()`
failed on a i386 box (gcc45) in the gcc farm boxes with error:

    sed: couldn't re-allocate memory

It turns out that older versions of bash (4.3) or dash (0.5.7) cannot
evaluate expression like `${A%${A#???????}}` used to get the leading 7
characters of variable A.

Replace the incompatible parameter expansion so that t6020 works on
older version of bash or dash.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6020-bundle-misc.sh