public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: bzip2-devel@sourceware.org
Cc: "Anibal Monsalve Salazar" <anibal@debian.org>,
	"Santiago Ruano Rincón" <santiago@debian.org>,
	"Anthony Fok" <foka@debian.org>,
	"Vincent Lefevre" <vincent@vinc17.org>,
	"Mark Wielaard" <mark@klomp.org>
Subject: [PATCH] fix bzdiff when TMPDIR contains spaces
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190711232910.19290-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 Debian.
Please let us know if we missed some others.

Thanks,

Mark

The bzdiff script doesn't contain enough quotes, so that it doesn't
work if the TMPDIR environment variable is defined and contains
spaces.

https://bugs.debian.org/493710
Author: Vincent Lefevre <vincent@vinc17.org>
---
 bzdiff | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 bzdiff

diff --git a/bzdiff b/bzdiff
old mode 100644
new mode 100755
index 6fc38f9..bd96c27
--- a/bzdiff
+++ b/bzdiff
@@ -37,10 +37,6 @@ if test -z "$FILES"; then
 	echo "Usage: $prog [${comp}_options] file [file]"
 	exit 1
 fi
-tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
-      echo 'cannot create a temporary file' >&2
-      exit 1
-}
 set $FILES
 if test $# -eq 1; then
 	FILE=`echo "$1" | sed 's/.bz2$//'`
@@ -53,10 +49,14 @@ elif test $# -eq 2; then
                 case "$2" in
 	        *.bz2)
 			F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
-                        bzip2 -cdfq "$2" > $tmp
-                        bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
+			tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
+			      echo 'cannot create a temporary file' >&2
+			      exit 1
+			}
+                        bzip2 -cdfq "$2" > "$tmp"
+                        bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
                         STAT="$?"
-			/bin/rm -f $tmp;;
+			/bin/rm -f "$tmp";;
 
                 *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
                         STAT="$?";;
@@ -69,8 +69,8 @@ elif test $# -eq 2; then
                         STAT="$?";;
                 esac;;
 	esac
-        exit "$STAT"
 else
 	echo "Usage: $prog [${comp}_options] file [file]"
 	exit 1
 fi
+exit "$STAT"
-- 
2.20.1

                 reply	other threads:[~2019-07-11 23:29 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=20190711232910.19290-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=anibal@debian.org \
    --cc=bzip2-devel@sourceware.org \
    --cc=foka@debian.org \
    --cc=santiago@debian.org \
    --cc=vincent@vinc17.org \
    /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).