coreutils
coreutils copied to clipboard
printf does not have limits for the maximum value of its arguments
The GNU printf command limits the value of arguments it will accept, for example
$ printf '%.*d\n' 10 0
0000000000
$ printf '%.*d\n' 2147483648 0
bash: printf: warning: 0: Numerical result out of range
The version of printf in this repo does not apply this limit so it will produce 2 billion 0s. This is causing the gnu tests to fail when attempting to generate the final log as it has to process a log from a test that is ~2GB in size.
If this isn't considered a bug then the gnu tests should be patched to remove the problematic check.
Note that your example is using the Bash built-in printf, which produces different output then GNU printf in this case:
$ printf '%.*d\n' 2147483648 0
-bash: printf: warning: 0: Numerical result out of range
$ /usr/bin/printf '%.*d\n' 2147483648 0
/usr/bin/printf: invalid precision: ‘2147483648’
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hasn't been fixed yet
Hi @tertsdiepraam if possible I want to give this a try. But what is the maximum acceptable range of a valid output?
@howjmay I've tried some values and the maximum allowed value in GNU seems to be 2^31 - 1 = 2147483647. So basically whatever fits in a i32 I suppose.
Thank you!
Fixed in https://github.com/uutils/coreutils/pull/6511