Message ID | Y7eSaxWkgoiFl8Lx@gondor.apana.org.au (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | parser: Print CTLBACKQ early in parsesub | expand |
Hi! On Fri, Jan 06, 2023 at 11:15:55AM +0800, Herbert Xu wrote: > On Thu, Jan 05, 2023 at 02:42:04PM +0100, наб wrote: > > I think this means we also need to turn the USTPUTC() into STPUTC(), > > since the previous code explicitly over-accounted for it in growstackto(). > Good catch. However, we can easily get rid of it by moving the > USTPUTC to the top: Yep, patch works for me and appears sound; that's the first USTPUTC() for the new path and the second for the old path. наб
diff --git a/src/parser.c b/src/parser.c index f5f76d5..299c260 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1360,6 +1360,7 @@ parsebackq: { struct heredoc *saveheredoclist; int uninitialized_var(saveprompt); + USTPUTC(CTLBACKQ, out); str = stackblock(); savelen = out - (char *)stackblock(); grabstackblock(savelen); @@ -1443,7 +1444,6 @@ done: if (oldstyle) tokpushback = 0; out = stnputs(str, savelen, stackblock()); - STPUTC(CTLBACKQ, out); if (oldstyle) goto parsebackq_oldreturn; else