Subject: bug#16876: closed (Re: bug#16876: Zutils vs single compressor utilities)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 04 Apr 2022 19:03:02 +0000

Your bug report

#16876: Zutils vs single compressor utilities

which was filed against the gzip package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
16876: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16876
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#16876: Zutils vs single compressor utilities
From: Paul Eggert <[email-masked]>
To: Dagobert Michelsen <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Mon, 4 Apr 2022 12:01:47 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 2/25/14 11:40, Paul Eggert wrote:
> On 02/25/2014 01:47 AM, Dagobert Michelsen wrote:
>> Shouldn’t the transformation be
>> applied to all occurrences?
> Yes, I think it should.

After eight years I got around to implementing this (since nobody else 
wanted to :-) and installed the attached. Something like this should 
appear in the next gzip release.

From a3e925f6a6aadce093e5abd17dd313379d7c5bf8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Mon, 4 Apr 2022 10:51:24 -0700
Subject: [PATCH 1/3] build: support --program-prefix etc.

Problem reported by Antonio Diaz Diaz via Dagobert Michelsen in:
https://bugs.gnu.org/16876
* Makefile.am (.in): Substitute for 'gzip', 'zdiff', 'zgrep'.
($(GZIP_TRANSFORMED), $(ZDIFF_TRANSFORMED), $(ZGREP_TRANSFORMED)):
New rules to build forwarding shell scripts, if needed.
Add these files to BUILT_SOURCES and MOSTLY_CLEANFILES if needed.
* configure.ac (GZIP_TRANSFORMED, ZDIFF_TRANSFORMED, ZGREP_TRANSFORMED):
New substituted vars.
(GZIP_IS_TRANSFORMED, ZDIFF_IS_TRANSFORMED, ZGREP_IS_TRANSFORMED):
New Automake conditions.
* gunzip.in, gzexe.in, zcat.in, zcmp.in, zdiff.in, zegrep.in:
* zfgrep.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in:
Quote possibly-transformed subcommand names.
---
 Makefile.am  | 37 ++++++++++++++++++++++++++++++++++++-
 NEWS         |  2 ++
 configure.ac | 10 ++++++++++
 gunzip.in    |  2 +-
 gzexe.in     |  8 ++++----
 zcat.in      |  2 +-
 zcmp.in      |  2 +-
 zdiff.in     | 16 ++++++++--------
 zegrep.in    |  2 +-
 zfgrep.in    |  2 +-
 zforce.in    |  2 +-
 zgrep.in     |  2 +-
 zless.in     |  2 +-
 zmore.in     |  2 +-
 znew.in      |  8 ++++----
 15 files changed, 73 insertions(+), 26 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 07f47a8..4f51b61 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,9 +92,12 @@ gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
 SUFFIXES = .in
 .in:
 	$(AM_V_GEN)rm -f $@-t $@ \
-          && sed \
+	  && sed \
 		-e 's|/bin/sh|$(SHELL)|g' \
 		-e 's|[@]GREP@|$(GREP)|g' \
+		-e "s|'gzip'|$(GZIP_TRANSFORMED)|g" \
+		-e "s|'zdiff'|$(ZDIFF_TRANSFORMED)|g" \
+		-e "s|'zgrep'|$(ZGREP_TRANSFORMED)|g" \
 		-e 's|[@]VERSION@|$(VERSION)|g' \
 		$(srcdir)/$@.in >$@-t \
 	  && chmod a=rx $@-t \
@@ -173,3 +176,35 @@ MAINTAINERCLEANFILES = gzip.doc
 
 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
+
+# gzip, zdiff and zgrep are used by installed scripts, and installed names
+# might be transformed by 'configure' options like --program-transform-name.
+# Create executabls in the current directory by the transformed names,
+# for the benefit of 'make check'.
+if GZIP_IS_TRANSFORMED
+BUILT_SOURCES += $(GZIP_TRANSFORMED)
+MOSTLYCLEANFILES += $(GZIP_TRANSFORMED)
+$(GZIP_TRANSFORMED):
+	printf '%s\n' >'$@' \
+	  '#!$(SHELL)' \
+	  'exec '\''$(abs_top_builddir)/gzip'\'' "$$@"'
+	chmod a+x $@
+endif
+if ZDIFF_IS_TRANSFORMED
+BUILT_SOURCES += $(ZDIFF_TRANSFORMED)
+MOSTLYCLEANFILES += $(ZDIFF_TRANSFORMED)
+$(ZDIFF_TRANSFORMED):
+	printf '%s\n' >'$@' \
+	  '#!$(SHELL)' \
+	  'exec '\''$(abs_top_builddir)/zdiff'\'' "$$@"'
+	chmod a+x $@
+endif
+if ZGREP_IS_TRANSFORMED
+BUILT_SOURCES += $(ZGREP_TRANSFORMED)
+MOSTLYCLEANFILES += $(ZGREP_TRANSFORMED)
+$(ZGREP_TRANSFORMED):
+	printf '%s\n' >'$@' \
+	  '#!$(SHELL)' \
+	  'exec '\''$(abs_top_builddir)/zgrep'\'' "$$@"'
+	chmod a+x $@
+endif
diff --git a/NEWS b/NEWS
index 95ffe49..c1159b0 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ GNU gzip NEWS                                    -*- outline -*-
 
   'zdiff -C 5' no longer misbehaves by treating '5' as a file name.
 
+  Configure-time options like --program-prefix now work.
+
 
 * Noteworthy changes in release 1.11 (2021-09-03) [stable]
 
diff --git a/configure.ac b/configure.ac
index d9c77da..1809d4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,16 @@ else
 fi
 AC_SUBST([ASFLAGS_config])
 
+GZIP_TRANSFORMED=` echo gzip  | sed "$program_transform_name"`
+ZDIFF_TRANSFORMED=`echo zdiff | sed "$program_transform_name"`
+ZGREP_TRANSFORMED=`echo zgrep | sed "$program_transform_name"`
+AC_SUBST([GZIP_TRANSFORMED])
+AC_SUBST([ZDIFF_TRANSFORMED])
+AC_SUBST([ZGREP_TRANSFORMED])
+AM_CONDITIONAL([GZIP_IS_TRANSFORMED],  [test "$GZIP_TRANSFORMED" != gzip])
+AM_CONDITIONAL([ZDIFF_IS_TRANSFORMED],  [test "$ZDIFF_TRANSFORMED" != zdiff])
+AM_CONDITIONAL([ZGREP_IS_TRANSFORMED],  [test "$ZGREP_TRANSFORMED" != zgrep])
+
 AC_C_CONST
 AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h sys/sdt.h)
 AC_CHECK_FUNCS_ONCE([chown fchmod fchown lstat siginterrupt])
diff --git a/gunzip.in b/gunzip.in
index 5f38270..6a84659 100644
--- a/gunzip.in
+++ b/gunzip.in
@@ -54,4 +54,4 @@ case $1 in
 --version) printf '%s\n' "$version" || exit 1; exit;;
 esac
 
-exec gzip -d "$@"
+exec 'gzip' -d "$@"
diff --git a/gzexe.in b/gzexe.in
index bb63292..04b06a9 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -106,7 +106,7 @@ for i do
   fi
   case /$file in
   */basename | */bash | */cat | */chmod | */cp | \
-  */dirname | */expr | */gzip | \
+  */dirname | */expr | */'gzip' | \
   */ln | */mkdir | */mktemp | */mv | */printf | */rm | \
   */sed | */sh | */sleep | */test | */tail)
     printf >&2 '%s\n' "$0: $i might depend on itself"; continue;;
@@ -183,7 +183,7 @@ case `printf 'X\n' | tail -n +1 2>/dev/null` in
 X) tail_n=-n;;
 *) tail_n=;;
 esac
-if tail $tail_n +$skip <"$0" | gzip -cd > "$gztmp"; then
+if tail $tail_n +$skip <"$0" | 'gzip' -cd > "$gztmp"; then
   umask $umask
   chmod 700 "$gztmp"
   (sleep 5; rm -fr "$gztmpdir") 2>/dev/null &
@@ -193,7 +193,7 @@ else
   (exit 127); res=127
 fi; exit $res
 EOF
-    gzip -cv9 "$file") > "$tmp" || {
+    'gzip' -cv9 "$file") > "$tmp" || {
       res=$?
       printf >&2 '%s\n' "$0: compression not possible for $i, file unchanged."
       continue
@@ -211,7 +211,7 @@ EOF
     X) tail_n=-n;;
     *) tail_n=;;
     esac
-    tail $tail_n +$skip "$file" | gzip -cd > "$tmp" || {
+    tail $tail_n +$skip "$file" | 'gzip' -cd > "$tmp" || {
       res=$?
       printf >&2 '%s\n' "$0: $i probably not in gzexe format, file unchanged."
       continue
diff --git a/zcat.in b/zcat.in
index 4717b08..4f5fdcd 100644
--- a/zcat.in
+++ b/zcat.in
@@ -48,4 +48,4 @@ case $1 in
 --version) printf '%s\n' "$version" || exit 1; exit;;
 esac
 
-exec gzip -cd "$@"
+exec 'gzip' -cd "$@"
diff --git a/zcmp.in b/zcmp.in
index c084aab..d072231 100644
--- a/zcmp.in
+++ b/zcmp.in
@@ -41,4 +41,4 @@ case $1 in
 --version) printf '%s\n' "$version" || exit 2; exit;;
 esac
 
-exec zdiff --__cmp "$@"
+exec 'zdiff' --__cmp "$@"
diff --git a/zdiff.in b/zdiff.in
index 593cb6e..012024e 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -106,7 +106,7 @@ case $file2 in
     FILE=`expr "X$file1" : 'X\(.*\)[-.][zZtga]*$'`
     gzip_status=$(
       exec 4>&1
-      (gzip -cd -- "$file1" 4>&-; echo $? >&4) 3>&- |
+      ('gzip' -cd -- "$file1" 4>&-; echo $? >&4) 3>&- |
         eval "$cmp" - '"$FILE"' >&3
     );;
   *)
@@ -118,7 +118,7 @@ case $file2 in
   -,-)
         gzip_status=$(
           exec 4>&1
-          (gzip -cdfq - 4>&-; echo $? >&4) 3>&- |
+          ('gzip' -cdfq - 4>&-; echo $? >&4) 3>&- |
             eval "$cmp" - - >&3
         );;
   *)
@@ -134,8 +134,8 @@ case $file2 in
                     then
                         gzip_status=$(
                           exec 4>&1
-                          (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
-                              ((gzip -cdfq -- "$file2" 4>&-
+                          ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+                              (('gzip' -cdfq -- "$file2" 4>&-
                                 echo $? >&4) 3>&- 5<&- </dev/null |
                                eval "$cmp" /dev/fd/5 - >&3) 5<&0
                         )
@@ -163,10 +163,10 @@ case $file2 in
                           set -C
                           tmp=${TMPDIR}zdiff$$
                         fi
-                        gzip -cdfq -- "$file2" > "$tmp" || exit 2
+                        'gzip' -cdfq -- "$file2" > "$tmp" || exit 2
                         gzip_status=$(
                           exec 4>&1
-                          (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+                          ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
                             eval "$cmp" - '"$tmp"' >&3
                         )
                         cmp_status=$?
@@ -177,7 +177,7 @@ case $file2 in
                 *)
                     gzip_status=$(
                       exec 4>&1
-                      (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+                      ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
                         eval "$cmp" - '"$file2"' >&3
                     );;
                 esac;;
@@ -185,7 +185,7 @@ case $file2 in
                 *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
                         gzip_status=$(
                           exec 4>&1
-                          (gzip -cdfq -- "$file2" 4>&-; echo $? >&4) 3>&- |
+                          ('gzip' -cdfq -- "$file2" 4>&-; echo $? >&4) 3>&- |
                             eval "$cmp" '"$file1"' - >&3
                         );;
                 *)	eval "$cmp" '"$file1"' '"$file2"';;
diff --git a/zegrep.in b/zegrep.in
index e5969b7..e81b27a 100644
--- a/zegrep.in
+++ b/zegrep.in
@@ -1,2 +1,2 @@
 #!/bin/sh
-exec zgrep -E "$@"
+exec 'zgrep' -E "$@"
diff --git a/zfgrep.in b/zfgrep.in
index fd7be2b..f1c0af9 100644
--- a/zfgrep.in
+++ b/zfgrep.in
@@ -1,2 +1,2 @@
 #!/bin/sh
-exec zgrep -F "$@"
+exec 'zgrep' -F "$@"
diff --git a/zforce.in b/zforce.in
index 3cb6204..aeb966a 100644
--- a/zforce.in
+++ b/zforce.in
@@ -56,7 +56,7 @@ for i do
     continue
   fi
 
-  if gzip -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
+  if 'gzip' -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
 
     new="$i.gz"
     mv "$i" "$new" && printf '%s\n' "$i -- replaced with $new" || res=1
diff --git a/zgrep.in b/zgrep.in
index 7db4c69..345dae3 100644
--- a/zgrep.in
+++ b/zgrep.in
@@ -201,7 +201,7 @@ do
   # Fail if gzip or grep (or sed) fails.
   gzip_status=$(
     exec 5>&1
-    (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
+    ('gzip' -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
     if test $files_with_matches -eq 1; then
       eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
     elif test $files_without_matches -eq 1; then
diff --git a/zless.in b/zless.in
index e77e6b9..4638e94 100644
--- a/zless.in
+++ b/zless.in
@@ -65,7 +65,7 @@ less' '[1-9][0-9][0-9][0-9]*)
 *) use_input_pipe_on_stdin='';;
 esac
 
-LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}gzip -cdfq -- %s"
+LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}'gzip' -cdfq -- %s"
 export LESSOPEN
 
 exec less "$@"
diff --git a/zmore.in b/zmore.in
index 01fa7e8..bd007b4 100644
--- a/zmore.in
+++ b/zmore.in
@@ -50,5 +50,5 @@ for FILE
 do
   test $# -lt 2 ||
     printf '::::::::::::::\n%s\n::::::::::::::\n' "$FILE" || break
-  gzip -cdfq -- "$FILE"
+  'gzip' -cdfq -- "$FILE"
 done 2>&1 | eval ${PAGER-more}
diff --git a/znew.in b/znew.in
index 3e994b2..45d0764 100644
--- a/znew.in
+++ b/znew.in
@@ -94,7 +94,7 @@ for i do
   fi
   test $keep -eq 1 && old=`wc -c < "$n.Z"`
   if test $pipe -eq 1; then
-    if gzip -d < "$n.Z" | gzip $opt > "$n$ext"; then
+    if 'gzip' -d < "$n.Z" | 'gzip' $opt > "$n$ext"; then
       # Copy file attributes from old file to new one, if possible.
       touch -r"$n.Z" -- "$n$ext" 2>/dev/null
       chmod --reference="$n.Z" -- "$n$ext" 2>/dev/null
@@ -111,14 +111,14 @@ for i do
         res=1; continue
       fi
     fi
-    if gzip -d "$n.Z"; then
+    if 'gzip' -d "$n.Z"; then
       :
     else
       test $check -eq 1 && mv "$n.$$" "$n.Z"
       printf '%s\n' "error while uncompressing $n.Z"
       res=1; continue
     fi
-    if gzip $opt "$n"; then
+    if 'gzip' $opt "$n"; then
       :
     else
       if test $check -eq 1; then
@@ -142,7 +142,7 @@ for i do
     printf '%s\n' "$n.Z smaller than $n$ext -- unchanged"
 
   elif test $check -eq 1; then
-    if gzip -t "$n$ext" ; then
+    if 'gzip' -t "$n$ext" ; then
       rm -f "$n.$$" "$n.Z"
     else
       test $pipe -eq 0 && mv "$n.$$" "$n.Z"
-- 
2.32.0

From d2901794fab194b5877f6d23ba72f8ca63f5b86c Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Mon, 4 Apr 2022 11:36:06 -0700
Subject: [PATCH 2/3] build: update gnulib submodule to latest

---
 gnulib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnulib b/gnulib
index 9afb191..58c597d 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 9afb191bfe52bfd0f32e96e7cf9bd776967fb211
+Subproject commit 58c597d13bc57dce3e97ea97856573f2d68ccb8c
-- 
2.32.0

From 399a65a837fe4023e5fbd3221456dbdc72f76a58 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Mon, 4 Apr 2022 11:52:16 -0700
Subject: [PATCH 3/3] maint: update from Gnulib

* bootstrap, tests/init.sh: Copy manually from current Gnulib.
* lib/.gitignore, m4/.gitignore: Update as per current Gnulib.
---
 bootstrap      | 25 +++++++++++++++++++++----
 lib/.gitignore |  4 ++--
 m4/.gitignore  |  1 -
 tests/init.sh  | 43 ++++++++++++++++++++++++-------------------
 4 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/bootstrap b/bootstrap
index 9658861..9c14d24 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2021-04-11.09; # UTC
+scriptversion=2022-03-21.01; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -763,9 +763,26 @@ if $use_gnulib; then
       shallow=
       if test -z "$GNULIB_REVISION"; then
         git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
+          || cleanup_gnulib
+      else
+        git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        mkdir -p "$gnulib_path"
+        # Only want a shallow checkout of $GNULIB_REVISION, but git does not
+        # support cloning by commit hash. So attempt a shallow fetch by commit
+        # hash to minimize the amount of data downloaded and changes needed to
+        # be processed, which can drastically reduce download and processing
+        # time for checkout. If the fetch by commit fails, a shallow fetch can
+        # not be performed because we do not know what the depth of the commit
+        # is without fetching all commits. So fallback to fetching all commits.
+        git -C "$gnulib_path" init
+        git -C "$gnulib_path" remote add origin \
+            ${GNULIB_URL:-$default_gnulib_url}
+        git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
+          || git -C "$gnulib_path" fetch origin \
+          || cleanup_gnulib
+        git -C "$gnulib_path" reset --hard FETCH_HEAD
       fi
-      git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
-        || cleanup_gnulib
 
       trap - 1 2 13 15
     fi
@@ -1093,7 +1110,7 @@ bootstrap_epilogue
 
 echo "$0: done.  Now you can run './configure'."
 
-# Local variables:
+# Local Variables:
 # eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
diff --git a/lib/.gitignore b/lib/.gitignore
index 293641f..151d30f 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -75,7 +75,6 @@
 /fseterr.c
 /fseterr.h
 /fstat.c
-/fstatat.c
 /fsync.c
 /ftell.c
 /ftello.c
@@ -181,7 +180,6 @@
 /stat-w32.c
 /stat-w32.h
 /stat.c
-/statat.c
 /stdalign.in.h
 /stdbool.h
 /stdbool.in.h
@@ -190,6 +188,8 @@
 /stdint.h
 /stdint.in.h
 /stdio-impl.h
+/stdio-read.c
+/stdio-write.c
 /stdio.h
 /stdio.in.h
 /stdlib.h
diff --git a/m4/.gitignore b/m4/.gitignore
index 644d6c9..c87d1ae 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -43,7 +43,6 @@
 /fseeko.m4
 /fseterr.m4
 /fstat.m4
-/fstatat.m4
 /fsync.m4
 /ftell.m4
 /ftello.m4
diff --git a/tests/init.sh b/tests/init.sh
index 933fdd4..d5d37c9 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -271,12 +271,10 @@ test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases
 #
 # First, try to use the mktemp program.
 # Failing that, we'll roll our own mktemp-like function:
-#  - try to get random bytes from /dev/urandom
+#  - try to get random bytes from /dev/urandom, mapping them to file-name bytes
 #  - failing that, generate output from a combination of quickly-varying
-#      sources and gzip.  Ignore non-varying gzip header, and extract
-#      "random" bits from there.
-#  - given those bits, map to file-name bytes using tr, and try to create
-#      the desired directory.
+#      sources and awk.
+#  - try to create the desired directory.
 #  - make only $MAX_TRIES_ attempts
 
 # Helper function.  Print $N pseudo-random bytes from a-zA-Z0-9.
@@ -296,20 +294,27 @@ rand_bytes_ ()
     return
   fi
 
-  n_plus_50_=`expr $n_ + 50`
-  cmds_='date; date +%N; free; who -a; w; ps auxww; ps -ef'
-  data_=` (eval "$cmds_") 2>&1 | gzip `
-
-  # Ensure that $data_ has length at least 50+$n_
-  while :; do
-    len_=`echo "$data_"|wc -c`
-    test $n_plus_50_ -le $len_ && break;
-    data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip `
-  done
-
-  echo "$data_" \
-    | dd bs=1 skip=50 count=$n_ 2>/dev/null \
-    | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_
+  # Fall back on quickly-varying sources + awk.
+  # Limit awk program to 7th Edition Unix so that it works even on Solaris 10.
+
+  (date; date +%N; free; who -a; w; ps auxww; ps -ef) 2>&1 | awk '
+     BEGIN {
+       n = '"$n_"'
+       for (i = 0; i < 256; i++)
+         ordinal[sprintf ("%c", i)] = i
+     }
+     {
+       for (i = 1; i <= length; i++)
+         a[ai++ % n] += ordinal[substr ($0, i, 1)]
+     }
+     END {
+       chars = "'"$chars_"'"
+       charslen = length (chars)
+       for (i = 0; i < n; i++)
+         printf "%s", substr (chars, a[i] % charslen + 1, 1)
+       printf "\n"
+     }
+  '
 }
 
 mktempd_ ()
-- 
2.32.0

Subject: Re: Zutils vs single compressor utilities
From: Dagobert Michelsen <[email-masked]>
To: Paul Eggert <[email-masked]>
Cc: Antonio Diaz Diaz <[email-masked]>, [email-masked], Rob Savoye <[email-masked]>
Date: Tue, 25 Feb 2014 10:47:57 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Paul,

Am 16.01.2012 um 23:58 schrieb Paul Eggert <[email-masked]>:
> On 01/16/12 10:59, Antonio Diaz Diaz wrote:
>> So here is a better patch
> 
> I don't see why either patch is needed.
> Without the patches, for example,
> "./configure --program-transform-name='s/^z/gz/'"
> followed by "make install" installs gzcat.1, not
> zcat.1.  Isn't that what you want?

I am currently rebuilding our gzip package and tried your suggestion:
it renames the programs and manpages but not the invocations:

> dam@unstable10s [unstable10s]:/home/dam/mgar/pkg/gzip/trunk/work/solaris10-sparc/pkgroot/opt/csw/bin > more gzfgrep
> #!/bin/bash
> bindir='/opt/csw/bin'
> case $1 in
> --__bindir) bindir=${2?}; shift; shift;;
> esac
> PATH=$bindir:$PATH
> exec zgrep --__bindir "$bindir" -F "$@„

Please note the invocation of zgrep here instead of gzgrep. Shouldn’t the transformation be
applied to all occurrences?

Best regards

  — Dago

-- 
"You don't become great by trying to be great, you become great by wanting to do something,
and then doing it so hard that you become great in the process." - xkcd #896