From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] nofork substitution bugfixes revealed by tests
Date: Sun, 23 Jul 2023 14:21:24 -0700 [thread overview]
Message-ID: <CAH+w=7bN38s0K5OLz32xQCHxGSwq=CfE1SJbHJK8QQsWawDGhg@mail.gmail.com> (raw)
[-- 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 */
}
/*
next reply other threads:[~2023-07-23 21:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-23 21:21 Bart Schaefer [this message]
2023-07-24 1:09 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7bN38s0K5OLz32xQCHxGSwq=CfE1SJbHJK8QQsWawDGhg@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).