diff options
author | Bart Schaefer <schaefer@zsh.org> | 2024-01-24 17:56:21 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2024-01-24 17:56:21 -0800 |
commit | b3e763cc228b182019c22a3490312f7b17df4029 (patch) | |
tree | b0315a4630780b167c83a78f69fceb0a4560579e | |
parent | 0fccdf0d57fb8ed4b88df6681d15822f3c4e784f (diff) | |
download | zsh-b3e763cc228b182019c22a3490312f7b17df4029.tar.gz zsh-b3e763cc228b182019c22a3490312f7b17df4029.tar.xz zsh-b3e763cc228b182019c22a3490312f7b17df4029.zip |
52482: strip trailing newlines in emulation modes of ${ command; }
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Src/subst.c | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index d51d527b8..d46ce5fe5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2024-01-24 Bart Schaefer <schaefer@zsh.org> + * 52482: Src/subst.c: strip trailing newlines in emulation modes + of ${ command; }, for bash/ksh compatibility + * 52476 + cf. 52479: Etc/FAQ.yo: more about nofork substitution * 52477: Src/Modules/curses.c: fix "zcurses mouse delay ..." 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)); |