Another Possible Solution is to remove support for octal in atolx, the use of zero padded numbers is probably a lot less common than any modern use of octal.
Patch 2.0 is attached, Nothing breaks in the test suite - Oliver Webb <aquahobby...@proton.me>
From 49e73c9d8d19bb590f79c92065dbb133cad50565 Mon Sep 17 00:00:00 2001 From: Oliver Webb <aquahobby...@proton.me> Date: Sun, 21 Apr 2024 15:20:59 -0500 Subject: [PATCH] Stop Confusing Zero Padded Numbers With Octal. Zero Padded numbers are more common than any modern use of octal. --- lib/lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lib.c b/lib/lib.c index 6a4a77dd..fd5c3ac7 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -312,7 +312,8 @@ long long atolx(char *numstr) char *c = numstr, *suffixes="cwbkmgtpe", *end; long long val; - val = xstrtol(numstr, &c, 0); + // Zero padded numbers are more common than any modern use of octal + val = xstrtol(numstr, &c, (*numstr == '0' && numstr[1] != 'x') ? 10 : 0); if (c != numstr && *c && (end = strchr(suffixes, tolower(*c)))) { int shift = end-suffixes-2; ++c; -- 2.44.0
_______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net