Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 14 Dec 2021 12:05:12 -0500
From: Andrew Snyder <arsnyder16@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: print does not support variable width plus padding

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@...c.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@...il.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@...t70.net> wrote:
> > >
> > >> * Andrew Snyder <arsnyder16@...il.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?
> > >>
> > >>
>

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.