gzip/gzip-1.3.12-can_2004_0970.patch

43 lines
1.2 KiB
Diff

--- gzip-1.3.12/znew.in 2007-03-30 00:38:48.000000000 +0200
+++ gzip-1.3.12-fix/znew.in 2007-04-18 21:44:01.000000000 +0200
@@ -55,28 +55,24 @@
# block is the disk block size (best guess, need not be exact)
warn="(does not preserve modes and timestamp)"
-tmp=${TMPDIR-/tmp}/zfoo.$$
-set -C
-echo hi > $tmp || exit
-if test -z "`(${CPMOD-cpmod} $tmp $tmp) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
+cpmod=
+cpmodarg=
+if type ${CPMOD:-cpmod} 2>/dev/null; then
+ cpmod=${CPMOD:-cpmod}
warn=""
fi
-if test -z "$cpmod" && ${TOUCH-touch} -r $tmp $tmp 2>/dev/null; then
- cpmod="${TOUCH-touch}"
+if test -z "$cpmod"; then
+ cpmod="${TOUCH:-touch}"
cpmodarg="-r"
warn="(does not preserve file modes)"
fi
-# check if GZIP env. variable uses -S or --suffix
-gzip -q $tmp
-ext=`echo $tmp* | sed "s|$tmp||"`
-rm -f $tmp*
-if test -z "$ext"; then
- echo znew: error determining gzip extension
- exit 1
-fi
+case "$GZIP" in
+ *-S*) ext=`echo "$GZIP" | sed 's/^.*-S[[:space:]]*\([^[:space:]]*\).*$/\1/'`;;
+ *-suffix*) ext=`echo "$GZIP" | sed 's/^.*--suffix=\([^[:space:]]*\).*$/\1/'`;;
+ *) ext='.gz';;
+esac
if test "$ext" = ".Z"; then
echo znew: cannot use .Z as gzip extension.
exit 1