From: Andrew Snyder <arsnyder16@gmail.com>
To: Andrew Snyder <arsnyder16@gmail.com>, musl@lists.openwall.com
Subject: Re: [musl] print does not support variable width plus padding
Date: Tue, 14 Dec 2021 11:10:23 -0500 [thread overview]
Message-ID: <CAOJ3pK6fRXtzPcjbzZ2ey_M1b98ChcT5gnyCR-zDDK4gu_9L+g@mail.gmail.com> (raw)
In-Reply-To: <CAOJ3pK5Q43+BrER+9sYx7ABivXyNoGub0h1s94jPxG=i-x_Umg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]
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
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: 2463 bytes --]
next prev parent reply other threads:[~2021-12-14 16:10 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 [this message]
2021-12-14 16:50 ` Rich Felker
2021-12-14 17:05 ` Andrew Snyder
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=CAOJ3pK6fRXtzPcjbzZ2ey_M1b98ChcT5gnyCR-zDDK4gu_9L+g@mail.gmail.com \
--to=arsnyder16@gmail.com \
--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).