From: Jeff King Date: Sun, 07 Apr 2024 01:43:44 GMT Subject: Re: [PATCH 6/6] t: teach lint that RHS of 'local VAR=VAL' needs to be quoted Message-ID: <20240407014344.GF1085004@coredump.intra.peff.net> In-Reply-To: <20240406000902.3082301-7-gitster@pobox.com> On Fri, Apr 05, 2024 at 05:09:02PM -0700, Junio C Hamano wrote: > Teach t/check-non-portable-shell.pl that right hand side of the > assignment done with "local VAR=VAL" need to be quoted. We > deliberately target only VAL that begins with $ so that we can catch > > - $variable_reference and positional parameter reference like $4 > - $(command substitution) > - ${variable_reference-with_magic} > > while excluding > > - $'\n' that is a bash-ism freely usable in t990[23] > - $(( arithmetic )) whose result should be $IFS safe. > - $? that also is $IFS safe Hmm. Just porting over my comment from the other thread (before I realized you'd written this series), this misses: local foo=bar/$1 etc. Should we look for the "$" anywhere on the line? I doubt we can get things foolproof, but requiring somebody to quote: local foo=$((1+2)) does not seem like the worst outcome. I dunno. -Peff