Thread (5 messages) 5 messages, 3 authors, 2019-12-26

Re: [PATCH 2/2] t/check-non-portable-shell: detect "FOO= shell_func", too

From: Eric Sunshine <hidden>
Date: 2019-12-26 20:39:45

Possibly related (same subject, not in this thread)

On Thu, Dec 26, 2019 at 2:57 PM Jonathan Nieder [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help