From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: print -v with multibyte characters
Date: Fri, 7 Aug 2020 19:10:02 +0900 [thread overview]
Message-ID: <F686C9D5-2D78-48D5-8C37-EFE180E8E823@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAHYJk3QdBLs5_RvBXtzkhwaK3zPpgsLGgscM-DgpfHoizfPWWw@mail.gmail.com>
In the case of 'print -v var', args[] are RE-metafied at line 4871
(builtin.c), but the length len[] is not updated.
At line 4959,
fwrite(*args, *len, 1, fout);
this metafied args[] are written to buf with the wrong length len[].
I think args[] should not have been RE-metafied at line 4871, because
without '-v var' args[] are no metafied at this fwrite().
We need to metafy buf for setsparam(), as the current code wrongly
does at line 4981.
diff --git a/Src/builtin.c b/Src/builtin.c
index ff84ce936..09eb3728c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4862,7 +4862,7 @@ bin_print(char *name, char **args, Options ops, int func)
/* normal output */
if (!fmt) {
- if (OPT_ISSET(ops, 'z') || OPT_ISSET(ops, 'v') ||
+ if (OPT_ISSET(ops, 'z') ||
OPT_ISSET(ops, 's') || OPT_ISSET(ops, 'S')) {
/*
* We don't want the arguments unmetafied after all.
next prev parent reply other threads:[~2020-08-07 10:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 19:03 zsugabubus
2020-02-20 22:58 ` Mikael Magnusson
2020-08-05 16:13 ` Mikael Magnusson
2020-08-06 6:51 ` Daniel Shahaf
2020-08-07 10:10 ` Jun T [this message]
2020-08-07 22:29 ` PATCH: Test for print -v fix Mikael Magnusson
2020-08-11 4:34 ` Jun T
2020-08-12 9:45 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F686C9D5-2D78-48D5-8C37-EFE180E8E823@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).