From e1221d23193d233e7a2b518846458adecc5272df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 19 Feb 2010 20:50:09 +0100 Subject: tests: exercise the fix for the decompression data-loss bug * tests/null-suffix-clobber: New file. * Makefile.am (TESTS): Add it. --- tests/null-suffix-clobber | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 tests/null-suffix-clobber (limited to 'tests/null-suffix-clobber') 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 . +# 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 -- cgit v1.2.1