public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: bzip2-devel@sourceware.org
Cc: "Martin Pluskal" <mpluskal@suse.com>,
	"Bjørn Lie" <bjorn.lie@gmail.com>,
	"Kristýna Streitová" <kstreitova@suse.com>,
	Led <ledest@gmail.com>, "Mark Wielaard" <mark@klomp.org>
Subject: [PATCH] Fix bashism in bzgrep
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190711233500.19408-1-mark@klomp.org> (raw)

Hi,

bzip2 lost its domain and got a new home at https://sourceware.org/bzip2/
It also didn't see a release for a very long time. Causing various patches
used by distros to not have been integrated upstream. We are trying to
collect them all and do a new release.

The following patch comes from openSUSE.
Please let us know if we missed some others.

Thanks,

Mark

bzgrep uses ${var//} which is a bashism.
Replace by calling sed so other POSIX shells work.

Patch from openSUSE by Led <ledest@gmail.com>
---
 bzgrep | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/bzgrep b/bzgrep
index 9a04b83..5080afd 100644
--- a/bzgrep
+++ b/bzgrep
@@ -63,9 +63,7 @@ for i do
     bzip2 -cdfq "$i" | $grep $opt "$pat"
     r=$?
   else
-    j=${i//\\/\\\\}
-    j=${j//|/\\|}
-    j=${j//&/\\&}
+    j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
     j=`printf "%s" "$j" | tr '\n' ' '`
     bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
     r=$?
-- 
2.20.1

                 reply	other threads:[~2019-07-11 23:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711233500.19408-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=bjorn.lie@gmail.com \
    --cc=bzip2-devel@sourceware.org \
    --cc=kstreitova@suse.com \
    --cc=ledest@gmail.com \
    --cc=mpluskal@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).