On Tue, Jul 19, 2022 at 11:35 PM <soe...@soeren-tempel.net> wrote: > > From: Sören Tempel <soe...@soeren-tempel.net> > > 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
Thanks. Committed as follows, which also fixes the similar function in the gotest script. Ian
dbf607d2e92cbae9a7f7620b69b9272adbce6381 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 5ea0406cd8e..2f2fafde1f1 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -ff68b1a147eb60082fd60c198db0ef5477ade938 +a62f20ae78ddd41be682dde8cab075ca4f5dbb2a The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/match.sh b/libgo/match.sh index 7ed587ff794..e5ed98de422 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 04e4267fbba..0a0a7e14d74 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