mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andrew Snyder <arsnyder16@gmail.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] print does not support variable width plus padding
Date: Tue, 14 Dec 2021 12:05:12 -0500	[thread overview]
Message-ID: <CAOJ3pK5RNTrzTNB+DpDb4xuctrt4gC+3zia-pM3PB3i5zfQF5w@mail.gmail.com> (raw)
In-Reply-To: <20211214165057.GH7074@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]

To follow up, i am trying to reproduce specifically with some native C code
on alpine but am unable to,  I am going to switch gears and attempt to
isolate when compiled with emscripten, and will log a bug on that end.

On Tue, Dec 14, 2021 at 11:50 AM Rich Felker <dalias@libc.org> wrote:

> On Tue, Dec 14, 2021 at 11:10:23AM -0500, Andrew Snyder wrote:
> > Sorry accidentally sent before attaching this
> >
> > ~# docker run -it --rm alpine /bin/ash
> > / # /lib/libc.musl-x86_64.so.1
> > musl libc (x86_64)
> > Version 1.2.2
> > Dynamic Program Loader
> > Usage: /lib/libc.musl-x86_64.so.1 [options] [--] pathname [args]
> > / # printf %0*i 2 1
> > ash: %0*i: invalid format
>
> This is the busybox printf(1) command not the printf(3) C function.
>
> Rich
>
>
> > On Tue, Dec 14, 2021 at 11:09 AM Andrew Snyder <arsnyder16@gmail.com>
> wrote:
> >
> > > I get an error from printf i assume that underlying printf function is
> > > returning error code.  In my native implementation i get incorrect
> results
> > > and really depends on the parameters i didn't dig into too deep to see
> what
> > > the pattern was
> > >
> > >
> > > On Tue, Dec 14, 2021 at 11:03 AM Szabolcs Nagy <nsz@port70.net> wrote:
> > >
> > >> * Andrew Snyder <arsnyder16@gmail.com> [2021-12-14 10:22:42 -0500]:
> > >> > I would like to be cc'd on the replies
> > >> >
> > >> > Looks like a bug in the musl printf functionality
> > >> >
> > >> > When using variable width format string and specifying a padding
> musl
> > >> fails
> > >> > to format properly.
> > >> >
> > >> > I am using musl indirectly through an emscripten compile of a native
> > >> > library.
> > >> >
> > >> > Consider the following repro steps using alpine docker image.
> Correct
> > >> > results exist when using ubuntu image
> > >> >
> > >> > # Correct expected  ' 1'
> > >> > docker run -it --rm alpine printf %2i 1
> > >> > # Correct expected  ' 1'
> > >> > docker run -it --rm alpine printf %*i 2 1
> > >> > # Correct expected  '01'
> > >> > docker run -it --rm alpine printf %02i 1
> > >> > # errors, Expected '01'
> > >> > docker run -it --rm alpine printf %0*i 2 1
> > >>
> > >> i get the expected result on alpine
> > >>
> > >> $ printf %0*i 2 1
> > >> 01
> > >>
> > >> what do you get?
> > >>
> > >>
>

[-- Attachment #2: Type: text/html, Size: 3398 bytes --]

  reply	other threads:[~2021-12-14 17:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 15:22 Andrew Snyder
2021-12-14 16:03 ` Szabolcs Nagy
2021-12-14 16:09   ` Andrew Snyder
2021-12-14 16:10     ` Andrew Snyder
2021-12-14 16:50       ` Rich Felker
2021-12-14 17:05         ` Andrew Snyder [this message]
2021-12-15 18:09       ` Quentin Rameau
2021-12-15 18:37         ` Andrew Snyder
2021-12-15 21:21           ` Rich Felker
2021-12-15 21:40             ` enh
2021-12-15 21:51               ` Andrew Snyder
2021-12-16 11:22             ` Ron Yorston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOJ3pK5RNTrzTNB+DpDb4xuctrt4gC+3zia-pM3PB3i5zfQF5w@mail.gmail.com \
    --to=arsnyder16@gmail.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).