From: enh <enh@google.com>
To: musl@lists.openwall.com
Cc: Andrew Snyder <arsnyder16@gmail.com>, Quentin Rameau <quinq@fifth.space>
Subject: Re: [musl] print does not support variable width plus padding
Date: Wed, 15 Dec 2021 13:40:02 -0800 [thread overview]
Message-ID: <CAJgzZor+NLxJw3m6XE=6CL-VC02_U37NEXVDUv56ZDQ05xZAyQ@mail.gmail.com> (raw)
In-Reply-To: <20211215212126.GK7074@brightrain.aerifal.cx>
On Wed, Dec 15, 2021 at 1:21 PM Rich Felker <dalias@libc.org> wrote:
>
> On Wed, Dec 15, 2021 at 01:37:43PM -0500, Andrew Snyder wrote:
> > That is probably true but I think on accident trying to replicate my
> > original issue which was using the native function
>
> With the program:
>
> #include <stdio.h>
> int main(int argc, char **argv)
> {
> printf("%0*i\n", 2, argc);
> }
>
> (written using argc so it can't be collapsed to a constant string at
> compile time) I get output of "01\n" as expected. If you think there's
> a bug in musl for this or related functionality, can you provide a
> minimal C test case?
>
> > On Wed, Dec 15, 2021 at 1:09 PM Quentin Rameau <quinq@fifth.space> wrote:
> >
> > > Hi Andrew,
> > >
> > > > 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 looks like you found a bug in Busybox printf implementation.
>
> FWIW I suspect the problem is that Busybox is not recognizing the 0
> character as a flag (which it is, in the printf grammar) and thinks
> it's the leading character of a width, making the * specifier for
> width invalid (since a width was already seen).
yeah, since i was curious whether toybox had an issue too, i tested
this (with bionic and glibc, but _not_ musl) and saw that coreutils
and toybox both produce the correct output, but busybox fails with
"invalid format" for glibc too.
> Rich
next prev parent reply other threads:[~2021-12-15 21:40 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
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 [this message]
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='CAJgzZor+NLxJw3m6XE=6CL-VC02_U37NEXVDUv56ZDQ05xZAyQ@mail.gmail.com' \
--to=enh@google.com \
--cc=arsnyder16@gmail.com \
--cc=musl@lists.openwall.com \
--cc=quinq@fifth.space \
/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).