-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Steps to reproduce:
printf "a(%*s)b\n" -3
(the "a(" and ")b" are just there to make the whitespace in the output more readable, they are not critical to the example)
What happens now: uutils printf prints an error message and then renders the %*s with zero spaces:
./target/debug/printf: '-3': expected a numeric value
a()b
What I expected to happen: GNU printf succeeds with three spaces:
a( )b
Notes: This is causing a failure in the GNU test file tests/printf/printf.sh.
According to the glibc Output Conversion Syntax documentation,
You can also specify a field width of ‘*’. This means that the next argument in the argument list (before the actual value to be printed) is used as the field width. The value must be an int. If the value is negative, this means to set the ‘-’ flag (see below) and to use the absolute value as the field width.