diff options
author | Mark Wielaard <mark@klomp.org> | 2019-07-11 23:24:29 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-07-11 23:24:29 +0200 |
commit | f7d209bfde37cf337f769531f9c7a29b8bb6ae7f (patch) | |
tree | 6a72d122b4a7558a8ba8b779c93cf3ba077df8bb | |
parent | d50cc4b0e700f8f8285b02d28db595e805e3b627 (diff) | |
download | bzip2-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--] | bzdiff | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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 |
39 | fi | 39 | fi |
40 | tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || { | ||
41 | echo 'cannot create a temporary file' >&2 | ||
42 | exit 1 | ||
43 | } | ||
44 | set $FILES | 40 | set $FILES |
45 | if test $# -eq 1; then | 41 | if 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" | ||
73 | else | 72 | else |
74 | echo "Usage: $prog [${comp}_options] file [file]" | 73 | echo "Usage: $prog [${comp}_options] file [file]" |
75 | exit 1 | 74 | exit 1 |
76 | fi | 75 | fi |
76 | exit "$STAT" | ||