Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)



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 <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author