From patchwork Wed Mar 7 13:03:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martijn Dekker X-Patchwork-Id: 10263979 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3EE6602C8 for ; Wed, 7 Mar 2018 13:03:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CF6294BE for ; Wed, 7 Mar 2018 13:03:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 997CE294F5; Wed, 7 Mar 2018 13:03:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A29A2294D0 for ; Wed, 7 Mar 2018 13:03:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751151AbeCGNDi (ORCPT ); Wed, 7 Mar 2018 08:03:38 -0500 Received: from kahlil.inlv.org ([37.59.109.123]:57444 "EHLO kahlil.inlv.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbeCGNDi (ORCPT ); Wed, 7 Mar 2018 08:03:38 -0500 Received: from [192.168.1.81] (host86-129-6-191.range86-129.btcentralplus.com [86.129.6.191]) (authenticated bits=0) by kahlil.inlv.org (8.14.9/8.14.4) with ESMTP id w27D3PWS026738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 7 Mar 2018 14:03:25 +0100 Subject: Re: [PATCH] fix "Illegal number" on FreeBSD & macOS for x=; echo $((x)) To: Herbert Xu Cc: harald@gigawatt.nl, dash@vger.kernel.org References: <20180307062606.GA3079@gondor.apana.org.au> From: Martijn Dekker Message-ID: <622da1b5-7459-375d-e810-c270c776ebb5@inlv.org> Date: Wed, 7 Mar 2018 13:03:26 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180307062606.GA3079@gondor.apana.org.au> Content-Language: nl Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Op 07-03-18 om 06:26 schreef Herbert Xu: > Martijn Dekker 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. --- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/mystring.c b/src/mystring.c index 0106bd2..de624b8 100644 --- a/src/mystring.c +++ b/src/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); /*