From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1752 invoked from network); 14 Dec 2021 16:10:17 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 14 Dec 2021 16:10:17 -0000 Received: (qmail 7634 invoked by uid 550); 14 Dec 2021 16:10:15 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7592 invoked from network); 14 Dec 2021 16:10:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=L0W3Q17KCDpTnrrM0KJ5Rr82QhLE5w+yapds/a/ToFo=; b=X5XctCtUYuJSejabcTiGof2aIs4QSudqVdpp3G42NLwIAqYETa9F6dfrA0LNt5MDhr R7BLqQnn8l+O1c0h9r01Ir/QEZiJiawSA9RScwLzbGNgh786orMkZYmiYNvKgRQCVXjU hsB4ub/qXpXsThhb1Dci+RBW/LmBwnbbGgT7ZA5m2y0I6ENt7nXJVhbx/oI9HNSNhWtJ wwfPq+iAsak+7cw+e8v4oqECY1vuGNRZOUamWHsIo7526IhlhgXb9gVIYmi0wrBtZIbY Cy7U0FcMpX7UPfTWWsD4F2EWWLL04IadIrR9kt8SxAH/4TYNKaSReslgdYdqb1usjI2o aDOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=L0W3Q17KCDpTnrrM0KJ5Rr82QhLE5w+yapds/a/ToFo=; b=ZJRQVTU5wLWMIv4F+CbxVOeSE9FcM2241Wz5ZYIbrULS4IBX7qlLsVJDVkZcdCBpRG Ef2qMlxfKIGUliuNPgVCkPxv66LEQnlsMfKPdtX+/aFT6cKFoTaX3Rbx9aQzy3n3E4zn qfc+MADrs4eWgx1rNUhEdaEySC4LLiL8T79DBkJ2Hwp8hFYn6Guhfz7eIBsy3AYS35qa De5xJwJqimh8K0CUh6Jmkno4ur4uve9pm3fbiV7Asx8uVSPpxL0E6DV0shmcYSD3ysmP ezKwuAw26A3c/NDbKT3dcbLiYz9e0QD+S7fQV38adKwxwxZU6tEZtD8gBFA5qaHpL+qX p4Xg== X-Gm-Message-State: AOAM533IvW9/4f71gj2RcFDlkCpU6Pix/+qjbOZfdSp3bZgaIPnQdIpf EdxIaLrvuPfoQYZJfRGY+XQXu+U28oFppRuj6A4= X-Google-Smtp-Source: ABdhPJxOg+qDBzqB9+5RJXfMiF+RCLpWemQdhgprPWV4w6Qt/Xp3xjT+xPx1Lml7Q/vKPppqkCAdplYkeubRnMqAcyU= X-Received: by 2002:a67:3382:: with SMTP id z124mr5418622vsz.57.1639498201949; Tue, 14 Dec 2021 08:10:01 -0800 (PST) MIME-Version: 1.0 References: <20211214160327.GA1494342@port70.net> In-Reply-To: <20211214160327.GA1494342@port70.net> From: Andrew Snyder Date: Tue, 14 Dec 2021 11:09:50 -0500 Message-ID: To: Andrew Snyder , musl@lists.openwall.com Content-Type: multipart/alternative; boundary="000000000000f019b705d31d6b14" Subject: Re: [musl] print does not support variable width plus padding --000000000000f019b705d31d6b14 Content-Type: text/plain; charset="UTF-8" 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 wrote: > * Andrew Snyder [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? > > --000000000000f019b705d31d6b14 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I get an error from printf i assume that underlying printf= function is returning error code.=C2=A0 In my native implementation i get = incorrect results and really depends on the parameters i didn't dig int= o too deep to see what the pattern was=C2=A0


On Tue, Dec 14, = 2021 at 11:03 AM Szabolcs Nagy <nsz@po= rt70.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<= br> > results exist when using ubuntu image
>
> # Correct expected=C2=A0 ' 1'
> docker run -it --rm alpine printf %2i 1
> # Correct expected=C2=A0 ' 1'
> docker run -it --rm alpine printf %*i 2 1
> # Correct expected=C2=A0 '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?

--000000000000f019b705d31d6b14--