Subject: Re: [PATCH] CodingGuidelines: quote assigned value with "local" and "export"

From: Junio C Hamano <[email-masked]>
Date: Fri, 05 Apr 2024 16:15:57 -0700

Junio C Hamano <[email-masked]> writes:

>> I think that is a good rule for "local", but I thought we did not allow
>> "export foo=bar" at all, and required:
>>
>>   foo=bar
>>   export foo
>>
>> If that was only because of this bug, it would be nice to loosen the
>> rules a bit.
>
> That rule in Documentation/CodingGuidelines predates the discovery
> of this bug.  I have this vague feeling that it was for the shell on
> old Solaris, which would not matter to us anymore, but I do not
> remember.

Heh, I do not even see any such rule in the guidelines.  What
enforces it is actually in t/check-non-portable-shell.pl script.  It
came from 9968ffff (test-lint: detect 'export FOO=bar', 2013-07-08),
which in turn comes from https://lore.kernel.org/git/[email-masked]/

We make multiple uses of it in ci/*.sh but the environments ci/
scripts are used in are rather sterile, so they do not quite count
as a proof that the problematic shells no longer exist.

We may instead want to add a separate rule e.g.,

	/\blocal\s+[a-zA-z0-9_]*=\$/ and err q(quote "$val" in 'local var=$val');

to the check script.