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 14892 invoked from network); 24 Apr 2021 07:09:59 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Apr 2021 07:09:59 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619248199; b=nksMdMlioS2SBJcKljjqCCzRI+s3s573VWFIU31Q07giE0+FJQZ1s05m7/JYlq+d5kRrhr4AbW ybP/jQf08etc4uEyp4gAJ8z/Wncgq2cpEp1cXWuf3pSdlrcbBJBVQV98fx34hlh48EC1ttM9VP 4l4UbEsZkshsdQYQl0Z5AV97hLAnHA23lk4kxm2jMNCg2onAIV9FAN0CTrNKaXYoC4U3yMqYVo Hm937A8zQ4pB1j90SGTXglVQEnXyBYoq5tNyafhuPi3PYtPDvRyleGIW1IuzvLv2Jsduj85yoy FFvwHP/GTZ8uSWLaD6Hw2NJdKiHYsd8WcOR3n5FIBG5M6Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay4-d.mail.gandi.net) smtp.remote-ip=217.70.183.196; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619248199; bh=4hDmJRng4Xg6JXAUfs600WzF2fbAr5++3iohpkib4GA=; 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=dwCkDhgGO4XQY8ZNtKLykiQyW6JZlwe/1zRi8icvXIlOsk8wIpxeMAWPgFtbvR4icjrLfAV5pd u7u5XXDXZ8hHKScOwgq6O7EUwlVsfeiNgef3kHlcmDxC2k/mFCK2ZbLBFPEV5kCI78vXw1Togi NkNmgBWZlyU0PrPlo8qWmZmgRhohXIUUpszupqbUT8Ttv6SOsvNYXlHffp2gZFS+OogwjJwB9B ljXhLzsNX9rXEHEkNfRwii4w2u403GEk72fHoFY84klYIbrvqvHYHeSWoc9NZnT5IgQ9y3G9eV dNRNwveD/JBXTEGxwLGOB0fgpDMInq08rt1DiEtD2F95pg==; 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=AVZ+TbZPdLMRsFyR74n99t3fCH83diN4rtK3cJXR9DI=; b=yT4a2SW+Q4ztV4Lf7KkGFP4LCr k6VRJBu1ZWF7lqo+BBp10z/ZJMamay4t9eSf+A8UClnjDhAXpIu6vFxkCtZJ/2dWKqNGpWfQIeS1U KWXjCHUvj8W3X+nqojD5hQagKgjwbI7NgUP/sUi/EE0zZh/C6djwByKeks5gxqnOP1ZoqTLYIkcG/ AmCztv9lDgOuGo7WeMEp4EPIH9sFfWhjuAs7jD8hfjoGmKH7gkrKKf9eqfF/xevsF/CP7tNY4Krl5 sd1ZwC2IBaFAS2mX6CDECVPHrkkC3cTV4AVyhU2ImaUKsKAj3anF77fZjFSizoHuDerg5Nji5ohZm FO6aQTKQ==; Received: from authenticated user by zero.zsh.org with local id 1laCQQ-0008ur-EG; Sat, 24 Apr 2021 07:09:58 +0000 Authentication-Results: zsh.org; iprev=pass (relay4-d.mail.gandi.net) smtp.remote-ip=217.70.183.196; dmarc=none header.from=chazelas.org; arc=none Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43311) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1laCQA-0008gV-6h; Sat, 24 Apr 2021 07:09:42 +0000 X-Originating-IP: 90.215.204.106 Received: from chazelas.org (unknown [90.215.204.106]) (Authenticated sender: stephane@chazelas.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 68A6BE0007 for ; Sat, 24 Apr 2021 07:09:41 +0000 (UTC) Date: Sat, 24 Apr 2021 08:09:40 +0100 From: Stephane Chazelas To: zsh-workers@zsh.org Subject: Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character) Message-ID: <20210424070940.afk5alasj65hyvsq@chazelas.org> Mail-Followup-To: zsh-workers@zsh.org References: <7FD930F4-37CD-402B-9A06-893818856199@dana.is> <20210411175726.hxnm33mxoska2tsm@chazelas.org> <20210411194205.e7mr2wx33wlkq3rs@chazelas.org> <20210422135934.GA154089@zira.vinc17.org> <20210423165326.GB2033191@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: <20210423165326.GB2033191@zira.vinc17.org> X-Seq: 48686 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: 2021-04-23 18:53:26 +0200, Vincent Lefevre: [...] > Some file formats have fields with a byte-size limit. Providing > more than this limit could have unexpected effects. One may also > want to limit the size of generated filenames (see NAME_MAX). [...] printf is to print formatted text. If you want to work at byte level, you need to use the C locale (or in zsh disable the multibyte option). In zsh, that applies to printf and all other text utilities and operators which is more consistent than the POSIX API. Note that the printf of perl, fish, gawk (and I'd expect most modern languages) work at character level (possibly as wrappers for C's wprintf()). $ perl -CLSA -le 'for (@ARGV) {printf "|%10s|\n", $_}' Stephane Stéphane | Stephane| | Stéphane| -- Stephane