klibc-bot for Martijn Dekker
2019-Jan-25 03:15 UTC
[klibc] [klibc:update-dash] mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x))
Commit-ID: 43f4d1915fc244522d3fabb0fd91d23994bd472e Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=43f4d1915fc244522d3fabb0fd91d23994bd472e Author: Martijn Dekker <martijn at inlv.org> AuthorDate: Wed, 7 Mar 2018 13:03:26 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x)) Op 07-03-18 om 06:26 schreef Herbert Xu:> Martijn Dekker <martijn at inlv.org> wrote: >> >>> Since base is always a constant 0 or a constant 10, never a >>> user-provided value, the only error that strtoimax will ever report on >>> glibc systems is ERANGE. Checking only ERANGE therefore preserves the >>> glibc behaviour, and allows the exact same set of errors to be detected >>> on non-glibc systems. >> >> That makes sense, thanks. > > Could you resend your patch with this change please?OK, see below. - M. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/mystring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/mystring.c b/usr/dash/mystring.c index 0106bd27..de624b89 100644 --- a/usr/dash/mystring.c +++ b/usr/dash/mystring.c @@ -125,7 +125,7 @@ intmax_t atomax(const char *s, int base) errno = 0; r = strtoimax(s, &p, base); - if (errno != 0) + if (errno == ERANGE) badnum(s); /*
Reasonably Related Threads
- [klibc:update-dash] dash: mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x))
- [klibc:update-dash] dash: expand: Fix multiple issues with EXP_DISCARD in evalvar
- [klibc:update-dash] expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
- [klibc:update-dash] builtin: Greater resolution in test -nt / test -ot
- [klibc:update-dash] dash: expand: 'nolog' and 'debug' options cause "$-" to wreak havoc