Re: [PATCH] CodingGuidelines: quote assigned value with "local" and "export"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 5, 2024, 23:15 UTC
- Message-ID
- <xmqq4jcftn82.fsf@gitster.g>
- In-Reply-To
- <xmqqr0fjtxei.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
>> 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/201307081121.22769.tboegi@web.de/
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.