summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-02-19 20:50:09 +0100
committerJim Meyering <meyering@redhat.com>2010-02-22 14:42:54 +0100
commite1221d23193d233e7a2b518846458adecc5272df (patch)
tree7181d1b066573b0ecf047b88a6e82c63372a2e80 /tests
parent884ef6d16c66835640cf0b3539a53e95cfed059c (diff)
downloadgzip-e1221d23193d233e7a2b518846458adecc5272df.tar.gz
tests: exercise the fix for the decompression data-loss bug
* tests/null-suffix-clobber: New file. * Makefile.am (TESTS): Add it.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/null-suffix-clobber41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/null-suffix-clobber b/tests/null-suffix-clobber
new file mode 100755
index 0000000..e5b52a1
--- /dev/null
+++ b/tests/null-suffix-clobber
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Before gzip-1.5, gzip -d -S '' k.gz would delete F.gz and not create "F"
+
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# limit so don't run it by default.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ gzip --version
+fi
+
+: ${srcdir=.}
+. "$srcdir/tests/init.sh"
+
+printf anything | gzip > F.gz || framework_failure
+echo y > yes || framework_failure
+echo "gzip: invalid suffix ''" > expected-err || framework_failure
+
+fail=0
+
+gzip ---presume-input-tty -d -S '' F.gz < yes > out 2>err && fail=1
+
+compare out /dev/null || fail=1
+compare err expected-err || fail=1
+
+test -f F.gz || fail=1
+
+Exit $fail