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=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32611 invoked from network); 31 Aug 2023 17:38:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Aug 2023 17:38:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1693503531; b=kB5YF1DY/etLqgLHNATVD62VJBofdN/IFAHHEsbCgBH8URCvRoHwmGrADgSJuLRpQXuB009yKA MoxggjwMo7ymWosfgz9uTvTBBQ0fFhPi/WBogGo8HKQIoeJ4PoqgiUYfmhkK8W9MnM0gRzoTZ/ bDc2gbrZcj+QgOc919uUmZSTnYoabZdVdbuqljBAt39sCMgJ9CGdBzF41KcH0HL+ZiUApsLslK bn7XLtIgvDx8Qil53bqHcj3wMIjzQRujNb11ZXIVjyFkTt9ay9uA4SxRsrw3xYDsOqPKDRcMPM yAT+X7m36afBHJk/lrLyxy5yWyWctSCrN7sB8mkvlL67vA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.1; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1693503531; bh=XehHsp+9pdGHO8MyAD0q3FJSEfltpvsLaL+c4jL4LlI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=KEL9qjrnpte8EbQ5UPagA/Wy/L5qaxL3AfftaJvTeZbheRJpzX46u770ZNC38RHOZbnoCZga7x wY0tDWIsgQ/1isPwFphb92QngidecBQuQYwdv8Eu3UeUNgNJYpkjg7fp5coO8fcNMCgqQxk0t+ 0xHrza0JWOOLnxq2ETfO3SHF5+wMb4YsK4ui94bru9nUpEJDAHgzTSVXB+1+ITNR+26JXjuuDZ SfnIA8LPe//bcHCN7BYcY8KPBQ11GF7sQJdIupBB7uI6q9z4UR7ua1H4lEPa1fQ5I+TeZHdpAq SYmrIOLfPM9KLxqmgCefo6XK4NI5pBctWyxk/k4yihgtKw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender: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=p1DC7LxbTaQALECpV2Suoe4tmcpa4ZwUFxPMX8SCvcY=; b=pBHdOIrfCd9mAh+ER8ZZ20Q4oU BdzXTPQbYhO66UNdczIMRJaAXG91xdF27AQo4E7t+L1FU3MjXl/rGdo15UiIHmvyRjvZV5eZanuY+ Ymc2lmh52yhv1x2a21TJrGVWILawdd0+EMSptx0icFpBoJwaMFqVNEq8dsemiDtFMGJb1TYZZ8b8X IV3B8lW2hvvdUSHeJoZ4182JwDG/DM/K35JndR7bAz02vyYbufASNuDKaRMvAyOFqRR2oTGQ5MAml Gf04A+LSJEm6VoanaCH2hXtieXmGk94m7VrS4ms1ToZUArDt2XfrhN+UBsPSySmUeFnm38sgpkZNM kLDwNpMA==; Received: by zero.zsh.org with local id 1qbld3-0007HT-N8; Thu, 31 Aug 2023 17:38:49 +0000 Authentication-Results: zsh.org; iprev=pass (snd00001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.1; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00001-bg.im.kddi.ne.jp ([27.86.113.1]:49120 helo=dfmta0006.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qblci-0006yU-BY; Thu, 31 Aug 2023 17:38:31 +0000 Received: from mail.biglobe.ne.jp by omta0006.biglobe.ne.jp with ESMTP id <20230831173822323.PNUW.69570.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Fri, 1 Sep 2023 02:38:22 +0900 From: "Jun. T" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: (LC_ALL=C; set -x 128 129; printf "%s\n" ${(#)@} | hexdump -C) Date: Fri, 1 Sep 2023 02:38:21 +0900 References: <20230830072753.hhveg7teosubwzq7@chazelas.org> To: zsh-workers@zsh.org In-Reply-To: Message-Id: <88812889-04BC-412A-85BE-BDAA2326B29B@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3696.120.41.1.3) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 52111 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > 2023/08/31 4:45, Bart Schaefer wrote: > > Doc for (#) says: > > If the MULTIBYTE option is set and the number is greater than 127 > (i.e. not an ASCII character) it is treated as a Unicode > character. It seems that this translation succeeds only if UTF-8 locale is in use. The translation is done in function substevalchar(), but in C locale it fails to convert and fallbacks to 'no translation': $ LC_ALL=C zsh -f % n=128 % printf "%s\n" ${(#)n} | hexdump -C 00000000 80 0a |..| 00000002 substevalchar() calls getkeystring() for the conversion, and wctomb() (utils.c:6983) fails (returns -1), and zerr() sets errflag. If we use an array instead of sclar: % a=( 128 129 ) % printf "%s\n" ${(#)a} | hexdump -C 00000000 22 0a 22 |"."| 00000003 In this case, errflag is set when translating a[0]=128, but it is not reset and still set to 1 when substevalchar() is called for a[1]. Then substevalchar() immediately returns NULL (subst.c:1496). Now paramsubst() sets haserr=1 (subst.c:3592) and returns NULL at line 3609 (although errflag is reset at line 3606), and stringsubst() also returns NULL (line 327), and prefork() quits at line 146 (probably before removing " " from t"%s\n"). So we need to reset (or save/restore) errflag somewhere... And, with multibyte option on but with C locale, what is the correct behavior of ${(#)n} for n > 127 ?