aboutsummaryrefslogtreecommitdiffstats
path: root/main/bzip2/bzip2-1.0.4-POSIX-shell.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/bzip2/bzip2-1.0.4-POSIX-shell.patch')
-rw-r--r--main/bzip2/bzip2-1.0.4-POSIX-shell.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/main/bzip2/bzip2-1.0.4-POSIX-shell.patch b/main/bzip2/bzip2-1.0.4-POSIX-shell.patch
new file mode 100644
index 0000000000..74f8df000b
--- /dev/null
+++ b/main/bzip2/bzip2-1.0.4-POSIX-shell.patch
@@ -0,0 +1,21 @@
+bzgrep uses !/bin/sh but then uses the bashism ${var//} so replace those
+with calls to sed so POSIX shells work
+
+http://bugs.gentoo.org/193365
+
+--- a/bzgrep
++++ b/bzgrep
+@@ -63,10 +63,9 @@
+ bzip2 -cdfq "$i" | $grep $opt "$pat"
+ r=$?
+ else
+- j=${i//\\/\\\\}
+- j=${j//|/\\|}
+- j=${j//&/\\&}
+- j=`printf "%s" "$j" | tr '\n' ' '`
++ # the backslashes here are doubled up as we have to escape each one for the
++ # shell and then escape each one for the sed expression
++ j=`printf "%s" "${i}" | sed -e 's:\\\\:\\\\\\\\:g' -e 's:[|]:\\\\|:g' -e 's:[&]:\\\\&:g' | tr '\n' ' '`
+ bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
+ r=$?
+ fi