Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 1/2] Consolidated nofork substitution changes
- X-seq: zsh-workers 52171
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH 1/2] Consolidated nofork substitution changes
- Date: Fri, 22 Sep 2023 13:16:57 +0900
- Archived-at: <https://zsh.org/workers/52171>
- In-reply-to: <CAH+w=7avr_BmzxBSbjdhvtpngU3xaKV0yKBBge9nMOHjkGtgGg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7avr_BmzxBSbjdhvtpngU3xaKV0yKBBge9nMOHjkGtgGg@mail.gmail.com>
The substitution ${ cmd args} has a problem with multi-byte
characters.
$ LC_ALL=en_US.UTF-8 zsh -f
% echo -n à | od -t x1
0000000 c3 a0
0000002
% echo -n ${ echo -n à} | od -t x1
0000000 c3 5c
000000
Maybe the following?
(I will not push this by myself even if it's a correct fix.)
diff --git a/Src/subst.c b/Src/subst.c
index dc2052ee0..65ae44c3f 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2006,7 +2006,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
int onoerrs = noerrs;
noerrs = 2;
if ((cmdarg = ztuff(rplytmp)))
- setsparam("REPLY", cmdarg);
+ setsparam("REPLY", metafy(cmdarg, -1, META_HREALLOC));
noerrs = onoerrs;
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author