* [PATCH] ${ command; } bash/ksh compatibility
@ 2024-01-15 18:14 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2024-01-15 18:14 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 82 bytes --]
I worry a little about being handed a 100GB file containing nothing
but newlines.
[-- Attachment #2: nozsh-nofork.txt --]
[-- Type: text/plain, Size: 591 bytes --]
diff --git a/Src/subst.c b/Src/subst.c
index 3a1187350..650c09de2 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2005,6 +2005,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
int onoerrs = noerrs, rplylen;
noerrs = 2;
rplylen = zstuff(&cmdarg, rplytmp);
+ if (! EMULATION(EMULATE_ZSH)) {
+ /* bash and ksh strip trailing newlines here */
+ while (rplylen > 0 && cmdarg[rplylen-1] == '\n')
+ rplylen--;
+ cmdarg[rplylen] = 0;
+ }
noerrs = onoerrs;
if (rplylen >= 0)
setsparam("REPLY", metafy(cmdarg, rplylen, META_REALLOC));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-15 18:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 18:14 [PATCH] ${ command; } bash/ksh compatibility 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).