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 29836 invoked from network); 11 Apr 2021 19:42:24 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Apr 2021 19:42:24 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618170144; b=UG+/aoiUqz6AwTmqbRFHD+PVZzO9jtrGGfX5rfut9pcSxmd2j8pOWZSvcOcyuzc4mq4IUvQcTr Zm6uMHOEPLApopOUQxh+RUE0rxF44vXf1oJ1kND3G1pip4gqc7R/SkfhkIy1dtQwkNBwwytW5o I4ARNedMhblPKv/wqFaMHvnNgZrQhzLxD81KhFuLC5uKiuBk2A7GvLX8pXdEWW0Dq2FkT8ojQ/ i2uwxh8/hFBvN1fDs8vsy13L5PWhkBsOpAdkRxbxriJKo8H62M4O5WNyMCstqXYH0InfSnzowV Ya4/egfw2EvI49jdXj4bDMyTPyWr/phbBODoRObzZJLUww==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay10.mail.gandi.net) smtp.remote-ip=217.70.178.230; 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=1618170144; bh=v3HaOZeinhYDYUSTHNVFbeNm4GVYT9vd/pekNR14q54=; 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=W1Ytm8r5eVk++JsqyfwkJIJ27KkW9M3bwVSlPw6vIcIoUtLfjXgv9lsU6fO2SvWPkS8SyDEHTT ymA1VsJ5Cz1lKhgU0YHtFRK/t/NpnCHJDjLPCpLpEJbp3oMtMmS2rFNjtSY98zpB/N7iVR/1K4 YdYwn82XX6kzclpy3OOH4eycHe4EpJfxGpZIuOXwI0kRTAP3spRGaCo9sPqrYaAkHF5ykWodhp Mr0mWHHPoU15+v5qrgec/OsMZ2u7LnL0DEV2rYOrgfbSjNwuM4OyCvzPiAewhPjhVBxfyld7qw muET0NKACzqbfvYAmIBwXpof6m4yYdgKS1FF7c06OUZguQ==; 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=jZaUq5rNsVX8SffIY2g4Np8TkpTi6bQmtdZjhAicF10=; b=WaQwXtqyyyWFh/VyAB1b5j5SfM fSYrCbOMjWqVr9EMsFKzlqBOs715H/AG0RyL2myn6cpBpnDyGls+s95fMWXWjSPM5EqFrpsa8nJla BqOyfJhEVVeXgszf8avxIgBoNgpdJyC+KQCtqkrzYnnElgARPUWVUZoihRXWAGoPHJMViGOmSeWEk jEdbtOzPmT5TKBI5GpXiNONkAJAKQCccon8j/Mqf0/MNI3kSTSksPBaEjufIfwnIAfkMnEhETN+SD TpHXWFNzNuR1I1oGxAMtzHeljJbAINpaBUmyVvh+S7tVTY5u6mPutwWstcK5YKD0CKeRuwGNZsi/L klOA6A9g==; Received: from authenticated user by zero.zsh.org with local id 1lVfyS-00044i-0O; Sun, 11 Apr 2021 19:42:24 +0000 Authentication-Results: zsh.org; iprev=pass (relay10.mail.gandi.net) smtp.remote-ip=217.70.178.230; dmarc=none header.from=chazelas.org; arc=none Received: from relay10.mail.gandi.net ([217.70.178.230]:47893) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lVfyB-0003oE-VH; Sun, 11 Apr 2021 19:42:08 +0000 Received: from chazelas.org (unknown [90.215.204.106]) (Authenticated sender: stephane@chazelas.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 942FC240017 for ; Sun, 11 Apr 2021 19:42:07 +0000 (UTC) Date: Sun, 11 Apr 2021 20:42:05 +0100 From: Stephane Chazelas To: Zsh hackers list Subject: Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character) Message-ID: <20210411194205.e7mr2wx33wlkq3rs@chazelas.org> Mail-Followup-To: Zsh hackers list References: <7FD930F4-37CD-402B-9A06-893818856199@dana.is> <20210411175726.hxnm33mxoska2tsm@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210411175726.hxnm33mxoska2tsm@chazelas.org> X-Seq: 48503 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-11 18:57:26 +0100, Stephane Chazelas: > Some non-POSIX conformances I can think of ATM: [...] Another POSIX bug fixed by zsh (but which makes it non-compliant): With multibyte characters: $ printf '|%10s|\n' Stéphane Chazelas | Stéphane| | Chazelas| POSIX requires: | Stéphane| | Chazelas| (with a UTF-8 é encoded one 2 bytes), that is, the width to be a number of bytes not characters. ksh93 has printf %20Ls where width is based on the display width of characters. $ zsh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas" | Stéphane| | Chazelas| $ ksh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas" | Stéphane| | Chazelas| (that one is not specified by POSIX) -- Stephane