From patchwork Tue Mar 6 14:49:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martijn Dekker X-Patchwork-Id: 10262053 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 4D9696016D for ; Tue, 6 Mar 2018 14:49:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D98A29028 for ; Tue, 6 Mar 2018 14:49:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 323892902C; Tue, 6 Mar 2018 14:49:48 +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 44C1929028 for ; Tue, 6 Mar 2018 14:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753491AbeCFOtp (ORCPT ); Tue, 6 Mar 2018 09:49:45 -0500 Received: from kahlil.inlv.org ([37.59.109.123]:58066 "EHLO kahlil.inlv.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750838AbeCFOtn (ORCPT ); Tue, 6 Mar 2018 09:49:43 -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 w26EnbfK020953 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 6 Mar 2018 15:49:37 +0100 Subject: Re: [PATCH] fix "Illegal number" on FreeBSD & macOS for x=; echo $((x)) To: Harald van Dijk , dash@vger.kernel.org References: <62c16598-2d44-f4c9-991d-9880a8839786@inlv.org> <9166c1f0-a269-74b9-2aad-579bc4c97315@gigawatt.nl> <1eeaa9a8-3f7b-b54f-bc80-a5f311a1b0a7@inlv.org> From: Martijn Dekker Message-ID: Date: Tue, 6 Mar 2018 14:49:38 +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: Content-Language: en-GB Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I had totally forgotten this bug had come up before in January 2017: https://www.spinics.net/lists/dash/msg01271.html The original reporter, Michael Greenberg, didn't specify the bug only occurs on macOS and FreeBSD but it does seem to be the same bug. He submitted a different patch to fix it: - 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/var.c b/src/var.c index cc6f7f2..e34f9cf 100644 --- a/src/var.c +++ b/src/var.c @@ -353,7 +353,7 @@ lookupvar(const char *name) intmax_t lookupvarint(const char *name) { - return atomax(lookupvar(name) ?: nullstr, 0); + return atomax(lookupvar(name) ?: "0", 0); } Which is better?