Subject: bug#10575: "compress" not found: causes many test failures

From: Stefano Lattarini <[email-masked]>
Date: Sun, 22 Jan 2012 10:10:49 +0100

Hi Jim, thanks for the report.

On 01/21/2012 10:17 PM, Jim Meyering wrote:
> On master a few days ago I noticed new test failures on a
> Fedora 16 system, due to the unprotected use of compress.
> 
> In tests/dist-formats.tap, I read this:
> 
>     # Assume gzip(1) and compress(1) are available on every reasonable
>     # portability target.
> 
> Of course, I could install it with a simple "yum install ncompress",
> but the point is that compress is not installed by default.
> That tool is becoming anachronistic.
> 
The attached patch should fix it.  I will push it by this evening if
there is no objection (and if you have time to give it a try, that would
be great).

Thanks,
  Stefano
>From 50d5ef104a889520aa8bbd14f42dbc8708771681 Mon Sep 17 00:00:00 2001
Message-Id: <50d5ef104[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Sun, 22 Jan 2012 10:06:24 +0100
Subject: [PATCH] dist tests: missing "compress" program was causing spurious
 failures

Fixes automake bug#10575.

The "compress" tool is becoming anachronistic, and thus is not
installed by default on modern distros (e.g., Fedora 16).  We
can't thus unconditionally assume it exists on every reasonable
portability target.

* tests/dist-formats.tap ($missing_compressors): When defining
this, don't assume anymore that compress(1) is unconditionally
available.
(Parallel compression): Skip this sub-test if compress(1) is
unavailable.
Since we are at it, fix a couple of unrelated buglets: a typo
in a test name (s/distcheck/ark-exists/), and some attempts to
remove directories with "rm -f".
---
 tests/dist-formats.tap |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tests/dist-formats.tap b/tests/dist-formats.tap
index 34399bc..dd9d896 100755
--- a/tests/dist-formats.tap
+++ b/tests/dist-formats.tap
@@ -75,12 +75,10 @@ all_compressors=`
   done | tr "$nl" ' '`
 echo All compressors: $all_compressors
 
-# Assume gzip(1) and compress(1) are available on every reasonable
-# portability target.
+# Assume gzip(1) is available on every reasonable portability target.
 missing_compressors=`
   for c in $all_compressors; do
-    test $c = compress || test $c = gzip || $c --version </dev/null >&2 \
-      && continue
+    test $c = gzip || $c --version </dev/null >&2 && continue
     echo $c
   done | tr "$nl" ' '`
 echo Missing compressors: $missing_compressors
@@ -147,7 +145,7 @@ can_compress ()
 
   command_ok_if_have_compressor "'make dist-$format' work by default" \
     eval '
-      rm -f *$tarname* \
+      rm -rf *$tarname* \
         && make dist-$format \
         && test -f $tarname-1.0.$suffix \
         && ls -l *$tarname* \
@@ -170,7 +168,7 @@ command_ok_ "default [make distcheck]"  $MAKE distcheck
 command_ok_ "'make dist' only builds *.tar.gz by default" \
             test "`ls *defaults*`" = defaults-1.0.tar.gz
 
-rm -f *defaults*
+rm -rf *defaults*
 
 for fmt in $all_compression_formats; do
   can_compress defaults $fmt
@@ -249,7 +247,7 @@ END
   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 [distcheck]" $MAKE check-ark-exists
+  command_ok_if_have_compressor "$desc [ark-exists]" $MAKE check-ark-exists
   command_ok_ "$desc [no .tar.gz]"  $MAKE check-no-tar-gz
 
   unset desc
@@ -310,6 +308,7 @@ check_tarball ()
 command_ok_ "$desc [automake]" $AUTOMAKE
 
 skip_reason=
+have_compressor compress || skip_reason="'compress' not available"
 have_compressor bzip2 || skip_reason="'bzip2' not available"
 if test "$MAKE_j4" = false; then
   test -z "$skip_reason" || skip_reason="$skip_reason and "
-- 
1.7.7.3