From patchwork Wed Jul 20 06:35:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 73 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp2902340eik; Tue, 19 Jul 2022 23:36:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ux7HrMUJrsMR1UV4Xm60vG7DIeQwV0yIn2D6w5EbeacYc9QSMMJBaaVfRht2D0+AgS5GqR X-Received: by 2002:a05:6402:913:b0:43a:b594:93a8 with SMTP id g19-20020a056402091300b0043ab59493a8mr49073661edz.346.1658298997390; Tue, 19 Jul 2022 23:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658298997; cv=none; d=google.com; s=arc-20160816; b=GqNjXc4bsrpw3mGqaT0XigwzZISOlLJwFDQJIOCUW9CuLz6C+u6kCCKuc/80uthOpN OcfNFnJ8JNDEgO6rMSynUOsuo77/cG5MWv/cZQZHPWAnco6Rnhu8DvGurB3oGdKMcziy X2PLl2Ex9d8+wKwtm/4KssMfomP00R8L52sz4cbIIKyEBWDTeSPQ6LEFjGiMgyyzJVJC ZUegchQjXx5bw5/43RikUoc00z36V2ZZfXT/dMKh0KRjYQYOlGlRkIZw/xEbyfeLmUFI V/jUtfuM+CtFAo2ZkhdcGFjKOGsb2Ty2I5HMbDdf0uFK2GJzMcgWxtWdVWBlmLShIAsv z3Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=U2wPRM09hQ2P6vn2DXhM56aNkn1Jb+fMZFW9zDLaAA4=; b=0UKd0vmuyvP5mu/amClGL6RK0UFcE15VNE+/uC1+aG0VWKKY5kmvUe7b6nisZ15VqV spBEA8Hr6KgGJfmmrzgFJe42EShIN6aAEuhy+u2Y85qkHv3FDHoLmjLVJTwYXSLp5sdo AREjz9j0gnVvLiVonz50N+hP6pqsHjEwGJfjIU9/kesmb1T8xaY5Ur8mPF9i+VefW4VU /douaggjYIAeo+bgnXsGX4ULco2bzEVFUES0QL7sN7EaYBWk9Jt2g1tl1h8l1WDqiA2h IEl/VV6Xk0WSKH7f4Re/qwpD5BSqS3rujWzzWgJpc7VWdEAYcD/QT/JfWif+Dea2JCzE b3kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=eVRKArNd; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id z23-20020aa7cf97000000b0043565c5a2fbsi19601340edx.89.2022.07.19.23.36.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 23:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=eVRKArNd; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 778593858439 for ; Wed, 20 Jul 2022 06:36:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 778593858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658298996; bh=U2wPRM09hQ2P6vn2DXhM56aNkn1Jb+fMZFW9zDLaAA4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eVRKArNdUWz4S1QifF8wTIKvQg1F6b/R+Y9237cSJF/4gejA6Q+pGHMHuY1tatTWs IR/WhRlodmBLwq4tRf26Tab4H/b9ExZ95LT070O5uwUzCNKsn7AbfPZfpuLHfoGInS PEkNxN5kY8MkQlzcowEPlhVQsHi3h6rt0NoVxpPY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from magnesium.8pit.net (magnesium.8pit.net [45.76.88.171]) by sourceware.org (Postfix) with ESMTPS id 8AF973858C62; Wed, 20 Jul 2022 06:35:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8AF973858C62 Received: from localhost (p200300f5ff05aa004976b5c8ece01b6c.dip0.t-ipconnect.de [2003:f5:ff05:aa00:4976:b5c8:ece0:1b6c]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 73892c48 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Wed, 20 Jul 2022 08:35:51 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libgo: make match.sh POSIX-shell compatible Date: Wed, 20 Jul 2022 08:35:41 +0200 Message-Id: <20220720063541.5546-1-soeren@soeren-tempel.net> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: soeren--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: soeren@soeren-tempel.net Cc: iant@golang.org, gofrontend-dev@googlegroups.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738852529659848025?= X-GMAIL-MSGID: =?utf-8?q?1738852529659848025?= From: Sören Tempel The `(( expression ))` syntax is a Bash extension and not supported by POSIX shell [1]. However, the arithmetic expressions used by the gobuild() function can also be expressed using arithmetic POSIX expansions with `$(( expression ))` [2]. Contrary to the Bash extension, arithmetic expansion doesn't set the return value if the expression is non-zero but instead just prints the expression result. Hence, the expression also needs to be negated. Without this patch, match.sh does currently not work correctly if /bin/sh is not a symlink to Bash. [1]: https://www.gnu.org/software/bash/manual/bash.html#Conditional-Constructs [2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04 Signed-off-by: Sören Tempel --- libgo/match.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgo/match.sh b/libgo/match.sh index 7ed587ff794..9fbb498544c 100755 --- a/libgo/match.sh +++ b/libgo/match.sh @@ -111,7 +111,7 @@ gobuild() { if test "$goarch" != "386"; then line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g") fi - (($line)) + return $((!(line))) } matched=