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 17528 invoked from network); 24 Apr 2021 21:41:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Apr 2021 21:41:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619300493; b=eHnNchse8i0i2bAeB+FmzLAjDpLDNx4eZjY/PbIGrSC6dVGr8phl+4GWMW+rAXzytoZJh5FNy1 iM8sTuACpvqbqjNk6DJFuoNgLY9dSWH5puzBRO2r5qkXatXplkDLaVSI6fS2biKlBJmHtforFd xUjMh0Me26vqpiQ+WQMqoiCbd33EmAgLEtK36LL2S7z+kJRuxZnQlqVfqetMtKvRE067d4EWmM tl4w2X/cmuF/VWlWRObcyQb/n4Tr00RrEgjerd/+qrdGO9iJRhEDdw/G+G9bVb0DrQG4EpyEns wfiDJtTtTYLwZDMxu+EQ865vbQv3JyPtUBYcDP6MRq+wiA==; 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=1619300493; bh=WM5ueu9kmsYkK2pw26OB8HVolBYCrF/f6fiYQswo+pU=; 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=CFnOFI+X/5hotnqOsef2/HmBbpSnizXFT6K35mhk/yYyE1pZ9/OvhylMYI1uq4yMHqhdjFw26V GaSUlnWFJg/nZxm00V/oEexqAoXmDl7kZQs53qhVKLzFauV0PR2QHVIEaKgRwDcNG8TbuKBAjB uuCYgsrY/AgSk5pCd4gAz/vjGRWzp4Af/B0BqIISlwEhrUprDZZ2OWQ/GrZAmW4A1E9AOZMu9M 36chF5IittwAOH7TMeVvTM2qr8kD2FUppVsZRfXZgpLK4ZZKA8t/zUvrrhZ0ue6EhC+uTYdlMw Q0HGj4dZbqR52b40f/WtHlp4J3g+squQutbb+bKDTjYEwA==; 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=anphCyRkMIfaYm183eU2B61tCdJcFjWG4siYL1MvCrQ=; b=BGooj+R83/pJf1FzqA0c918ghg nDwDQoQSgWCWUIYmnlnHcaTbrAZmuv4RwFY6AmfDoAq9y5UvDsFmKBth83XKzVbcnPL+Exy6DKHK7 uEcCTfsCt1ZO0GNl1htZ1waPKEYa+IvGTHV2r6iXmytCAJj7+ENRyfoKVvNC9whSTrax+q6NZgjZW 3wcgp3JoYDi7tkEuiDJYTyatKNxrhE1Ae4sa+cjs/noZXqgNYP3cuNDlylzZYvK+YrPB+AOXzz0/F 5jpPAZZq4KPBRBfo6XIjr+o6GKgn9AfUrIMwmtdDQLkctUNqZtBY7eDfJKMAj/55qfSUWujZgyFJ5 doecHALw==; Received: from authenticated user by zero.zsh.org with local id 1laQ1r-0006Y2-M7; Sat, 24 Apr 2021 21:41:31 +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]:53720) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1laQ1c-0006KY-0v; Sat, 24 Apr 2021 21:41:16 +0000 Received: from smtp-zira.vinc17.net (lfbn-tou-1-1431-42.w90-89.abo.wanadoo.fr [90.89.233.42]) by joooj.vinc17.net (Postfix) with ESMTPSA id 057DE100; Sat, 24 Apr 2021 23:41:14 +0200 (CEST) Received: by zira.vinc17.org (Postfix, from userid 1000) id EFEB6C23180; Sat, 24 Apr 2021 23:41:13 +0200 (CEST) Date: Sat, 24 Apr 2021 23:41:13 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character) Message-ID: <20210424214113.GA2587578@zira.vinc17.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> <55476-1619218919.166096@6bqh.WmTW.CAzf> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <55476-1619218919.166096@6bqh.WmTW.CAzf> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.0.6+160 (30e657d3) vl-137001 (2021-04-24) X-Seq: 48691 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 01:01:59 +0200, Oliver Kiddle wrote: > Vincent Lefevre wrote: > > On 2021-04-22 12:22:12 -0700, Bart Schaefer wrote: > > > Someone can probably point to the rationale document, but I'm guessing > > > this is really because of equivalence with sprintf() formats. > > > > 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). > > And for every one time that someone needs something like that, there > are a zillion cases where people just want to line up output neatly in > columns and are thwarted. More likely, this was just standards people > insisting on exactly matching the C printf(). Why not define an extension, then? > A high level language like a shell should not force users to know about > low-level character encodings. So the current zsh behavior is wrong: If one wants an output that doesn't take more than N bytes, one must take the low-level character encoding into account. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)