Re: [PATCH 2/2] t/check-non-portable-shell: detect "FOO= shell_func", too
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 26, 2019, 20:39 UTC
- Message-ID
- <CAPig+cTPQROOvXVPxL2bv0FT1FZs+XcWq6rHkhRE8vsTQJsHCA@mail.gmail.com>
- In-Reply-To
- <20191226195747.GC170890@google.com>
On Thu, Dec 26, 2019 at 2:57 PM Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Just like assigning a nonempty value, assigning an empty value to a
> shell variable when calling a function produces non-portable behavior:
> in some shells, the assignment lasts for the duration of the function
> invocation, and in others, it persists after the function returns.
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
> @@ -46,7 +46,7 @@ sub err {
> - /^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
> + /^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
> err '"FOO=bar shell_func" assignment extends beyond "shell_func"';Thanks, the change makes sense. I suspect that I simply overlooked this case when implementing this.
Acked-by: me