Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Untokenize before quoting unquoted literal values
- X-seq: zsh-workers 54911
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: Untokenize before quoting unquoted literal values
- Date: Sun, 5 Jul 2026 03:13:29 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BqsAOK+AOpqux0zI7r+oOX1nS6abtNV/Ee+big15+9A=; fh=SbTlPuNNxBzTkRlwWtqw/TXBY0HvGvtE97RpPp3sJPM=; b=G5mgYN161XaBYojcRuv3mt9dnqB1jw6qNWqHG4n9CHRJQCJ4UFpG6V1IdDW2aKLi+g pjwpF8CN+njPBghbSifdwH/csrzdg8la/4hFZHZtJ7Tu3Ti+L/O0nMhC2fPhOPGMscRX 8fmEWGf1UUQD5b/VT4tWOLphZn0yJT2kkveAUdGlH7kNQ6FF16jeM4/nMKYqVA7NyErq XKghWtcPt9eNEmtsiwE8yOEB8Ym/CDUgiJFtLvS54qw+Qrhq8ob7ErwD+8hqWyyXwvFN U66ryofP8ol3hYc0HiKXbvfbMrgcna/dyCjB6aud6IcAFvbdNRuS2q6VcEfJYLATfqg8 SEBA==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1783214023; cv=none; d=google.com; s=arc-20260327; b=V1vM8vkPKD8lq+DHbk+ot4bgKUGVQhFd+abkXEhM7CC0FUg52hFyfV4CwsPImKIZBK bjwIywnbXjiv7G/2UC5SMvkEWQct+j+BkSrPI57l9O3yeyKBj+2BCYyagY4pMf7uxdjJ k1r8Gm/+IW66g/d8tDcoC5Bl/T8YtW73qbt3ljpL3MRRM+fsCY373smkVWLVuvCoZln9 8eTwS8lgld8AR1VYDlza0i9uzZHmnARNY/OJNcnVUuz7YZTU3u2TeZA/z0tozBYlwTj2 7vZbrOQ0AuPWgIa3pf5fDk7kboUzjnrNtBmEexkh5wUnDQmPkGWrl3UXCu36PHAbsLKL hbTw==
- Archived-at: <https://zsh.org/workers/54911>
- In-reply-to: <20260705011047.32077-2-mikachu@gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20260705011047.32077-1-mikachu@gmail.com> <20260705011047.32077-2-mikachu@gmail.com>
I accidentally wrote git send-email -1
0001-Untokenize-before-quoting-unquoted-literal-values.patch instead
of just the filename (muscle memory echo from the git format-patch
-1), sorry about that.
On Sun, Jul 5, 2026 at 3:10 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> % print -r - ${(q+):-foo = bar}|xxd
> 00000000: 2766 6f6f 208d 2062 6172 270a 'foo . bar'.
> % print -r - ${(q+):-foo * bar}|xxd
> 00000000: 2766 6f6f 2087 2062 6172 270a 'foo . bar'.
> % print -r - ${(qqqq):-foo = bar}
> $'foo \215 bar'
> ---
> Src/subst.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Src/subst.c b/Src/subst.c
> index 9e846afa5c..196a1cd8e1 100644
> --- a/Src/subst.c
> +++ b/Src/subst.c
> @@ -4090,13 +4090,16 @@ colonsubscript:
>
> if (quotemod > 0) {
> if (quotetype == QT_QUOTEDZPUTS) {
> - for (; *ap; ap++)
> + for (; *ap; ap++) {
> + untokenize(*ap);
> *ap = quotedzputs(*ap, NULL);
> + }
> } else if (quotetype > QT_BACKSLASH) {
> int sl;
> char *tmp;
>
> for (; *ap; ap++) {
> + untokenize(*ap);
> tmp = quotestring(*ap, quotetype);
> sl = strlen(tmp);
> *ap = (char *) zhalloc(pre + sl + post + 1);
> @@ -4136,10 +4139,12 @@ colonsubscript:
> val = dupstring(val), copied = 1;
> if (quotemod > 0) {
> if (quotetype == QT_QUOTEDZPUTS) {
> + untokenize(val);
> val = quotedzputs(val, NULL);
> } else if (quotetype > QT_BACKSLASH) {
> int sl;
> char *tmp;
> + untokenize(val);
> tmp = quotestring(val, quotetype);
> sl = strlen(tmp);
> val = (char *) zhalloc(pre + sl + post + 1);
> --
> 2.38.1
>
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author