aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-07-11 23:24:29 +0200
committerMark Wielaard <mark@klomp.org>2019-07-11 23:24:29 +0200
commitf7d209bfde37cf337f769531f9c7a29b8bb6ae7f (patch)
tree6a72d122b4a7558a8ba8b779c93cf3ba077df8bb
parentd50cc4b0e700f8f8285b02d28db595e805e3b627 (diff)
downloadbzip2-f7d209bfde37cf337f769531f9c7a29b8bb6ae7f.tar.gz
bzip2-f7d209bfde37cf337f769531f9c7a29b8bb6ae7f.tar.bz2
bzip2-f7d209bfde37cf337f769531f9c7a29b8bb6ae7f.zip
fix bzdiff when TMPDIR contains spaces
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>
-rwxr-xr-x[-rw-r--r--]bzdiff16
1 files changed, 8 insertions, 8 deletions
diff --git a/bzdiff b/bzdiff
index 6fc38f9..bd96c27 100644..100755
--- a/bzdiff
+++ b/bzdiff
@@ -37,10 +37,6 @@ if test -z "$FILES"; then
37 echo "Usage: $prog [${comp}_options] file [file]" 37 echo "Usage: $prog [${comp}_options] file [file]"
38 exit 1 38 exit 1
39fi 39fi
40tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
41 echo 'cannot create a temporary file' >&2
42 exit 1
43}
44set $FILES 40set $FILES
45if test $# -eq 1; then 41if test $# -eq 1; then
46 FILE=`echo "$1" | sed 's/.bz2$//'` 42 FILE=`echo "$1" | sed 's/.bz2$//'`
@@ -53,10 +49,14 @@ elif test $# -eq 2; then
53 case "$2" in 49 case "$2" in
54 *.bz2) 50 *.bz2)
55 F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` 51 F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
56 bzip2 -cdfq "$2" > $tmp 52 tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
57 bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp 53 echo 'cannot create a temporary file' >&2
54 exit 1
55 }
56 bzip2 -cdfq "$2" > "$tmp"
57 bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
58 STAT="$?" 58 STAT="$?"
59 /bin/rm -f $tmp;; 59 /bin/rm -f "$tmp";;
60 60
61 *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" 61 *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
62 STAT="$?";; 62 STAT="$?";;
@@ -69,8 +69,8 @@ elif test $# -eq 2; then
69 STAT="$?";; 69 STAT="$?";;
70 esac;; 70 esac;;
71 esac 71 esac
72 exit "$STAT"
73else 72else
74 echo "Usage: $prog [${comp}_options] file [file]" 73 echo "Usage: $prog [${comp}_options] file [file]"
75 exit 1 74 exit 1
76fi 75fi
76exit "$STAT"