Subject: Re: gzip-1.9 released [stable]
From: Paul Eggert <[email-masked]>
To: Michael <[email-masked]>
Cc: [email-masked]
Date: Thu, 31 Mar 2022 16:53:30 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

>   +826  + eval 'env $i  zin.gz < $tmp_in > $tmp_out'
>   +827  ++ env zless zin.gz
>   +828  /data/prj/gnu/gzip/gzip-1.9/tests/../zless[71]: less:  not found
>   +829  + echo FAIL: zless
>   +830  FAIL: zless
>   +831  + fail=1

Thanks for reporting that. As 'less' is not required by POSIX we 
shouldn't assume it's installed. I installed the first attached patch to 
fix that (by not installing zless when 'less' is absent), and the second 
attached patch to fix a bug I found in the test cases for 'zmore' when I 
ran it with PAGER='less'.

q>   +891  FAIL: timestamp
>   +892  ===============
> This is to be expected - I expect - with 32-bit timestamp (OBJECT_MODE=32)

Yes, we don't worry about people perversely building a 32-bit time_t 
gzip on platforms that support 64-bit timestamps.

Recent versions of GNU/Linux have added support for 64-bit time_t even 
to platforms where 'long' and pointers are 32 bits.[1] Do recent 
versions of AIX have something similar? If so, we should teach Gnulib's 
year2038 module[2] how to enable that. This would fix this AIX problem 
for several GNU programs, not just gzip.

[1]: 
https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
[2]: 
https://www.gnu.org/software/gnulib/manual/html_node/Avoiding-the-year-2038-problem.html

From 2fa0edbe051634f33687572c68fefc150ca3d499 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 31 Mar 2022 15:57:10 -0700
Subject: [PATCH 1/2] zless: install only on platforms with 'less'

Problem reported by Michael Felt (Bug#30029).
* Makefile.am (ZLESS_MAN, ZLESS_PROG): New macros.
(man_MANS, bin_SCRIPTS): Use them.
* configure.ac: Check for 'less'.
* tests/Makefile.am (ZLESS_PROG): New macro.
(built_programs): Use it.
---
 Makefile.am       | 12 ++++++++++--
 NEWS              |  2 ++
 configure.ac      |  2 ++
 tests/Makefile.am |  8 +++++++-
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 92192ca..07f47a8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,8 +31,16 @@ noinst_LIBRARIES = libver.a
 nodist_libver_a_SOURCES = version.c version.h
 DISTCLEANFILES = version.c version.h
 
+if LESS
+ZLESS_MAN = zless.1
+ZLESS_PROG = zless
+else
+ZLESS_MAN =
+ZLESS_PROG =
+endif
+
 man_MANS = gunzip.1 gzexe.1 gzip.1 \
-  zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
+  zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 $(ZLESS_MAN) zmore.1 znew.1
 
 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
   ChangeLog-2007 \
@@ -49,7 +57,7 @@ noinst_HEADERS = gzip.h lzw.h
 
 bin_PROGRAMS = gzip
 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
-  zegrep zfgrep zforce zgrep zless zmore znew
+  zegrep zfgrep zforce zgrep $(ZLESS_PROG) zmore znew
 gzip_SOURCES = \
   bits.c deflate.c gzip.c inflate.c \
   trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
diff --git a/NEWS b/NEWS
index 05b4166..95ffe49 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ GNU gzip NEWS                                    -*- outline -*-
   much more time, nowadays the correctness pros seem to outweigh the
   performance cons.
 
+  'zless' is no longer installed on platforms lacking 'less'.
+
 ** Bug fixes
 
   'zdiff -C 5' no longer misbehaves by treating '5' as a file name.
diff --git a/configure.ac b/configure.ac
index 074d81a..d9c77da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,8 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CPP
 AC_PROG_GREP
+AC_CHECK_PROG([LESS], [less], [less])
+AM_CONDITIONAL([LESS], [test "$LESS"])
 AC_CHECK_TOOL([NM], [nm], [nm])
 AC_PROG_LN_S
 AC_PROG_RANLIB
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3b45afa..d09672e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,6 +46,12 @@ EXTRA_DIST =				\
   init.sh				\
   hufts-segv.gz
 
+if LESS
+ZLESS_PROG = zless
+else
+ZLESS_PROG =
+endif
+
 built_programs = \
   gzip		\
   gunzip	\
@@ -57,7 +63,7 @@ built_programs = \
   zfgrep	\
   zforce	\
   zgrep		\
-  zless		\
+  $(ZLESS_PROG)	\
   zmore		\
   znew
 
-- 
2.32.0

From b87f9617a1783c5f197fc91bad3f6cf7b2197bbf Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 31 Mar 2022 16:00:58 -0700
Subject: [PATCH 2/2] zmore: don't assume benign PAGER in testing

* tests/help-version (zmore_setup): Unset PAGER so that we test
'more', not whatever the tester has in its PAGER environment
variable.  This works around a problem I found when I ran
'PAGER=less make check' on a platform that lacked 'less'.
---
 tests/help-version | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/help-version b/tests/help-version
index f85cdff..300399f 100755
--- a/tests/help-version
+++ b/tests/help-version
@@ -143,7 +143,7 @@ zdiff_setup () { args="$zin $zin2"; }
 zcmp_setup () { zdiff_setup; }
 zcat_setup () { TERM=dumb; export TERM; args=$zin; }
 gunzip_setup () { zcat_setup; }
-zmore_setup () { zcat_setup; }
+zmore_setup () { unset PAGER; zcat_setup; }
 zless_setup () { zcat_setup; }
 znew_setup () { args=$bigZ_in; }
 zforce_setup () { zcat_setup; }
-- 
2.32.0