Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] ${ command; } bash/ksh compatibility
- X-seq: zsh-workers 52482
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] ${ command; } bash/ksh compatibility
- Date: Mon, 15 Jan 2024 10:14:30 -0800
- Archived-at: <https://zsh.org/workers/52482>
- List-id: <zsh-workers.zsh.org>
I worry a little about being handed a 100GB file containing nothing
but newlines.
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));
Messages sorted by:
Reverse Date,
Date,
Thread,
Author