[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugs in printf/sprintf formatted output
From: |
arnold |
Subject: |
Re: Bugs in printf/sprintf formatted output |
Date: |
Tue, 06 Aug 2024 12:45:39 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
"Maciej W. Rozycki" <macro@redhat.com> wrote:
> - Missing leading zero for signed integer conversions for the specific
> precision of one above the number of digits required to represent the
> number and negative numbers, e.g.: { printf "%.2i", -1 } prints "-1"
> rather than "-01"; similarly { printf "%.3i", -12 }' prints "-12" rather
> than "-012". Other precision values or natural numbers work correctly,
> e.g. { printf "%.3i", -1 } prints "-001" as, { printf "%.2i", 1 } prints
> "01", etc., as expected.
>
> - The + and space flags not ignored for unsigned integer conversions where
> the precision specified causes any leading zeros to be printed, e.g.:
> { printf "%+.2u", 1 } prints "+01" rather than "01" and then similarly:
> { printf "% .3u", 12 } prints " 012" rather than "012". If no leading
> zeros are printed, then output is correct, e.g. { printf "%+.2u", 12 }
> prints "12" as expected.
I have added tests for these cases (in test/printf-corners.awk) and
fixed the code so that they now pass. I have pushed to the
stable/printf-rework branch. Please review.
Thanks again,
Arnold
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/05
- Re: Bugs in printf/sprintf formatted output, Maciej W. Rozycki, 2024/08/05
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/06
- Re: Bugs in printf/sprintf formatted output, Maciej W. Rozycki, 2024/08/06
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/06
- Re: Bugs in printf/sprintf formatted output, Maciej W. Rozycki, 2024/08/06
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/06
- Re: Bugs in printf/sprintf formatted output, Maciej W. Rozycki, 2024/08/07
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/08
- Re: Bugs in printf/sprintf formatted output,
arnold <=
- Re: Bugs in printf/sprintf formatted output, Maciej W. Rozycki, 2024/08/07
- Re: Bugs in printf/sprintf formatted output, arnold, 2024/08/08