summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorIsmael Luceno2022-09-21 23:50:15 +0200
committerIsmael Luceno2022-09-23 16:01:05 +0200
commit82a6b87ad15075659fed10f8c4fc662d78a6cbad (patch)
tree75c7b975ed8e850a418f19ec3bc930156853bd44 /gnu
parent385efa9a29d4d23f6e93e7f36db2ffca9c4e6887 (diff)
gcc: Fix bashism in libgo/match.sh
Diffstat (limited to 'gnu')
-rw-r--r--gnu/gcc/HISTORY4
-rw-r--r--gnu/gcc/patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch28
2 files changed, 32 insertions, 0 deletions
diff --git a/gnu/gcc/HISTORY b/gnu/gcc/HISTORY
index 32bfb1a471..d1e608a32a 100644
--- a/gnu/gcc/HISTORY
+++ b/gnu/gcc/HISTORY
@@ -1,3 +1,7 @@
+2022-09-23 Ismael Luceno <ismael@sourcemage.org>
+ * patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch:
+ fixed bashism in libgo/match.sh
+
2022-08-19 Treeve Jelbert <treeve@sourcemage.org>
* DETAILS: version 12.2.0
* 0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch: deleted
diff --git a/gnu/gcc/patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch b/gnu/gcc/patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch
new file mode 100644
index 0000000000..84bca89db5
--- /dev/null
+++ b/gnu/gcc/patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch
@@ -0,0 +1,28 @@
+From 75a430f66760802bf1ac5afcd716613e3cf8c77d Mon Sep 17 00:00:00 2001
+From: Sören Tempel <soeren+git@soeren-tempel.net>
+Date: Tue, 19 Jul 2022 07:15:25 +0200
+Subject: [PATCH] libgo: make match.sh POSIX-shell compatible
+
+The `(( expression ))` syntax is a Bash extension. However, the
+arithmetic expressions used by the gobuild() function can also
+be expressed using Arithmetic POSIX Expansion with `$(( expression ))`.
+Contrary to the Bash expression, the 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.
+---
+ libgo/match.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libgo/match.sh b/libgo/match.sh
+index 7ed587ff794..b355d47429a 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=