diff mbox series

[v2,11/12] t0610: fix non-portable variable assignment

Message ID cedf5929d1ea989cbf87bad48e35c0d191b624c3.1712555682.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series t: exercise Git/JGit reftable compatibility | expand

Commit Message

Patrick Steinhardt April 8, 2024, 6:47 a.m. UTC
Older versions of the Dash shell fail to parse `local var=val`
assignments in some cases when `val` is unquoted. Such failures can be
observed e.g. with Ubuntu 20.04 and older, which has a Dash version that
still has this bug.

Such an assignment has been introduced in t0610. The issue wasn't
detected for a while because this test used to only run when the
GIT_TEST_DEFAULT_REF_FORMAT environment variable was set to "refatble".
We have dropped that requirement now though, meaning that it runs
unconditionally, inclluding on jobs which use such older versions of
Ubuntu.

We have worked around such issues in the past, e.g. in ebee5580ca
(parallel-checkout: avoid dash local bug in tests, 2021-06-06), by
quoting the `val` side. Apply the same fix to t0610.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t0610-reftable-basics.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Sunshine April 8, 2024, 6:57 a.m. UTC | #1
On Mon, Apr 8, 2024 at 2:47 AM Patrick Steinhardt <ps@pks.im> wrote:
> Older versions of the Dash shell fail to parse `local var=val`
> assignments in some cases when `val` is unquoted. Such failures can be
> observed e.g. with Ubuntu 20.04 and older, which has a Dash version that
> still has this bug.
>
> Such an assignment has been introduced in t0610. The issue wasn't
> detected for a while because this test used to only run when the
> GIT_TEST_DEFAULT_REF_FORMAT environment variable was set to "refatble".
> We have dropped that requirement now though, meaning that it runs
> unconditionally, inclluding on jobs which use such older versions of
> Ubuntu.

s/refatble/reftable/
s/inclluding/including/

> We have worked around such issues in the past, e.g. in ebee5580ca
> (parallel-checkout: avoid dash local bug in tests, 2021-06-06), by
> quoting the `val` side. Apply the same fix to t0610.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
Patrick Steinhardt April 8, 2024, 8:56 a.m. UTC | #2
On Mon, Apr 08, 2024 at 02:57:04AM -0400, Eric Sunshine wrote:
> On Mon, Apr 8, 2024 at 2:47 AM Patrick Steinhardt <ps@pks.im> wrote:
> > Older versions of the Dash shell fail to parse `local var=val`
> > assignments in some cases when `val` is unquoted. Such failures can be
> > observed e.g. with Ubuntu 20.04 and older, which has a Dash version that
> > still has this bug.
> >
> > Such an assignment has been introduced in t0610. The issue wasn't
> > detected for a while because this test used to only run when the
> > GIT_TEST_DEFAULT_REF_FORMAT environment variable was set to "refatble".
> > We have dropped that requirement now though, meaning that it runs
> > unconditionally, inclluding on jobs which use such older versions of
> > Ubuntu.
> 
> s/refatble/reftable/
> s/inclluding/including/

Thanks, fixed locally. I'll wait for more feedback before sending out a
new version.

Patrick

> > We have worked around such issues in the past, e.g. in ebee5580ca
> > (parallel-checkout: avoid dash local bug in tests, 2021-06-06), by
> > quoting the `val` side. Apply the same fix to t0610.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
diff mbox series

Patch

diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index aa9282007c..dfa7e274ea 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -78,9 +78,9 @@  test_expect_success 'init: reinitializing reftable with files backend fails' '
 '
 
 test_expect_perms () {
-	local perms="$1"
-	local file="$2"
-	local actual=$(ls -l "$file") &&
+	local perms="$1" &&
+	local file="$2" &&
+	local actual="$(ls -l "$file")" &&
 
 	case "$actual" in
 	$perms*)