From a62f20ae78ddd41be682dde8cab075ca4f5dbb2a Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <iant@golang.org>
Date: Fri, 22 Jul 2022 11:38:20 -0700
Subject: [PATCH] libgo: use POSIX shell arithmetic expansion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Avoid bash-specific ((expression)) syntax.  As the bash syntax
converts a non-zero value to a zero status (and a zero value to a 1
status), and POSIX arithmetic expansion does not, we have to negate
the result.

Based on patch by Sören Tempel.

Change-Id: I4c64fa15de3994a1a5c7c5ec0de6a82ddd858917
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/419154
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
---
 libgo/match.sh         | 2 +-
 libgo/testsuite/gotest | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgo/match.sh b/libgo/match.sh
index 7ed587ff..e5ed98de 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=
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
index 04e4267f..0a0a7e14 100755
--- a/libgo/testsuite/gotest
+++ b/libgo/testsuite/gotest
@@ -302,7 +302,7 @@ gobuild() {
     if test "$goarch" != "386"; then
 	line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g")
     fi
-    (($line))
+    return $((!($line)))
 }
 
 case "x$gofiles" in