tests: fix racy compress test
Version: 1.31-4
This commit is contained in:
parent
fdf7d97dc8
commit
cb70a1eb89
271
tar-1.31-racy-compress-tests.patch
Normal file
271
tar-1.31-racy-compress-tests.patch
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
From 9af3ae33108e5a1d281d75d29938fe8c6ffcd218 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergey Poznyakoff <gray@gnu.org>
|
||||||
|
Date: Mon, 14 Jan 2019 18:08:21 +0200
|
||||||
|
Subject: [PATCH] Fix compression tests
|
||||||
|
|
||||||
|
Existing compression tests used tar with compiled-in defaults. However,
|
||||||
|
some of the defaults are sure to create archives that are not byte-to-byte
|
||||||
|
reproducible (e.g. DEFAULT_ARCHIVE_FORMAT=POSIX, because the name field
|
||||||
|
in posix extended headers uses PID of the creating process by default).
|
||||||
|
Moreover, some compressors (e.g. gzip) store current timestamp in
|
||||||
|
the file header when compressing from stdin, so that using cmp on the
|
||||||
|
two created archives as the tests did is error-prone. Another problem
|
||||||
|
is that the tests implicitly assumed that tar uses archive suffix to
|
||||||
|
recognize its format when extracting, which isn't the case. Finally,
|
||||||
|
there's hardly any reason in using sed to create m4 sources, when
|
||||||
|
everything can be achieved by m4 itself.
|
||||||
|
|
||||||
|
* tests/Makefile.am: Remove generation of compress-*.at files.
|
||||||
|
* tests/compress.at.in: Remove.
|
||||||
|
* tests/compress.m4: New file.
|
||||||
|
* tests/testsuite.at: Include compress.m4, use TAR_CHECK_COMPRESS to
|
||||||
|
check compression options.
|
||||||
|
---
|
||||||
|
tests/Makefile.am | 45 ++---------------------------
|
||||||
|
tests/compress.at.in | 67 --------------------------------------------
|
||||||
|
tests/compress.m4 | 56 ++++++++++++++++++++++++++++++++++++
|
||||||
|
tests/testsuite.at | 13 +++++----
|
||||||
|
4 files changed, 65 insertions(+), 116 deletions(-)
|
||||||
|
delete mode 100644 tests/compress.at.in
|
||||||
|
create mode 100644 tests/compress.m4
|
||||||
|
|
||||||
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||||
|
index 4750acb..a29f626 100644
|
||||||
|
--- a/tests/Makefile.am
|
||||||
|
+++ b/tests/Makefile.am
|
||||||
|
@@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
EXTRA_DIST = $(TESTSUITE_AT) \
|
||||||
|
testsuite package.m4 star/README star/quicktest.sh \
|
||||||
|
- compress.at.in
|
||||||
|
+ compress.m4
|
||||||
|
|
||||||
|
DISTCLEANFILES = atconfig $(check_SCRIPTS)
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
|
||||||
|
@@ -47,6 +47,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
|
||||||
|
|
||||||
|
TESTSUITE_AT = \
|
||||||
|
testsuite.at\
|
||||||
|
+ compress.m4\
|
||||||
|
T-cd.at\
|
||||||
|
T-dir00.at\
|
||||||
|
T-dir01.at\
|
||||||
|
@@ -70,12 +71,6 @@ TESTSUITE_AT = \
|
||||||
|
chtype.at\
|
||||||
|
comprec.at\
|
||||||
|
comperr.at\
|
||||||
|
- compress-zstd.at\
|
||||||
|
- compress-xz.at\
|
||||||
|
- compress-bzip2.at\
|
||||||
|
- compress-gzip.at\
|
||||||
|
- compress-lzip.at\
|
||||||
|
- compress-lzop.at\
|
||||||
|
delete01.at\
|
||||||
|
delete02.at\
|
||||||
|
delete03.at\
|
||||||
|
@@ -277,42 +272,6 @@ TESTSUITE_AT = \
|
||||||
|
selacl01.at\
|
||||||
|
capabs_raw01.at
|
||||||
|
|
||||||
|
-CLEANFILES += compress-zstd.at
|
||||||
|
-compress-zstd.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/zstd/g;s/@suff@/zst/g;s/@suff2@/tzst/g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
-CLEANFILES += compress-gzip.at
|
||||||
|
-compress-gzip.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/gzip/g;s/@suff@/gz/g;s/@suff2@/tgz/g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
-CLEANFILES += compress-xz.at
|
||||||
|
-compress-xz.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/xz/g;s/@suff@/xz/g;s/@suff2@/txz/g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
-CLEANFILES += compress-bzip2.at
|
||||||
|
-compress-bzip2.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/bzip2/g;s/@suff@/bz2/g;s/@suff2@/tbz2/g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
-CLEANFILES += compress-lzip.at
|
||||||
|
-compress-lzip.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/lzip/g;s/@suff@/lz/g;s/@suff2@//g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
-CLEANFILES += compress-lzop.at
|
||||||
|
-compress-lzop.at: compress.at.in
|
||||||
|
- $(AM_V_GEN)rm -rf $@ $@-t
|
||||||
|
- $(AM_V_at)sed 's/@tool@/lzop/g;s/@suff@/lzo/g;s/@suff2@//g;' \
|
||||||
|
- $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
|
||||||
|
-
|
||||||
|
distclean-local:
|
||||||
|
-rm -rf download
|
||||||
|
|
||||||
|
diff --git a/tests/compress.at.in b/tests/compress.at.in
|
||||||
|
deleted file mode 100644
|
||||||
|
index 91a6af2..0000000
|
||||||
|
--- a/tests/compress.at.in
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,67 +0,0 @@
|
||||||
|
-# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||||
|
-
|
||||||
|
-# Test suite for GNU tar.
|
||||||
|
-# Copyright 2018-2019 Free Software Foundation, Inc.
|
||||||
|
-
|
||||||
|
-# This file is part of GNU tar.
|
||||||
|
-
|
||||||
|
-# GNU tar 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.
|
||||||
|
-
|
||||||
|
-# GNU tar 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/>.
|
||||||
|
-
|
||||||
|
-# tar can create/decompress @tool@-compressed tarballs
|
||||||
|
-
|
||||||
|
-AT_SETUP([compress: @tool@])
|
||||||
|
-AT_KEYWORDS([compression @tool@])
|
||||||
|
-
|
||||||
|
-unset TAR_OPTIONS
|
||||||
|
-
|
||||||
|
-AT_CHECK([
|
||||||
|
-AT_GZIP_PREREQ([@tool@])
|
||||||
|
-
|
||||||
|
-touch empty
|
||||||
|
-# Create with --@tool@:
|
||||||
|
-tar --@tool@ -cf - empty 2>err > k.tar.@suff@ || exit 1
|
||||||
|
-test -s err && exit 1
|
||||||
|
-tar tf k.tar.@suff@ 2>err > out || exit 1
|
||||||
|
-test "$(cat out)" = empty || exit 1
|
||||||
|
-test -s err && exit 1
|
||||||
|
-
|
||||||
|
-# Ensure -ac works with an -f-specified .@suff@-suffixed name.
|
||||||
|
-tar -acf k2.tar.@suff@ empty 2>err > out || exit 1
|
||||||
|
-cmp k2.tar.@suff@ k.tar.@suff@ || exit 1
|
||||||
|
-test -s err && exit 1
|
||||||
|
-
|
||||||
|
-# Extraction: ensure the .@suff@ suffix is recognized.
|
||||||
|
-rm -f empty || exit 1
|
||||||
|
-tar xf k.tar.@suff@ 2>err > out || exit 1
|
||||||
|
-test -s err && exit 1
|
||||||
|
-test -f empty || exit 1
|
||||||
|
-
|
||||||
|
-if test -n '@suff2@'; then
|
||||||
|
- # Extraction: ensure the .@suff2@ suffix is also recognized.
|
||||||
|
- mv k.tar.@suff@ k.@suff2@ || exit 1
|
||||||
|
- rm -f empty
|
||||||
|
- tar xf k.@suff2@ 2>err > out || exit 1
|
||||||
|
- test -s err && exit 1
|
||||||
|
- test -f empty || exit 1
|
||||||
|
-else
|
||||||
|
- :
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-],
|
||||||
|
-[0],
|
||||||
|
-[],
|
||||||
|
-[],
|
||||||
|
-[],[])
|
||||||
|
-
|
||||||
|
-AT_CLEANUP
|
||||||
|
diff --git a/tests/compress.m4 b/tests/compress.m4
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1f22632
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/compress.m4
|
||||||
|
@@ -0,0 +1,56 @@
|
||||||
|
+# This file is part of GNU tar testsuite. -*- Autotest -*-
|
||||||
|
+# Copyright 2018-2019 Free Software Foundation, Inc.
|
||||||
|
+#
|
||||||
|
+# GNU tar 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.
|
||||||
|
+#
|
||||||
|
+# GNU tar 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/>.
|
||||||
|
+
|
||||||
|
+dnl TAR_CHECK_COMPRESS(TOOL, SUF[, SUF2])
|
||||||
|
+dnl Tests whether tar can create archives using TOOL (i.e. using the --TOOL
|
||||||
|
+dnl command line option). SUF and optional SUF2 are suffixes for created
|
||||||
|
+dnl archives (without leading dot). Tar should be able to use TOOL to
|
||||||
|
+dnl automatically decompress archives with names ending on these suffixes.
|
||||||
|
+m4_define([TAR_CHECK_COMPRESS],
|
||||||
|
+[AT_SETUP([compress: $1])
|
||||||
|
+AT_KEYWORDS([compression compress-$1 $1])
|
||||||
|
+
|
||||||
|
+AT_CHECK([
|
||||||
|
+AT_GZIP_PREREQ($1)
|
||||||
|
+unset TAR_OPTIONS
|
||||||
|
+
|
||||||
|
+touch empty
|
||||||
|
+set -e
|
||||||
|
+: create with --$1
|
||||||
|
+tar --$1 -cf k.tar.$2 empty
|
||||||
|
+tar tf k.tar.$2
|
||||||
|
+
|
||||||
|
+m4_foreach([SUF], m4_quote(m4_shift($@)),
|
||||||
|
+[
|
||||||
|
+echo testing .SUF
|
||||||
|
+tar -acf k2.tar.SUF empty
|
||||||
|
+cat k2.tar.SUF | $1 -d > k.SUF.tar
|
||||||
|
+tar tf k.SUF.tar
|
||||||
|
+])
|
||||||
|
+
|
||||||
|
+# Extraction: ensure compressed format is correctly recognized
|
||||||
|
+rm -f empty
|
||||||
|
+tar xf k.tar.$2
|
||||||
|
+test -f empty
|
||||||
|
+],
|
||||||
|
+[0],
|
||||||
|
+[empty
|
||||||
|
+m4_foreach([SUF],m4_quote(m4_shift($@)),[testing .SUF
|
||||||
|
+empty
|
||||||
|
+])])
|
||||||
|
+
|
||||||
|
+AT_CLEANUP
|
||||||
|
+])
|
||||||
|
diff --git a/tests/testsuite.at b/tests/testsuite.at
|
||||||
|
index f751bcf..ce25c96 100644
|
||||||
|
--- a/tests/testsuite.at
|
||||||
|
+++ b/tests/testsuite.at
|
||||||
|
@@ -217,13 +217,14 @@ m4_include([opcomp05.at])
|
||||||
|
m4_include([opcomp06.at])
|
||||||
|
|
||||||
|
AT_BANNER([Compression])
|
||||||
|
-m4_include([compress-gzip.at])
|
||||||
|
-m4_include([compress-bzip2.at])
|
||||||
|
-m4_include([compress-xz.at])
|
||||||
|
+m4_include([compress.m4])
|
||||||
|
+TAR_CHECK_COMPRESS(gzip, gz, tgz)
|
||||||
|
+TAR_CHECK_COMPRESS(bzip2, bz2, tbz2)
|
||||||
|
+TAR_CHECK_COMPRESS(xz, xz, txz)
|
||||||
|
dnl: omit lzma, because it would fail due to magic number mismatch
|
||||||
|
-m4_include([compress-lzip.at])
|
||||||
|
-m4_include([compress-lzop.at])
|
||||||
|
-m4_include([compress-zstd.at])
|
||||||
|
+TAR_CHECK_COMPRESS(lzip, lz)
|
||||||
|
+TAR_CHECK_COMPRESS(lzop, lzo)
|
||||||
|
+TAR_CHECK_COMPRESS(zstd, zst, tzst)
|
||||||
|
|
||||||
|
AT_BANNER([Positional options])
|
||||||
|
m4_include([positional01.at])
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
6
tar.spec
6
tar.spec
@ -5,7 +5,7 @@ Summary: A GNU file archiving program
|
|||||||
Name: tar
|
Name: tar
|
||||||
Epoch: 2
|
Epoch: 2
|
||||||
Version: 1.31
|
Version: 1.31
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/tar/
|
URL: http://www.gnu.org/software/tar/
|
||||||
|
|
||||||
@ -19,6 +19,7 @@ Patch3: tar-1.29-wildcards.patch
|
|||||||
Patch4: tar-1.28-atime-rofs.patch
|
Patch4: tar-1.28-atime-rofs.patch
|
||||||
Patch9: tar-1.28-document-exclude-mistakes.patch
|
Patch9: tar-1.28-document-exclude-mistakes.patch
|
||||||
Patch10: tar-1.31-dirrem-tests.patch
|
Patch10: tar-1.31-dirrem-tests.patch
|
||||||
|
Patch11: tar-1.31-racy-compress-tests.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: autoconf automake texinfo gettext libacl-devel
|
BuildRequires: autoconf automake texinfo gettext libacl-devel
|
||||||
@ -112,6 +113,9 @@ make check || (
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 04 2019 Pavel Raiskup <praiskup@redhat.com> - 1.31-4
|
||||||
|
- fix racy compress: gzip test
|
||||||
|
|
||||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.31-3
|
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.31-3
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user