* [PATCH] nofork substitution bugfixes revealed by tests
@ 2023-07-23 21:21 Bart Schaefer
2023-07-24 1:09 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2023-07-23 21:21 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 93 bytes --]
This follows up to workers/51957 -- actual test file will be attached
to subsequent message.
[-- Attachment #2: nofork-tested.txt --]
[-- Type: text/plain, Size: 1018 bytes --]
diff --git b/Src/lex.c a/Src/lex.c
index 73d94264e..65d92cfac 100644
--- b/Src/lex.c
+++ a/Src/lex.c
@@ -1552,7 +1552,8 @@ dquote_parse(char endchar, int sub)
cmdpop();
cmdsubst = 0;
}
- cmdpop();
+ if (cmdsubst == 0)
+ cmdpop();
break;
case '`':
c = Qtick;
diff --git b/Src/subst.c a/Src/subst.c
index 92a53d99a..0fcc60020 100644
--- b/Src/subst.c
+++ a/Src/subst.c
@@ -1955,9 +1955,15 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
}
if (rplyvar && cmdarg && *cmdarg) {
+ int obreaks = breaks;
/* Execute the shell command */
untokenize(cmdarg);
execstring(cmdarg, 1, 0, "cmdsubst");
+ /* "return" behaves as if in a function */
+ if (retflag) {
+ retflag = 0;
+ breaks = obreaks;
+ }
}
if (rplyvar) {
@@ -1984,7 +1990,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
} else
_exit(exit_val);
}
- retflag = 0; /* "return" behaves as if in a function */
}
/*
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nofork substitution bugfixes revealed by tests
2023-07-23 21:21 [PATCH] nofork substitution bugfixes revealed by tests Bart Schaefer
@ 2023-07-24 1:09 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2023-07-24 1:09 UTC (permalink / raw)
To: Zsh hackers list
On Sun, Jul 23, 2023 at 2:21 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> This follows up to workers/51957 -- actual test file will be attached
> to subsequent message.
Of course, right after sending this I thought of another test I should
include -- and it revealed another bug. So, tests and another patch
to eventually follow.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-24 1:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-23 21:21 [PATCH] nofork substitution bugfixes revealed by tests Bart Schaefer
2023-07-24 1:09 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).