severity 15181 minor close 15181 stop (Reference: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15181)
Hi Andrea, thanks for the report and the patch, and sorry for the awful delay. On 08/24/2013 06:24 AM, Andrea Urbani wrote: > Good morning, > > gzip, lzip, bzip2, tar, xz can compress and decompress. > > zip is able just to compress. To decompress you need unzip. > During the tests of Automake 1.14, in particular t/dist-formats.tap, the > nogzip function called via > > nogzip in ac and zip in ac > > looks if zip is available and, if yes, tests the zip creation + unzip. > If in your system zip is installed but unzip no, you will have a FAIL like > the following: > > /bin/sh: line 14: unzip: command not found > make: *** [distcheck] Error 127 > + tap_result_='not ok' > + result_ 'not ok' -D '' -r '' -- 'ac=dist-zip,no-dist-gzip [distcheck]' > + set +x > not ok 45 - ac=dist-zip,no-dist-gzip [distcheck] > FAIL: t/dist-formats.tap 45 - ac=dist-zip,no-dist-gzip [distcheck] > > and so the final result of the "make check" operation will fail too. > > In my opinion the unzip should be skipped if no unzip is available. > Good point. In fact, I've managed to reproduce your issue (by faking a failing 'unzip' command). > == PATCH BEGIN ==================================================== > --- t/dist-formats.tap.orig 2013-06-19 11:29:50.000000000 +0200 > +++ t/dist-formats.tap 2013-08-24 07:12:42.000000000 +0200 > @@ -97,6 +97,33 @@ > fatal_ "have_compressor(): dead code reached" > } > > +have_decompressor () > +{ > + test $# -eq 1 || fatal_ "have_decompressor(): bad usage" > + case $1 in > + zip) > + # 2013-08-24 matfanjol > + # gzip, lzip, bzip2, tar, xz can compress and decompress. > + # zip is able just to compress. To decompress you need unzip. > + # Here I check if unzip is available. > + # I checked "Oracle Solaris 11" and "Fedora 19": "unzip -v" is > + # OK, "unzip --version" is NOT ok. > + if unzip -v </dev/null >&2; then > + return 0 > + else > + return 1 > + fi > + ;; > + *) > + # 2013-08-24 matfanjol > + # gzip, lzip, bzip2, tar, xz can compress and decompress. > + return 0 > + ;; > + esac > + fatal_ "have_decompressor(): dead code reached" > +} > + > + > all_compression_formats='gzip lzip xz bzip2 zip' > > all_compressors=$( > @@ -165,6 +192,20 @@ > fi > } > > +command_ok_if_have_compressor_and_decompressor () > +{ > + if have_compressor "$compressor"; then > + if have_decompressor "$compressor"; then > + command_ok_ "$@" > + else > + skip_ -r "decompressor for '$compressor' not available" "$1" > + fi > + else > + skip_ -r "'$compressor' not available" "$1" > + fi > +} > + > + > can_compress () > { > test $# -eq 2 || fatal_ "can_compress: bad number of arguments" > @@ -276,8 +317,8 @@ > command_ok_ "$desc [autoconf]" $AUTOCONF > command_ok_ "$desc [configure]" ./configure > command_ok_ "$desc [ark-name]" $MAKE check-ark-name > - command_ok_if_have_compressor "$desc [distcheck]" $MAKE distcheck > - command_ok_if_have_compressor "$desc [ark-exists]" $MAKE check-ark-exists > + command_ok_if_have_compressor_and_decompressor "$desc [distcheck]" $MAKE > distcheck > + command_ok_if_have_compressor_and_decompressor "$desc [ark-exists]" $MAKE > check-ark-exists > command_ok_ "$desc [no .tar.gz]" $MAKE check-no-tar-gz > > unset desc > == PATCH END ==================================================== > Thanks for the patch (it's always appreciated to receive one with a bug report!), but I've chose a slightly smaller and less invasive change to fix the issue (see attached patch). With that, all the checks involving either zip or unzip will be skipped on systems lacking unzip (even if they have zip); this is less granular than your approach, but this added coarseness is IMO worth the reduction in complexity. > Bye > Andrea > matfanjol > http://matfanjol.users.sourceforge.net/ > I'm marking this bug as solved. Thanks again, Stefano
>From 07bd3e6d252fb513828d04d884147384229acf67 Mon Sep 17 00:00:00 2001 Message-Id: <07bd3e6d252fb513828d04d884147384229acf67.1383094328.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Wed, 30 Oct 2013 00:51:25 +0000 Subject: [PATCH] tests: fix spurious failure when zip is present but unzip is not Fixes automake bug#15181. * t/dist-formats.tap (have_compressor): When checking that zip(1), also check for unzip(1), otherwise "make distcheck" will be unable to extract the zip tarball it creates, which will cause spurious failures. While at it, reorganize the existing code a bit. * THANKS, NEWS: Update. Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- NEWS | 2 +- THANKS | 1 + t/dist-formats.tap | 54 +++++++++++++++++++++++++++++------------------------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index 43640ed..5fc256b 100644 --- a/NEWS +++ b/NEWS @@ -118,7 +118,7 @@ New in 1.14.1: message on the most common invalid usages. - Several spurious failures/hangs in the testsuite (bugs #14706, #14707, - #14760, #14911, #15237). + #14760, #14911, #15181, #15237). * Documentation fixes: diff --git a/THANKS b/THANKS index 3adea7e..6be803e 100644 --- a/THANKS +++ b/THANKS @@ -17,6 +17,7 @@ Alexander Turbov za...@sendmail.ru Alexandre Duret-Lutz dure...@epita.fr Alexey Mahotkin al...@hsys.msk.ru Alfred M. Szmidt a...@gnu.org +Andrea Urbani matfan...@mail.com Andreas Bergmeier lcid-f...@gmx.net Andreas Buening andreas.buen...@nexgo.de Andreas Köhler andi5...@gmx.net diff --git a/t/dist-formats.tap b/t/dist-formats.tap index 49281d9..3c9e621 100644 --- a/t/dist-formats.tap +++ b/t/dist-formats.tap @@ -67,34 +67,38 @@ setup_vars_for_compression_format () have_compressor () { test $# -eq 1 || fatal_ "have_compressor(): bad usage" - case $1 in + if test $1 = gzip; then # Assume gzip(1) is available on every reasonable portability target. - gzip) - return 0;; - *) - case $1 in - # Do not use --version, or older versions bzip2 would try to - # compress stdin. This would cause binary output in the test - # logs, with potential breakage of our testsuite harness. - bzip2) o=--help;; - # OpenSolaris zip do not support the '--version' option, but - # accepts the '-v' one with a similar meaning (if no further - # arguments are given). - zip) o=-v;; - # Assume the other compressors we care about support the - # '--version' option. - *) o=--version;; - esac - # Redirect to stderr to avoid polluting the output, in case this - # function is used in a command substitution (as it is, below). - if $1 $o </dev/null >&2; then - return 0 - else - return 1 - fi + return 0 + fi + needed_programs=$1 + # Assume by default the other compressors we care about support the + # '--version' option. We'll special-case the one which don't. + checker_option=--version + case $1 in + bzip2) + # Do not use --version, or older versions bzip2 would try to + # compress stdin. This would cause binary output in the test + # logs, with potential breakage of our testsuite harness. + checker_option=--help + ;; + zip) + # OpenSolaris zip do not support the '--version' option, but + # accepts the '-v' one with a similar meaning (if no further + # arguments are given). + checker_option=-v + # Also, we need 'unzip' to decompress the created zipped archives + # (bug#15181). + needed_programs='zip unzip' ;; esac - fatal_ "have_compressor(): dead code reached" + # Redirect to stderr to avoid polluting the output, in case this + # function is used in a command substitution (as it is, later in + # this script). + for p in $needed_programs; do + $p $checker_option </dev/null >&2 || return 1 + done + return 0 } all_compression_formats='gzip lzip xz bzip2 zip' -- 1.8.3.1.605.g85318f5