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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20334 invoked from network); 25 Apr 2021 11:08:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Apr 2021 11:08:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619348909; b=Am0QsfoguljbHgBJ/SEICnQdcFhl4kqAyPInd6roFQd/koC8bP9uUDbeQdNnfcqGuUCQu5SEN5 rDXwi0VuPDp78aeyz5CBgTR240UlaMJgq/nmJn7SeBKrWUvGfednppv7XWXSwP7JTDbihE4QM7 hxNK+Jl2rY0pYtFWN3twi+xQATufD20Ml1wQA6L2FBDN+T6+BklrL7lbvCZx2sE02XGdwuLigO V+8xamgoLkG0pSOgSoC3nijbiwsWAhjV1nUgDR2D9LyP7U4TZ+f/beSazTD6xZ0TPEf5IuHw4q /WkpSNS214Bc/p8VlrOcz86NGRBLPoGqcGKpw+N+2o7arQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619348909; bh=qIqBVJtwfutqEyMzJgPuEWl6/sU43Pmm02BIteH2Ba4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature; b=SAunEFRZhuqmD/hJ2R8cyj20XGA7AkXZgw5iPuud4sc+f4xh3+gSo2nTdqYHSs4ls/ENlFpdwd c2SMAV+R+jzGqfzsOe1mY4Zq2IAyxKS4QHAGL74mpEmUCjAEFFTJC7PUoaunPR3ZP0i3y9X0re eAVop5NY5e6GwUSHfmL/vWelQkJ5nsyTp33ynSyQxJzwZLF52SdFeyXt8CYQI5A5ynVEngulQ7 FzgI4YAaDZluZnJ53z2mLFhny7Gy2Y+XPlxnlrw1QgZf1ePQRfu+NSyKhKYWzTAERslkPdC/aM DMCFS/aNOi7yci5QyJ4aukqsNNBXfP50tDkwKyugLqVC8w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=DHO5l+B8ngZOz1kgqq6ihdr+NqMagVIc4Ki5BdOyA4k=; b=LDYgWoH6zkusR+Mxo2UCea/jp6 WflbdTOWCvv7cMkMmEVe0sAmgugNqhGxMuIdSk+ej6yt8sKG++c/ygnSp0Xvitc6G+CadzRfU+lAZ +XKdFZGAcyk0kmih9sxR9mBZhzb7+wsl1HMi0owtVVwMHBmZM2c1XvgyRlpJW3x+4g4bt+qEDqy2B NcSYpebPnd1Enuq66QJ7ZEZPxYrv868EYCM6TGiWFHyTIj9Szw9tM4gx/aWxvHMV5xVbRXsnI701j pIY+hv0SUrEBGMGcDeJSwJp7Ry6C4ESkJLnSz6MkIcWhmgbMyLoHGB8wwlHCIiHZXg2TQauU985BT XLZa2qPQ==; Received: from authenticated user by zero.zsh.org with local id 1laccj-00062v-JX; Sun, 25 Apr 2021 11:08:25 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:53940) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1laccA-0005mV-MZ; Sun, 25 Apr 2021 11:07:51 +0000 Received: from smtp-zira.vinc17.net (unknown [IPv6:2a01:cb19:869c:7700:6150:861a:e24c:595d]) by joooj.vinc17.net (Postfix) with ESMTPSA id 8F4CB82; Sun, 25 Apr 2021 13:07:49 +0200 (CEST) Received: by zira.vinc17.org (Postfix, from userid 1000) id CDF18C23705; Sun, 25 Apr 2021 13:07:47 +0200 (CEST) Date: Sun, 25 Apr 2021 13:07:47 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character) Message-ID: <20210425110747.GA2845787@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20210411175726.hxnm33mxoska2tsm@chazelas.org> <20210411194205.e7mr2wx33wlkq3rs@chazelas.org> <20210422135934.GA154089@zira.vinc17.org> <20210423165326.GB2033191@zira.vinc17.org> <20210424070940.afk5alasj65hyvsq@chazelas.org> <20210424215250.GC2587578@zira.vinc17.org> <20210424231826.GE2587578@zira.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.0.6+162 (8b7dd25b) vl-137001 (2021-04-24) X-Seq: 48701 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: On 2021-04-24 19:20:53 -0700, Bart Schaefer wrote: > On Sat, Apr 24, 2021 at 4:18 PM Vincent Lefevre wrote: > > > > On 2021-04-24 15:28:21 -0700, Bart Schaefer wrote: > > > On Sat, Apr 24, 2021 at 2:53 PM Vincent Lefevre wrote: > > > > > > > > And perl has the same issue as zsh with double-width characters. > > > > > > This implies to me that it's not actually a zsh problem. > > > > Why not? > > Because multiple programs exhibiting identical incorrect behavior > points to a problem in the C library or a system call. Perl is not the same language as zsh. For instance: $ perl -le 'for (@ARGV) {printf "|%10s|\n", $_}' Stephane Stéphane | Stephane| | Stéphane| So, now, you have a different behavior with Perl. I assume that the intent in Perl was not column formatting, but to be similar to C. So I suppose that the Perl printf behaves like printf(3) for 8-bit strings, and like wprintf(3) for Unicode strings. Note that this is independent of the locales, i.e. the Perl printf is not sensitive to the locales for %s, this is more like a datatype-based behavior. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)