logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: b8e206e0122b76df02aa9fc980d160361b66ab35
parent cb193c6e878d08097d6e503287071c2bd154b948
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 28 Dec 2025 05:57:24 +0100

printf: GNU glibc ARG_MAX is 16 times too big

Diffstat:

Mtest-cmd/printf.sh9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test-cmd/printf.sh b/test-cmd/printf.sh @@ -86,7 +86,14 @@ wc_c() { } if arg_max=$(getconf ARG_MAX); then - # 64 should be enough but somehow ArchLinux and {Free,Net,Open}BSD need more + # GNU glibc returns 2097152 which is 16 times more than the correct value (131072) + case "$(uname -s)-$arg_max" in + Linux-131072) ;; + Linux-*) arg_max=131072 ;; + *) ;; + esac + + # 64 should be enough but somehow {Free,Net,Open}BSD need more # 128 also wasn't enough for them # 1024 is 1/4th of _POSIX_ARG_MAX so really ought to be enough leeway arg_max=$((arg_max - 1024))