Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: print -v with multibyte characters



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.








Messages sorted by: Reverse Date, Date, Thread, Author