From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25932 invoked from network); 7 Aug 2020 10:10:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Aug 2020 10:10:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=Sender:List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Message-Id:In-Reply-To:To:References:Date: Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=dCtJB8+wW+jbysy23jVItvWfRLIdGFV+QZp6AAifZmU=; b=L2x+V9s8e1qfe7FjT07kl4G6YJ heMZ/yH14KNuXG1MPOh8jmHIAgXISSW8QgOk4Ok38VWDTRHZmwA+7Qm0/hJJXdiAMyAR3rYKWqPvl +uN5VLys10VcZ/V3CPmtOkBzE4EX6if/2C6PVZFf5PlYsSKVEccexctkg73Z+E8YyEmdtdEyItG2O S56iQQHcJfA3tibRYTIFbAqmlefou+63ePnfpjUUVSRqh9tG2SrQZSzi3bVeqcEN2vIqTMzK6oLcy ZWEiQ5Ub9IOPHF/O8lLnGYkLm1+9dotfVZclbg1P9puxLEY6YGQCCAC8bGRbp6F26kDmKKVpW2rr0 w332+BOQ==; Received: from authenticated user by zero.zsh.org with local id 1k3zKX-000L1n-Oc; Fri, 07 Aug 2020 10:10:29 +0000 Authentication-Results: zsh.org; iprev=pass (rcpt-expgw.biglobe.ne.jp) smtp.remote-ip=2001:260:401:42e::3 Received: from rcpt-expgw.biglobe.ne.jp ([2001:260:401:42e::3]:43290) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1k3zKE-000KK2-7D; Fri, 07 Aug 2020 10:10:12 +0000 Received: from vc-gw.biglobe.ne.jp by rcpt-expgw.biglobe.ne.jp (hngd/4514161018) with ESMTP id 077AA3E5007254 for ; Fri, 7 Aug 2020 19:10:03 +0900 Received: from smtp-gw.biglobe.ne.jp ([192.168.154.156]) by vc-gw.biglobe.ne.jp (shby/1011270619) with ESMTP id 077AA3gC027311 for ; Fri, 7 Aug 2020 19:10:03 +0900 X-Biglobe-Sender: Received: from tamac1.yz.yamagata-u.ac.jp ([133.24.84.20]) by smtp-gw.biglobe.ne.jp id TKwqC0A89940; Fri, 07 Aug 2020 19:10:03 +0900 (JST) From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: print -v with multibyte characters Date: Fri, 7 Aug 2020 19:10:02 +0900 References: <20200220190310.tms2xcwk3sjmqb76@localhost> To: zsh-workers@zsh.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.104.15) X-Biglobe-Spnum: 26329 X-Zsh-Org-Should-ARC-Sign: true X-Seq: 47301 X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Sender: Sympa Owner 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) =20 /* 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.