[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] printf: add %#s alias to %b

From: enh
Subject: Re: [PATCH] printf: add %#s alias to %b
Date: Tue, 5 Sep 2023 12:58:36 -0700

On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey <> wrote:
> On 8/31/23 5:15 PM, Eric Blake wrote:
> > It's not hard to see why POSIX is choosing to have Issue 8 obsoleting
> > (not removing) %b's old semantics; in the short term, nothing about %b
> > changes, so your dusty-deck shell scripts will continue to work as
> > they have before; but you now have enough time to update your scripts.
> History has shown us that many will not.
> > The question is whether Issue 9 (several years down the road) will be
> > able to repurpose %b to mean binary literal output (only possible if
> > all shell authors agree that C2X compatibility is worth it),
> Unlikely.
> > But if POSIX _is_ able to repurpose %b (because enough shell authors
> > agree that binary output is more useful these days than XSI echo
> > compatibility),
> I think you'll find that, regardless of its origins, there are more scripts
> using the %b specifier than you think.

i'd personally never heard of printf(1) %b before this thread, but
debian code search agrees with you:*%25b&literal=0

(obviously there are some false positives in there, but it gives a
pretty good idea.)

there are only a handful of hits in the Android build, but there are
hundreds in non-public codebases i have access too.

> > the followon question is whether there should be a
> > portable way to access the old functionality.  Since %#s is currently
> > unspecified, we are trying to guage feedback of how many
> > implementations are willing to add that alias now, which in turn will
> > affect whether Issue 9 can mandate that behavior (because everyone
> > liked it) or must continue to leave it undefined.
> >
> > But nothing is stopping coreutils from adding %#s as an extension now,
> > regardless of what input other shell authors provide to the ongoing
> > POSIX discussion.
> I don't have a problem adding %#s. I have a problem with POSIX not seeing
> that the printf builtin is not a direct parallel to the library function
> and forcing an incompatible change.
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU

reply via email to

[Prev in Thread] Current Thread [Next in Thread]