commit 95526018525aaf2a24da17a2f01fa9fd529d46fd Author: zyppe <210hcl@gmail.com> Date: Wed Feb 7 23:17:56 2024 +0800 Initialize for gzip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e3c8bd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +gzip-1.10.tar.xz diff --git a/.gzip.metadata b/.gzip.metadata new file mode 100644 index 0000000..8f9728e --- /dev/null +++ b/.gzip.metadata @@ -0,0 +1 @@ +9cc89b610eb2b70739cb716a9bc07b4bfdda7355b53c5b2100eb60a02136c24e gzip-1.10.tar.xz diff --git a/bsc1198062-2.patch b/bsc1198062-2.patch new file mode 100644 index 0000000..08c9eb7 --- /dev/null +++ b/bsc1198062-2.patch @@ -0,0 +1,160 @@ +From 9d3248751178939713a39115cf68ec8a11506cc9 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 5 Apr 2022 15:16:33 -0700 +Subject: [PATCH 7/7] zgrep: fix "binary file matches" mislabeling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Jim Avera (Bug#31280). +This became more of an issue when GNU grep 3.5 (2020) started sending +"binary file matches" diagnostics to stderr instead of to stdout. +* tests/Makefile.am (TESTS): Add zgrep-binary. +* tests/zgrep-binary: New test. +* zgrep.in (args): New var, to accumulate args separately +from grep command, so we can prepend args if need be. +Most uses of 'grep' changed to use 'args' instead, or also. +(with_filename): Set to 1 if more than one file and -h not given; +this simplifies later code. +(gnuish_grep): New var; evaluates to true if grep supports +-H and --label options, as is true for GNU and FreeBSD grep. +Append -H to 'grep' if outputting file names with GNUish grep, +and use --label with GNUish grep unless reading from stdin, +as that’s safer and more efficient than relabeling with 'sed'. +--- + NEWS | 3 +++ + tests/Makefile.am | 1 + + tests/zgrep-binary | 30 ++++++++++++++++++++++++++++++ + zgrep.in | 28 +++++++++++++++++++--------- + 4 files changed, 53 insertions(+), 9 deletions(-) + create mode 100755 tests/zgrep-binary + +Index: gzip-1.10/tests/Makefile.am +=================================================================== +--- gzip-1.10.orig/tests/Makefile.am ++++ gzip-1.10/tests/Makefile.am +@@ -35,6 +35,7 @@ TESTS = \ + zdiff \ + zgrep-f \ + zgrep-abuse \ ++ zgrep-binary \ + zgrep-context \ + zgrep-signal \ + znew-k +Index: gzip-1.10/tests/zgrep-binary +=================================================================== +--- /dev/null ++++ gzip-1.10/tests/zgrep-binary +@@ -0,0 +1,30 @@ ++#!/bin/sh ++# 'zgrep PATTERN FILE' would output "(standard input): binary file matches" ++# without mentioning FILE. Fixed in gzip-1.12. ++ ++# Copyright (C) 2022 Free Software Foundation, Inc. ++ ++# This program 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. ++ ++# This program 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 . ++# limit so don't run it by default. ++ ++. "${srcdir=.}/init.sh"; path_prepend_ .. ++ ++fail=0 ++ ++unset GREP_OPTIONS ++ ++printf 'foo\0\n' >f || framework_failure_ ++LC_ALL=C zgrep foo f >out 2>err && grep '(standard input)' out err && fail=1 ++ ++Exit $fail +Index: gzip-1.10/zgrep.in +=================================================================== +--- gzip-1.10.orig/zgrep.in ++++ gzip-1.10/zgrep.in +@@ -23,6 +23,7 @@ + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + grep='${GREP-'\''@GREP@'\''}' ++args= + + version='zgrep (gzip) @VERSION@ + Copyright (C) 2010-2018 Free Software Foundation, Inc. +@@ -178,7 +179,7 @@ while test $# -ne 0; do + option="'$option'";; + esac + +- grep="$grep $option$optarg" ++ args="$args $option$optarg" + done + + eval "set -- $operands "'${1+"$@"}' +@@ -186,15 +187,23 @@ eval "set -- $operands "'${1+"$@"}' + if test $have_pat -eq 0; then + case ${1?"missing pattern; try \`$0 --help' for help"} in + (*\'*) +- grep="$grep -- '"$(printf '%s\n' "$1" | LC_ALL=C sed "$escape");; ++ args="$args -- '"$(printf '%s\n' "$1" | LC_ALL=C sed "$escape");; + (*) +- grep="$grep -- '$1'";; ++ args="$args -- '$1'";; + esac + shift + fi + + if test $# -eq 0; then + set -- - ++elif test 1 -lt $# && test $no_filename -eq 0; then ++ with_filename=1 ++fi ++ ++l_e=$(eval "(echo e | $grep -H --label=l e) 2>/dev/null") && test "$l_e" = l:e ++gnuish_grep="test $? -eq 0" ++if $gnuish_grep && test $with_filename -eq 1; then ++ grep="$grep -H" + fi + + exec 3>&1 +@@ -221,9 +230,9 @@ do + exec 5>&1 + ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | + if test $files_with_matches -eq 1; then +- eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; } ++ eval "$grep$args" >/dev/null && { printf '%s\n' "$i" || exit 2; } + elif test $files_without_matches -eq 1; then +- eval "$grep" >/dev/null || { ++ eval "$grep$args" >/dev/null || { + r=$? + if test $r -eq 1; then + printf '%s\n' "$i" || r=2 +@@ -231,9 +240,10 @@ do + test 256 -le $r && r=$(expr 128 + $r % 128) + exit $r + } +- elif test $with_filename -eq 0 && +- { test $# -eq 1 || test $no_filename -eq 1; }; then +- eval "$grep" ++ elif $gnuish_grep && test "$i" != -; then ++ eval "$grep --label \"\$i\"$args" ++ elif $gnuish_grep || test $with_filename -eq 0; then ++ eval "$grep$args" + else + case $i in + (*' +@@ -247,7 +257,7 @@ do + # Fail if grep or sed fails. + r=$( + exec 4>&1 +- (eval "$grep" 4>&-; echo $? >&4) 3>&- | ++ (eval "$grep$args" 4>&-; echo $? >&4) 3>&- | + LC_ALL=C sed "$sed_script" >&3 4>&- + ) || { r=$?; test $r -lt 2 && r=2; } + test 256 -le $r && r=$(expr 128 + $r % 128) diff --git a/bsc1198062.patch b/bsc1198062.patch new file mode 100644 index 0000000..5a37456 --- /dev/null +++ b/bsc1198062.patch @@ -0,0 +1,407 @@ +From 53f56145cc4fc9f14060c0a022f502c210d175a7 Mon Sep 17 00:00:00 2001 +From: Lasse Collin +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 1/6] zgrep: avoid exploit via multi-newline file names + +* zgrep.in: The issue with the old code is that with multiple +newlines, the N-command will read the second line of input, +then the s-commands will be skipped because it's not the end +of the file yet, then a new sed cycle starts and the pattern +space is printed and emptied. So only the last line or two get +escaped. This patch makes sed read all lines into the pattern +space and then do the escaping. + +This vulnerability was discovered by: +cleemy desu wayo working with Trend Micro Zero Day Initiative +--- + zgrep.in | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/zgrep.in b/zgrep.in +index 345dae3..bdf7da2 100644 +--- a/zgrep.in ++++ b/zgrep.in +@@ -222,9 +222,13 @@ do + '* | *'&'* | *'\'* | *'|'*) + i=$(printf '%s\n' "$i" | + sed ' +- $!N +- $s/[&\|]/\\&/g +- $s/\n/\\n/g ++ :start ++ $!{ ++ N ++ b start ++ } ++ s/[&\|]/\\&/g ++ s/\n/\\n/g + ');; + esac + sed_script="s|^|$i:|" +-- +2.35.1.677.gabf474a5dd + + +From 9973b95d1ea12c3372805074f152bec66d81a9b4 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 2/6] zgrep: add NEWS and tests for this exploitable bug + +* tests/zgrep-abuse: New file, based on PoC by cleemy desu wayo. +* tests/Makefile.am (TESTS): Add it. +* NEWS: Mention the exploit. +The bug appears to have been present since the beginning. +--- + NEWS | 3 +++ + tests/Makefile.am | 1 + + tests/zgrep-abuse | 43 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 47 insertions(+) + create mode 100755 tests/zgrep-abuse + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index d09672e..5f148d6 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -36,6 +36,7 @@ TESTS = \ + z-suffix \ + zdiff \ + zgrep-f \ ++ zgrep-abuse \ + zgrep-context \ + zgrep-signal \ + znew-k +diff --git a/tests/zgrep-abuse b/tests/zgrep-abuse +new file mode 100755 +index 0000000..f1d6699 +--- /dev/null ++++ b/tests/zgrep-abuse +@@ -0,0 +1,43 @@ ++#!/bin/sh ++# Show how zgrep applied to a crafted file name may overwrite ++# a selected file with chosen content. Fixed in gzip-1.12. ++ ++# Copyright (C) 2022 Free Software Foundation, Inc. ++ ++# This program 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. ++ ++# This program 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 . ++# limit so don't run it by default. ++ ++. "${srcdir=.}/init.sh"; path_prepend_ .. ++ ++f=z ++echo test > $f || framework_failure_ ++gzip $f || framework_failure_ ++cp $f.gz 'zfile_crafted| ++p ++1s|.*|hacked1| ++1w hacked ++etouch .\x2fhacked2 ++d ++# ++#' || framework_failure_ ++ ++fail=0 ++ ++zgrep test z* ++ ++# Before, each of these would be created. ++test -f hacked && fail=1 ++test -f hacked2 && fail=1 ++ ++Exit $fail +-- +2.35.1.677.gabf474a5dd + + +From 7801e55ae389b24dfda1d29bf7cadb434472c8dd Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 3/6] zgrep: port to POSIX sed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* zgrep.in (res): When escaping the file name do not rely on GNU +sed’s extension to POSIX with respect to s/.../\n/. Instead, use +features that should also work with AIX and/or Solaris sed. This is +simpler anyway, and would have prevented the recently-fixed bug. +--- + zgrep.in | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/zgrep.in b/zgrep.in +index bdf7da2..6a16dd1 100644 +--- a/zgrep.in ++++ b/zgrep.in +@@ -220,18 +220,11 @@ do + case $i in + (*' + '* | *'&'* | *'\'* | *'|'*) +- i=$(printf '%s\n' "$i" | +- sed ' +- :start +- $!{ +- N +- b start +- } +- s/[&\|]/\\&/g +- s/\n/\\n/g +- ');; ++ icolon=$(printf '%s\n' "$i:" | ++ sed -e 's/[&\|]/\\&/g' -e '$!s/$/\\/');; ++ (*) icolon="$i:";; + esac +- sed_script="s|^|$i:|" ++ sed_script="s|^|$icolon|" + + # Fail if grep or sed fails. + r=$( +-- +2.35.1.677.gabf474a5dd + + +From ce2bf56a5e3e1814c08513c2d4141a50041e1ae4 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 4/6] gzip: mention when fixed bugs were introduced + +--- + NEWS | 2 ++ + 1 file changed, 2 insertions(+) + +-- +2.35.1.677.gabf474a5dd + + +From 42641236d0bb239768794eec93a86c42cbfc2f6a Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 5/6] gzexe: optimize out a grep +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* gzexe.in: Avoid an unnecessary invocation of ‘grep’, +by using sed instead. Also, look only for at-most-3-digit numbers, +for consistency with the rest of the script. +--- + gzexe.in | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/gzexe.in b/gzexe.in +index 04b06a9..1a691e0 100644 +--- a/gzexe.in ++++ b/gzexe.in +@@ -91,10 +91,11 @@ for i do + continue + fi + if test $decomp -eq 0; then +- if sed -e 1d -e 2q "$file" | grep "^skip=[0-9][0-9]*$" >/dev/null; then ++ case `sed -n -e 1d -e '/^skip=[0-9][0-9]*$/p' -e 2q "$file"` in ++ skip=[0-9] | skip=[0-9][0-9] | skip=[0-9][0-9][0-9]) + printf >&2 '%s\n' "$0: $i is already gzexe'd" +- continue +- fi ++ continue;; ++ esac + fi + if test -u "$file"; then + printf >&2 '%s\n' "$0: $i has setuid permission, unchanged" +-- +2.35.1.677.gabf474a5dd + + +From 526466454cef8dbfcf552e16a171a44f181c8ca0 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 28 Mar 2022 09:35:27 -0700 +Subject: [PATCH 6/6] maint: use C locale more often + +* gzexe.in, zdiff.in, zgrep.in: +Run expr and sed in the C locale when it might help to avoid +undefined behavior on non-GNU platforms. +* sample/zfile, znew.in: Run in the C locale, for simplicity and +to avoid undefined behavior on non-GNU platforms. +--- + gzexe.in | 4 ++-- + sample/zfile | 3 +++ + zdiff.in | 4 ++-- + zgrep.in | 29 +++++++++++++++++------------ + znew.in | 3 +++ + 5 files changed, 27 insertions(+), 16 deletions(-) + +diff --git a/gzexe.in b/gzexe.in +index 1a691e0..5fc7204 100644 +--- a/gzexe.in ++++ b/gzexe.in +@@ -91,7 +91,7 @@ for i do + continue + fi + if test $decomp -eq 0; then +- case `sed -n -e 1d -e '/^skip=[0-9][0-9]*$/p' -e 2q "$file"` in ++ case `LC_ALL=C sed -n -e 1d -e '/^skip=[0-9][0-9]*$/p' -e 2q "$file"` in + skip=[0-9] | skip=[0-9][0-9] | skip=[0-9][0-9][0-9]) + printf >&2 '%s\n' "$0: $i is already gzexe'd" + continue;; +@@ -203,7 +203,7 @@ EOF + else + # decompression + skip=44 +- skip_line=`sed -e 1d -e 2q "$file"` ++ skip_line=`LC_ALL=C sed -e 1d -e 2q "$file"` + case $skip_line in + skip=[0-9] | skip=[0-9][0-9] | skip=[0-9][0-9][0-9]) + eval "$skip_line";; +diff --git a/sample/zfile b/sample/zfile +index 6b4514c..d6e7a59 100755 +--- a/sample/zfile ++++ b/sample/zfile +@@ -1,5 +1,8 @@ + #!/bin/sh + ++LC_ALL=C ++export LC_ALL ++ + if test $# = 0; then + echo 'zfile: file(1) for programs which may be compressed with gzexe' + echo usage: `basename $0` files... +diff --git a/zdiff.in b/zdiff.in +index 012024e..eb4752b 100644 +--- a/zdiff.in ++++ b/zdiff.in +@@ -59,7 +59,7 @@ do + --h*) printf '%s\n' "$usage" || exit 2; exit;; + --v*) printf '%s\n' "$version" || exit 2; exit;; + --) shift; break;; +- -*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;; ++ -*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | LC_ALL=C sed "$escape"`;; + -?*) cmp="$cmp '$1'";; + *) break;; + esac +@@ -103,7 +103,7 @@ case $file2 in + if test $# -eq 1; then + case $1 in + *[-.]gz* | *[-.][zZ] | *.t[ga]z) +- FILE=`expr "X$1" : 'X\(.*\)[-.][zZtga]*$'` ++ FILE=`LC_ALL=C expr "X$1" : 'X\(.*\)[-.][zZtga]*$'` + gzip_status=$( + exec 4>&1 + (gzip -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3 +diff --git a/zgrep.in b/zgrep.in +index 6a16dd1..2cb2426 100644 +--- a/zgrep.in ++++ b/zgrep.in +@@ -64,30 +64,33 @@ while test $# -ne 0; do + + case $option in + (-[0123456789EFGHIKLPRTUVZabchilnoqrsuvwxyz]*[!0123456789]*) +- arg2=-\'$(expr "X$option" : 'X-.[0-9]*\(.*\)' | sed "$escape") ++ arg2=-\'$(LC_ALL=C expr "X$option" : 'X-.[0-9]*\(.*\)' | ++ LC_ALL=C sed "$escape") + eval "set -- $arg2 "'${1+"$@"}' +- option=$(expr "X$option" : 'X\(-.[0-9]*\)');; ++ option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');; + (--binary-*=* | --[lm]a*=* | --reg*=*) + ;; + (-[ABCDXdefm] | binary-* | --file | --[lm]a* | --reg*) + case ${1?"$option option requires an argument"} in + (*\'*) +- optarg=" '"$(printf '%s\n' "$1" | sed "$escape");; ++ optarg=" '"$(printf '%s\n' "$1" | LC_ALL=C sed "$escape");; + (*) + optarg=" '$1'";; + esac + shift;; + (-f?*\'*) +- optarg=" '"$(expr "X$option" : 'X-f\(.*\)' | sed "$escape") ++ optarg=" '"$(LC_ALL=C expr "X$option" : 'X-f\(.*\)' | ++ LC_ALL=C sed "$escape") + option=-f;; + (-f?*) +- optarg=" '"$(expr "X$option" : 'X-f\(.*\)')\' ++ optarg=" '"$(LC_ALL=C expr "X$option" : 'X-f\(.*\)')\' + option=-f;; + (--file=*\'*) +- optarg=" '"$(expr "X$option" : 'X--file=\(.*\)' | sed "$escape") ++ optarg=" '"$(LC_ALL=C expr "X$option" : 'X--file=\(.*\)' | ++ LC_ALL=C sed "$escape") + option=--file;; + (--file=*) +- optarg=" '"$(expr "X$option" : 'X--file=\(.*\)')\' ++ optarg=" '"$(LC_ALL=C expr "X$option" : 'X--file=\(.*\)')\' + option=--file;; + (--) + break;; +@@ -96,7 +99,8 @@ while test $# -ne 0; do + (*) + case $option in + (*\'*) +- operands="$operands '"$(printf '%s\n' "$option" | sed "$escape");; ++ operands="$operands '"$(printf '%s\n' "$option" | LC_ALL=C sed "$escape") ++ ;; + (*) + operands="$operands '$option'";; + esac +@@ -169,7 +173,7 @@ while test $# -ne 0; do + + case $option in + (*\'?*) +- option=\'$(printf '%s\n' "$option" | sed "$escape");; ++ option=\'$(printf '%s\n' "$option" | LC_ALL=C sed "$escape");; + (*) + option="'$option'";; + esac +@@ -182,7 +186,7 @@ eval "set -- $operands "'${1+"$@"}' + if test $have_pat -eq 0; then + case ${1?"missing pattern; try \`$0 --help' for help"} in + (*\'*) +- grep="$grep -- '"$(printf '%s\n' "$1" | sed "$escape");; ++ grep="$grep -- '"$(printf '%s\n' "$1" | LC_ALL=C sed "$escape");; + (*) + grep="$grep -- '$1'";; + esac +@@ -221,7 +225,7 @@ do + (*' + '* | *'&'* | *'\'* | *'|'*) + icolon=$(printf '%s\n' "$i:" | +- sed -e 's/[&\|]/\\&/g' -e '$!s/$/\\/');; ++ LC_ALL=C sed -e 's/[&\|]/\\&/g' -e '$!s/$/\\/');; + (*) icolon="$i:";; + esac + sed_script="s|^|$icolon|" +@@ -229,7 +233,8 @@ do + # Fail if grep or sed fails. + r=$( + exec 4>&1 +- (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&- ++ (eval "$grep" 4>&-; echo $? >&4) 3>&- | ++ LC_ALL=C sed "$sed_script" >&3 4>&- + ) || { r=$?; test $r -lt 2 && r=2; } + test 256 -le $r && r=$(expr 128 + $r % 128) + exit $r +diff --git a/znew.in b/znew.in +index 45d0764..ea76a22 100644 +--- a/znew.in ++++ b/znew.in +@@ -18,6 +18,9 @@ + # with this program; if not, write to the Free Software Foundation, Inc., + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ++LC_ALL=C ++export LC_ALL ++ + version="znew (gzip) @VERSION@ + Copyright (C) 2010-2018 Free Software Foundation, Inc. + This is free software. You may redistribute copies of it under the terms of +-- +2.35.1.677.gabf474a5dd + diff --git a/gzip-1.10-fix-DFLTCC-segfault.patch b/gzip-1.10-fix-DFLTCC-segfault.patch new file mode 100644 index 0000000..7948494 --- /dev/null +++ b/gzip-1.10-fix-DFLTCC-segfault.patch @@ -0,0 +1,76 @@ +From be0a534ba2b6e77da289de8da79e70843b1028cc Mon Sep 17 00:00:00 2001 +From: Ilya Leoshkevich +Date: Thu, 24 Sep 2020 00:08:56 +0200 +Subject: Fix DFLTCC segfault when compressing or decompressing two files + +The value in total_in global variable from processing the first file +affected processing of the second file. Fix by making total_in local. +--- + dfltcc.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/dfltcc.c b/dfltcc.c +index 86aa56e..3a5b92d 100644 +--- a/dfltcc.c ++++ b/dfltcc.c +@@ -242,10 +242,8 @@ dfltcc_gdht (struct dfltcc_param_v0 *param) + dfltcc (DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL); + } + +-static off_t total_in; +- + static dfltcc_cc +-dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn) ++dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn, off_t *total_in) + { + uch *next_out = outbuf + outcnt; + size_t avail_out = OUTBUFSIZ - outcnt; +@@ -257,7 +255,7 @@ dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn) + window); + off_t consumed_in = next_in - (inbuf + inptr); + inptr += consumed_in; +- total_in += consumed_in; ++ *total_in += consumed_in; + outcnt += ((OUTBUFSIZ - outcnt) - avail_out); + return cc; + } +@@ -349,6 +347,7 @@ dfltcc_deflate (int pack_level) + + union aligned_dfltcc_param_v0 ctx_v0; + struct dfltcc_param_v0 *param = init_param (&ctx_v0); ++ off_t total_in = 0; + + /* Compress ifd into ofd in a loop. */ + while (true) +@@ -398,7 +397,8 @@ dfltcc_deflate (int pack_level) + } + + /* Compress inbuf into outbuf. */ +- while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR) == DFLTCC_CC_AGAIN) ++ while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR, &total_in) ++ == DFLTCC_CC_AGAIN) + ; + + /* Unmask the input data. */ +@@ -427,6 +427,7 @@ dfltcc_inflate (void) + + union aligned_dfltcc_param_v0 ctx_v0; + struct dfltcc_param_v0 *param = init_param (&ctx_v0); ++ off_t total_in = 0; + + /* Decompress ifd into ofd in a loop. */ + while (true) +@@ -446,7 +447,8 @@ dfltcc_inflate (void) + + /* Decompress inbuf into outbuf. */ + dfltcc_cc cc; +- while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND)) == DFLTCC_CC_AGAIN) ++ while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND, &total_in)) ++ == DFLTCC_CC_AGAIN) + ; + if (cc == DFLTCC_CC_OK) + { +-- +cgit v1.2.1 + + diff --git a/gzip-1.10-fix_count_of_lines_to_skip.patch b/gzip-1.10-fix_count_of_lines_to_skip.patch new file mode 100644 index 0000000..1256854 --- /dev/null +++ b/gzip-1.10-fix_count_of_lines_to_skip.patch @@ -0,0 +1,26 @@ +From 38ae6a4ed36a7c86609a6a595add4298d9c202bc Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 26 Mar 2019 19:44:43 -0700 +Subject: gzexe: fix count of lines to skip + +Problem reported by Jakub Martisko (Bug#35002). +* gzexe.in (skip): Bump from 44 to 49. +--- + gzexe.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gzexe.in b/gzexe.in +index 8fca8c8..832cd07 100644 +--- a/gzexe.in ++++ b/gzexe.in +@@ -145,7 +145,7 @@ for i do + if test $decomp -eq 0; then + (cat <<'EOF' && + #!/bin/sh +-skip=44 ++skip=49 + + tab=' ' + nl=' +-- +cgit v1.2.1 diff --git a/gzip-1.10-ibm_dfltcc_support.patch b/gzip-1.10-ibm_dfltcc_support.patch new file mode 100644 index 0000000..1029570 --- /dev/null +++ b/gzip-1.10-ibm_dfltcc_support.patch @@ -0,0 +1,1042 @@ +----- +DFLTCC support for IBM System Z [jsc#SLE-5818] + +This patch contains the following upstream commits: +http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=7a6f9c9c3267185a299ad178607ac5e3716ab4a5 +http://git.savannah.gnu.org/cgit/gzip.git/commit/?id=be0c5581e38332b2ffa8a4cf92076cfde02872b4 + +And the following enhancement: +https://lists.gnu.org/archive/html/bug-gzip/2019-07/msg00000.html + +----- + +From 7a6f9c9c3267185a299ad178607ac5e3716ab4a5 Mon Sep 17 00:00:00 2001 +From: Ilya Leoshkevich +Date: Tue, 2 Apr 2019 08:01:02 -0700 +Subject: bug#34918: [PATCH] Add support for IBM Z hardware-accelerated deflate + +Future versions of IBM Z mainframes will provide DFLTCC instruction, +which implements deflate algorithm in hardware with estimated +compression and decompression performance orders of magnitude faster +than the current gzip and ratio comparable with that of level 1. + +This patch adds DFLTCC support to gzip. In order to enable it, the +following build commands should be used: + + $ ./configure --enable-dfltcc + $ make + +When built like this, gzip would compress in hardware on level 1, and in +software on all other levels. Decompression will always happen in +hardware. In order to enable DFLTCC compression for levels 1-6 (i.e. to +make it used by default) one could either add -DDFLTCC_LEVEL_MASK=0x7e +at compile time, or set the environment variable DFLTCC_LEVEL_MASK to +0x7e at run time. + +Two DFLTCC compression calls produce the same results only when they +both are made on machines of the same generation, and when the +respective buffers have the same offset relative to the start of the +page. Therefore care should be taken when using hardware compression +when reproducible results are desired. One such use case - reproducible +software builds - is handled explicitly: when SOURCE_DATE_EPOCH +environment variable is set, the hardware compression is disabled. + +This patch tries to add DFLTCC support in a least intrusive way. +All SystemZ-specific code was placed into a separate file, but +unfortunately there is still a noticeable amount of changes in the +main gzip code. Below is the summary of those changes. + +DFLTCC will refuse to write an End-of-block Symbol if there is no input +data, thus in some cases it is necessary to do this manually. In order +to achieve this, bi_buf and bi_valid were promoted to extern variables. + +lm_init() function moves the input buffer into the window, which is not +desirable for DFLTCC. Therefore, its invocation was moved to +software-only deflate(). In addition to initializing the window, this +function also used to convert compression level to flags, which is still +needed for DFLTCC. This responsibility was handed off to zip() function. + +To achieve maximum performance with DFLTCC, inbuf and outbuf must be +256k big and page-aligned. Additionally, for DFLTCC to work at all, the +window must be page-aligned. + +In addition to compression, DFLTCC computes CRC-32 checksum, therefore, +whenever it's used, software checksumming needs to be suppressed and its +results replaced by those of dfltcc. This is achieved by introducing the +new getcrc() and setcrc() functions. + +Unlike the current software implementation, DFLTCC decompresses data +into the output buffer, and not the window. Therefore, just like +flushing the window, flushing the output buffer must honor the test +flag. + +Finally, znew-k test assumes that "znew -K" would not convert the test +.Z file to .gz, which is not the case with DFLTCC. Since this is not the +main point of the test, this assumption was relaxed. +--- + Makefile.am | 3 + + bits.c | 4 +- + configure.ac | 16 +++ + deflate.c | 21 +-- + dfltcc.c | 429 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + gzip.c | 12 ++ + gzip.h | 26 +++- + tests/znew-k | 3 +- + unzip.c | 4 + + util.c | 30 ++++- + zip.c | 23 +++- + 11 files changed, 536 insertions(+), 35 deletions(-) + create mode 100644 dfltcc.c + +From be0c5581e38332b2ffa8a4cf92076cfde02872b4 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 2 Apr 2019 10:26:30 -0700 +Subject: Improve IBM Z patch + +Most of this is minor changes to use GNU style and C99 constructs. +* NEWS: Mention IBM Z. +* bootstrap.conf (gnulib_modules): Add stdalign. +* dfltcc.c: Include stdalign.h, stdbool.h. +(union aligned_dfltcc_qaf_param, union aligned_dfltcc_param_v0): +New types, used for C11-style alignment. All uses changed. +(init_param): +* gzip.c (BUFFER_ALIGNED): New macro. +(inbuf, outbuf, window): Use it, so buffers are aligned everywhere. +* gzip.h (INBUFSIZ, OUTBUFSIZE): Use big buffers everywhere, +unless SMALL_MEM. +* zip.c (SLOW, FAST): Now enums since they need not be macros: +--- + NEWS | 4 + + deflate.c | 8 +- + dfltcc.c | 632 +++++++++++++++++++++++++++++---------------------------- + gzip.c | 27 ++- + gzip.h | 16 +- + unzip.c | 2 +- + util.c | 30 ++- + zip.c | 24 +-- + 11 files changed, 376 insertions(+), 370 deletions(-) + + +Index: gzip-1.10/Makefile.am +=================================================================== +--- gzip-1.10.orig/Makefile.am ++++ gzip-1.10/Makefile.am +@@ -55,6 +55,9 @@ gzip_SOURCES = \ + trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c + gzip_LDADD = libver.a lib/libgzip.a + gzip_LDADD += $(LIB_CLOCK_GETTIME) ++if IBM_Z_DFLTCC ++gzip_SOURCES += dfltcc.c ++endif + + BUILT_SOURCES += version.c + version.c: Makefile +Index: gzip-1.10/bits.c +=================================================================== +--- gzip-1.10.orig/bits.c ++++ gzip-1.10/bits.c +@@ -78,7 +78,7 @@ + + local file_t zfile; /* output gzip file */ + +-local unsigned short bi_buf; ++unsigned short bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least significant + * bits). + */ +@@ -88,7 +88,7 @@ local unsigned short bi_buf; + * more than 16 bits on some systems.) + */ + +-local int bi_valid; ++int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ +Index: gzip-1.10/configure.ac +=================================================================== +--- gzip-1.10.orig/configure.ac ++++ gzip-1.10/configure.ac +@@ -74,6 +74,16 @@ AC_ARG_ENABLE([gcc-warnings], + fi] + ) + ++AC_ARG_ENABLE([dfltcc], ++ [AS_HELP_STRING([--enable-dfltcc], ++ [use DEFLATE COMPRESSION CALL instruction on IBM Z])], ++ [case $enableval in ++ yes|no) gl_dfltcc=$enableval ;; ++ *) AC_MSG_ERROR([bad value $enableval for dfltcc option]) ;; ++ esac], ++ [gl_dfltcc=no] ++) ++ + # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) + # ------------------------------------------------ + # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. +@@ -185,6 +195,12 @@ if test "$gl_gcc_warnings" = yes; then + AC_SUBST([GNULIB_WARN_CFLAGS]) + fi + ++if test "$gl_dfltcc" = yes; then ++ AC_DEFINE([IBM_Z_DFLTCC], , ++ [Use DEFLATE COMPRESSION CALL instruction on IBM Z machines.]) ++fi ++AM_CONDITIONAL([IBM_Z_DFLTCC], [test "$gl_dfltcc" = yes]) ++ + # cc -E produces incorrect asm files on SVR4, so postprocess it. + ASCPPPOST="sed '/^ *\\#/d; s,//.*,,; s/% /%/g; s/\\. /./g'" + AC_SUBST([ASCPPPOST]) +@@ -244,7 +260,7 @@ AC_SUBST([ASFLAGS_config]) + AC_ISC_POSIX + AC_C_CONST + AC_HEADER_STDC +-AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h) ++AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h sys/sdt.h) + AC_CHECK_FUNCS_ONCE([chown fchmod fchown lstat siginterrupt]) + AC_HEADER_DIRENT + AC_TYPE_SIGNAL +Index: gzip-1.10/deflate.c +=================================================================== +--- gzip-1.10.orig/deflate.c ++++ gzip-1.10/deflate.c +@@ -123,10 +123,6 @@ + #define NIL 0 + /* Tail of hash chains */ + +-#define FAST 4 +-#define SLOW 2 +-/* speed options for the general purpose bit flag */ +- + #ifndef TOO_FAR + # define TOO_FAR 4096 + #endif +@@ -215,9 +211,6 @@ local unsigned int max_lazy_match; + * max_insert_length is used only for compression levels <= 3. + */ + +-local int compr_level; +-/* compression level (1..9) */ +- + unsigned good_match; + /* Use a faster search when the previous match is longer than this */ + +@@ -308,14 +301,12 @@ local void check_match (IPos start, IPo + /* =========================================================================== + * Initialize the "longest match" routines for a new file + */ +-void lm_init (pack_level, flags) ++void lm_init (pack_level) + int pack_level; /* 0: store, 1: best speed, 9: best compression */ +- ush *flags; /* general purpose bit flag */ + { + register unsigned j; + + if (pack_level < 1 || pack_level > 9) gzip_error ("bad pack level"); +- compr_level = pack_level; + + /* Initialize the hash table. */ + #if defined MAXSEG_64K && HASH_BITS == 15 +@@ -337,11 +328,6 @@ void lm_init (pack_level, flags) + nice_match = configuration_table[pack_level].nice_length; + #endif + max_chain_length = configuration_table[pack_level].max_chain; +- if (pack_level == 1) { +- *flags |= FAST; +- } else if (pack_level == 9) { +- *flags |= SLOW; +- } + /* ??? reduce max_chain_length for binary files */ + + strstart = 0; +@@ -732,7 +718,8 @@ local off_t deflate_fast() + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +-off_t deflate() ++off_t ++deflate (int pack_level) + { + IPos hash_head; /* head of hash chain */ + IPos prev_match; /* previous match */ +@@ -740,7 +727,9 @@ off_t deflate() + int match_available = 0; /* set if previous match exists */ + register unsigned match_length = MIN_MATCH-1; /* length of best match */ + +- if (compr_level <= 3) return deflate_fast(); /* optimized for speed */ ++ lm_init (pack_level); ++ if (pack_level <= 3) ++ return deflate_fast(); + + /* Process the input block. */ + while (lookahead != 0) { +Index: gzip-1.10/dfltcc.c +=================================================================== +--- /dev/null ++++ gzip-1.10/dfltcc.c +@@ -0,0 +1,471 @@ ++/* dfltcc.c -- compress data using IBM Z DEFLATE COMPRESSION CALL ++ ++ Copyright (C) 2019 Free Software Foundation, Inc. ++ ++ This program 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, or (at your option) ++ any later version. ++ ++ This program 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, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#include ++ ++#include ++#include ++#include ++ ++#ifdef HAVE_SYS_SDT_H ++# include ++#endif ++ ++#include "tailor.h" ++#include "gzip.h" ++ ++#ifdef DYN_ALLOC ++# error "DYN_ALLOC is not supported by DFLTCC" ++#endif ++ ++/* =========================================================================== ++ * C wrappers for the DEFLATE CONVERSION CALL instruction. ++ */ ++ ++typedef enum ++{ ++ DFLTCC_CC_OK = 0, ++ DFLTCC_CC_OP1_TOO_SHORT = 1, ++ DFLTCC_CC_OP2_TOO_SHORT = 2, ++ DFLTCC_CC_OP2_CORRUPT = 2, ++ DFLTCC_CC_AGAIN = 3, ++} dfltcc_cc; ++ ++#define DFLTCC_QAF 0 ++#define DFLTCC_GDHT 1 ++#define DFLTCC_CMPR 2 ++#define DFLTCC_XPND 4 ++#define HBT_CIRCULAR (1 << 7) ++#define DFLTCC_FACILITY 151 ++#define DFLTCC_FMT0 0 ++#define CVT_CRC32 0 ++#define HTT_FIXED 0 ++#define HTT_DYNAMIC 1 ++ ++#ifndef DFLTCC_BLOCK_SIZE ++# define DFLTCC_BLOCK_SIZE 1048576 ++#endif ++#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE ++# define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096 ++#endif ++#ifndef DFLTCC_LEVEL_MASK ++# define DFLTCC_LEVEL_MASK 0x2 ++#endif ++#ifndef DFLTCC_RIBM ++# define DFLTCC_RIBM 0 ++#endif ++ ++#define MAX(a, b) ((a) > (b) ? (a) : (b)) ++ ++struct dfltcc_qaf_param ++{ ++ char fns[16]; ++ char reserved1[8]; ++ char fmts[2]; ++ char reserved2[6]; ++}; ++ ++union aligned_dfltcc_qaf_param ++{ ++ struct dfltcc_qaf_param af; ++ char alignas (8) aligned; ++}; ++ ++struct dfltcc_param_v0 ++{ ++ unsigned short pbvn; /* Parameter-Block-Version Number */ ++ unsigned char mvn; /* Model-Version Number */ ++ unsigned char ribm; /* Reserved for IBM use */ ++ unsigned reserved32 : 31; ++ unsigned cf : 1; /* Continuation Flag */ ++ unsigned char reserved64[8]; ++ unsigned nt : 1; /* New Task */ ++ unsigned reserved129 : 1; ++ unsigned cvt : 1; /* Check Value Type */ ++ unsigned reserved131 : 1; ++ unsigned htt : 1; /* Huffman-Table Type */ ++ unsigned bcf : 1; /* Block-Continuation Flag */ ++ unsigned bcc : 1; /* Block Closing Control */ ++ unsigned bhf : 1; /* Block Header Final */ ++ unsigned reserved136 : 1; ++ unsigned reserved137 : 1; ++ unsigned dhtgc : 1; /* DHT Generation Control */ ++ unsigned reserved139 : 5; ++ unsigned reserved144 : 5; ++ unsigned sbb : 3; /* Sub-Byte Boundary */ ++ unsigned char oesc; /* Operation-Ending-Supplemental Code */ ++ unsigned reserved160 : 12; ++ unsigned ifs : 4; /* Incomplete-Function Status */ ++ unsigned short ifl; /* Incomplete-Function Length */ ++ unsigned char reserved192[8]; ++ unsigned char reserved256[8]; ++ unsigned char reserved320[4]; ++ unsigned short hl; /* History Length */ ++ unsigned reserved368 : 1; ++ unsigned short ho : 15; /* History Offset */ ++ unsigned int cv; /* Check Value */ ++ unsigned eobs : 15; /* End-of-block Symbol */ ++ unsigned reserved431 : 1; ++ unsigned char eobl : 4; /* End-of-block Length */ ++ unsigned reserved436 : 12; ++ unsigned reserved448 : 4; ++ unsigned short cdhtl : 12; /* Compressed-Dynamic-Huffman Table ++ Length */ ++ unsigned char reserved464[6]; ++ unsigned char cdht[288]; ++ unsigned char reserved[32]; ++ unsigned char csb[1152]; ++}; ++ ++union aligned_dfltcc_param_v0 ++{ ++ struct dfltcc_param_v0 param; ++ char alignas (8) aligned; ++}; ++ ++static int ++is_bit_set (const char *bits, int n) ++{ ++ return bits[n / 8] & (1 << (7 - (n % 8))); ++} ++ ++static int ++is_dfltcc_enabled (void) ++{ ++ char facilities[(DFLTCC_FACILITY / 64 + 1) * 8]; ++ ++ char const *env = getenv ("DFLTCC"); ++ if (env && !strcmp (env, "0")) ++ return 0; ++ ++ memset (facilities, 0, sizeof facilities); ++ register char r0 __asm__ ("r0") = sizeof facilities / 8 - 1; ++ /* STFLE is supported since z9-109 and only in z/Architecture mode. When ++ * compiling with -m31, gcc defaults to ESA mode, however, since the kernel ++ * is 64-bit, it's always z/Architecture mode at runtime. */ ++ __asm__ (".machinemode push\n" ++ ".machinemode zarch\n" ++ "stfle %[facilities]\n" ++ ".machinemode pop\n" ++ : [facilities] "=Q"(facilities), [r0] "+r"(r0) :: "cc"); ++ return is_bit_set (facilities, DFLTCC_FACILITY); ++} ++ ++static dfltcc_cc ++dfltcc (int fn, void *param, ++ uch **op1, size_t *len1, ++ uch const **op2, size_t *len2, ++ void *hist) ++{ ++ uch *t2 = op1 ? *op1 : NULL; ++ size_t t3 = len1 ? *len1 : 0; ++ const uch *t4 = op2 ? *op2 : NULL; ++ size_t t5 = len2 ? *len2 : 0; ++ register int r0 __asm__ ("r0") = fn; ++ register void *r1 __asm__ ("r1") = param; ++ register uch *r2 __asm__ ("r2") = t2; ++ register size_t r3 __asm__ ("r3") = t3; ++ register const uch *r4 __asm__ ("r4") = t4; ++ register size_t r5 __asm__ ("r5") = t5; ++ int cc; ++ ++ __asm__ volatile ( ++#ifdef HAVE_SYS_SDT_H ++ STAP_PROBE_ASM (zlib, dfltcc_entry, ++ STAP_PROBE_ASM_TEMPLATE (5)) ++#endif ++ ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n" ++#ifdef HAVE_SYS_SDT_H ++ STAP_PROBE_ASM (zlib, dfltcc_exit, ++ STAP_PROBE_ASM_TEMPLATE (5)) ++#endif ++ "ipm %[cc]\n" ++ : [r2] "+r" (r2) ++ , [r3] "+r" (r3) ++ , [r4] "+r" (r4) ++ , [r5] "+r" (r5) ++ , [cc] "=r" (cc) ++ : [r0] "r" (r0) ++ , [r1] "r" (r1) ++ , [hist] "r" (hist) ++#ifdef HAVE_SYS_SDT_H ++ , STAP_PROBE_ASM_OPERANDS (5, r2, r3, r4, r5, hist) ++#endif ++ : "cc", "memory"); ++ t2 = r2; t3 = r3; t4 = r4; t5 = r5; ++ ++ if (op1) ++ *op1 = t2; ++ if (len1) ++ *len1 = t3; ++ if (op2) ++ *op2 = t4; ++ if (len2) ++ *len2 = t5; ++ return (cc >> 28) & 3; ++} ++ ++static void ++dfltcc_qaf (struct dfltcc_qaf_param *param) ++{ ++ dfltcc (DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL); ++} ++ ++static void ++dfltcc_gdht (struct dfltcc_param_v0 *param) ++{ ++ const uch *next_in = inbuf + inptr; ++ size_t avail_in = insize - inptr; ++ ++ dfltcc (DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL); ++} ++ ++static off_t total_in; ++ ++static dfltcc_cc ++dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn) ++{ ++ uch *next_out = outbuf + outcnt; ++ size_t avail_out = OUTBUFSIZ - outcnt; ++ const uch *next_in = inbuf + inptr; ++ size_t avail_in = insize - inptr; ++ dfltcc_cc cc = dfltcc (fn | HBT_CIRCULAR, param, ++ &next_out, &avail_out, ++ &next_in, &avail_in, ++ window); ++ off_t consumed_in = next_in - (inbuf + inptr); ++ inptr += consumed_in; ++ total_in += consumed_in; ++ outcnt += ((OUTBUFSIZ - outcnt) - avail_out); ++ return cc; ++} ++ ++static struct dfltcc_param_v0 * ++init_param (union aligned_dfltcc_param_v0 *ctx) ++{ ++ char const *s = getenv ("DFLTCC_RIBM"); ++ struct dfltcc_param_v0 *param = &ctx->param; ++ memset (param, 0, sizeof *param); ++ param->ribm = s && *s ? strtoul (s, NULL, 0) : DFLTCC_RIBM; ++ param->nt = 1; ++ param->cvt = CVT_CRC32; ++ param->cv = __builtin_bswap32 (getcrc ()); ++ return param; ++} ++ ++static void ++bi_load (struct dfltcc_param_v0 *param) ++{ ++ bi_valid = param->sbb; ++ bi_buf = bi_valid == 0 ? 0 : outbuf[outcnt] & ((1 << bi_valid) - 1); ++} ++ ++static void ++bi_close_block (struct dfltcc_param_v0 *param) ++{ ++ bi_load (param); ++ send_bits (bi_reverse (param->eobs >> (15 - param->eobl), param->eobl), ++ param->eobl); ++ param->bcf = 0; ++} ++ ++static void ++close_block (struct dfltcc_param_v0 *param) ++{ ++ bi_close_block (param); ++ bi_windup (); ++ /* bi_windup has written out a possibly partial byte, fix up the position */ ++ param->sbb = (param->sbb + param->eobl) % 8; ++ if (param->sbb != 0) ++ { ++ Assert (outcnt > 0, "outbuf must have enough space for EOBS"); ++ outcnt--; ++ } ++} ++ ++static void ++close_stream (struct dfltcc_param_v0 *param) ++{ ++ if (param->bcf) ++ bi_close_block (param); ++ else ++ bi_load (param); ++ send_bits (1, 3); /* BFINAL=1, BTYPE=00 */ ++ bi_windup (); ++ put_short (0x0000); ++ put_short (0xFFFF); ++} ++ ++/* Compress ifd into ofd in hardware or fall back to software. */ ++ ++int ++dfltcc_deflate (int pack_level) ++{ ++ /* Check whether we can use hardware compression. */ ++ if (!is_dfltcc_enabled () || getenv ("SOURCE_DATE_EPOCH")) ++ return deflate (pack_level); ++ char const *s = getenv ("DFLTCC_LEVEL_MASK"); ++ unsigned long level_mask ++ = s && *s ? strtoul (s, NULL, 0) : DFLTCC_LEVEL_MASK; ++ if ((level_mask & (1 << pack_level)) == 0) ++ return deflate (pack_level); ++ union aligned_dfltcc_qaf_param ctx; ++ dfltcc_qaf (&ctx.af); ++ if (!is_bit_set (ctx.af.fns, DFLTCC_CMPR) ++ || !is_bit_set (ctx.af.fns, DFLTCC_GDHT) ++ || !is_bit_set (ctx.af.fmts, DFLTCC_FMT0)) ++ return deflate (pack_level); ++ ++ /* Initialize tuning parameters. */ ++ s = getenv ("DFLTCC_BLOCK_SIZE"); ++ unsigned long block_size ++ = s && *s ? strtoul (s, NULL, 0) : DFLTCC_BLOCK_SIZE; ++ ++ s = getenv ("DFLTCC_FIRST_FHT_BLOCK_SIZE"); ++ off_t block_threshold ++ = s && *s ? strtoul (s, NULL, 0) : DFLTCC_FIRST_FHT_BLOCK_SIZE; ++ ++ union aligned_dfltcc_param_v0 ctx_v0; ++ struct dfltcc_param_v0 *param = init_param (&ctx_v0); ++ ++ /* Compress ifd into ofd in a loop. */ ++ while (true) ++ { ++ /* Flush the output data. */ ++ if (outcnt > OUTBUFSIZ - 8) ++ { ++ if (param->sbb == 0) ++ flush_outbuf (); ++ else ++ { ++ uch partial = outbuf[outcnt]; ++ flush_outbuf (); ++ outbuf[outcnt] = partial; ++ } ++ } ++ ++ /* Close the block. */ ++ if (param->bcf && total_in == block_threshold && !param->cf) ++ { ++ close_block (param); ++ block_threshold += block_size; ++ } ++ ++ /* Read the input data. */ ++ if (inptr == insize) ++ { ++ if (fill_inbuf (1) == EOF && !param->cf) ++ break; ++ inptr = 0; ++ } ++ ++ /* Temporarily mask some input data. */ ++ int extra = MAX (0, total_in + (insize - inptr) - block_threshold); ++ insize -= extra; ++ ++ /* Start a new block. */ ++ if (!param->bcf) ++ { ++ if (total_in == 0 && block_threshold > 0) ++ param->htt = HTT_FIXED; ++ else ++ { ++ param->htt = HTT_DYNAMIC; ++ dfltcc_gdht (param); ++ } ++ } ++ ++ /* Compress inbuf into outbuf. */ ++ while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR) == DFLTCC_CC_AGAIN) ++ ; ++ ++ /* Unmask the input data. */ ++ insize += extra; ++ ++ /* Continue the block */ ++ param->bcf = 1; ++ } ++ ++ close_stream (param); ++ setcrc (__builtin_bswap32 (param->cv)); ++ return 0; ++} ++ ++/* Decompress ifd into ofd in hardware or fall back to software. */ ++int ++dfltcc_inflate (void) ++{ ++ /* Check whether we can use hardware decompression. */ ++ if (!is_dfltcc_enabled ()) ++ return inflate (); ++ union aligned_dfltcc_qaf_param ctx; ++ dfltcc_qaf (&ctx.af); ++ if (!is_bit_set (ctx.af.fns, DFLTCC_XPND)) ++ return inflate (); ++ ++ union aligned_dfltcc_param_v0 ctx_v0; ++ struct dfltcc_param_v0 *param = init_param (&ctx_v0); ++ ++ /* Decompress ifd into ofd in a loop. */ ++ while (true) ++ { ++ /* Perform I/O. */ ++ if (outcnt == OUTBUFSIZ) ++ flush_outbuf (); ++ if (inptr == insize) ++ { ++ if (fill_inbuf (1) == EOF) ++ { ++ /* Premature EOF. */ ++ return 2; ++ } ++ inptr = 0; ++ } ++ ++ /* Decompress inbuf into outbuf. */ ++ dfltcc_cc cc; ++ while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND)) == DFLTCC_CC_AGAIN) ++ ; ++ if (cc == DFLTCC_CC_OK) ++ { ++ /* The entire deflate stream has been successfully decompressed. */ ++ break; ++ } ++ if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) ++ { ++ /* The deflate stream is corrupted. */ ++ fprintf (stderr, "Operation-Ending-Supplemental Code 0x%x\n", ++ param->oesc); ++ flush_outbuf (); ++ return 2; ++ } ++ /* There must be more data to decompress. */ ++ } ++ ++ if (param->sbb != 0) ++ { ++ /* The deflate stream has ended in the middle of a byte. Go to ++ the next byte boundary, so that unzip can read CRC and length. */ ++ inptr++; ++ } ++ ++ /* Set CRC value and update bytes_out for unzip. */ ++ setcrc (__builtin_bswap32 (param->cv)); ++ flush_outbuf (); ++ return 0; ++} +Index: gzip-1.10/gzip.c +=================================================================== +--- gzip-1.10.orig/gzip.c ++++ gzip-1.10/gzip.c +@@ -58,6 +58,7 @@ static char const *const license_msg[] = + #include + #include + #include ++#include + #include + #include + #include +@@ -128,10 +129,20 @@ static char const *const license_msg[] = + + /* global buffers */ + +-DECLARE(uch, inbuf, INBUFSIZ +INBUF_EXTRA); +-DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); ++/* With IBM_Z_DFLTCC, DEFLATE COMPRESSION works faster with ++ page-aligned input and output buffers, and requires page-aligned ++ windows; the alignment requirement is 4096. On other platforms ++ alignment doesn't hurt, and alignment up to 8192 is portable so ++ let's do that. */ ++#ifdef __alignas_is_defined ++# define BUFFER_ALIGNED alignas (8192) ++#else ++# define BUFFER_ALIGNED /**/ ++#endif ++DECLARE(uch BUFFER_ALIGNED, inbuf, INBUFSIZ +INBUF_EXTRA); ++DECLARE(uch BUFFER_ALIGNED, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); + DECLARE(ush, d_buf, DIST_BUFSIZE); +-DECLARE(uch, window, 2L*WSIZE); ++DECLARE(uch BUFFER_ALIGNED, window, 2L*WSIZE); + #ifndef MAXSEG_64K + DECLARE(ush, tab_prefix, 1L< $name || framework_failure_ + + fail=0 + + znew -K $name || fail=1 +-test -f $name || fail=1 ++test -f $name || test -f $gzname || fail=1 + + Exit $fail +Index: gzip-1.10/unzip.c +=================================================================== +--- gzip-1.10.orig/unzip.c ++++ gzip-1.10/unzip.c +@@ -129,7 +129,11 @@ int unzip(in, out) + /* Decompress */ + if (method == DEFLATED) { + ++#ifdef IBM_Z_DFLTCC ++ int res = dfltcc_inflate (); ++#else + int res = inflate(); ++#endif + + if (res == 3) { + xalloc_die (); +Index: gzip-1.10/util.c +=================================================================== +--- gzip-1.10.orig/util.c ++++ gzip-1.10/util.c +@@ -96,6 +96,9 @@ static const ulg crc_32_tab[] = { + 0x2d02ef8dL + }; + ++/* Shift register contents. */ ++static ulg crc = 0xffffffffL; ++ + /* =========================================================================== + * Copy input to output unchanged: zcat == cat with --force. + * IN assertion: insize bytes have already been read in inbuf and inptr bytes +@@ -126,13 +129,11 @@ int copy(in, out) + * Return the current crc in either case. + */ + ulg updcrc(s, n) +- uch *s; /* pointer to bytes to pump through */ ++ const uch *s; /* pointer to bytes to pump through */ + unsigned n; /* number of bytes in s[] */ + { + register ulg c; /* temporary variable */ + +- static ulg crc = (ulg)0xffffffffL; /* shift register contents */ +- + if (s == NULL) { + c = 0xffffffffL; + } else { +@@ -145,6 +146,20 @@ ulg updcrc(s, n) + return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ + } + ++/* Return a current CRC value. */ ++ulg ++getcrc (void) ++{ ++ return crc ^ 0xffffffffL; ++} ++ ++/* Set a new CRC value. */ ++void ++setcrc (ulg c) ++{ ++ crc = c ^ 0xffffffffL; ++} ++ + /* =========================================================================== + * Clear input and output buffers + */ +@@ -238,7 +253,8 @@ void flush_outbuf() + { + if (outcnt == 0) return; + +- write_buf(ofd, (char *)outbuf, outcnt); ++ if (!test) ++ write_buf (ofd, outbuf, outcnt); + bytes_out += (off_t)outcnt; + outcnt = 0; + } +Index: gzip-1.10/zip.c +=================================================================== +--- gzip-1.10.orig/zip.c ++++ gzip-1.10/zip.c +@@ -23,9 +23,11 @@ + #include "tailor.h" + #include "gzip.h" + +-local ulg crc; /* crc on uncompressed file data */ + off_t header_bytes; /* number of bytes in gzip header */ + ++/* Speed options for the general purpose bit flag. */ ++enum { SLOW = 2, FAST = 4 }; ++ + /* =========================================================================== + * Deflate in to out. + * IN assertions: the input and output buffers are cleared. +@@ -68,11 +70,14 @@ int zip(in, out) + put_long (stamp); + + /* Write deflated file to zip file */ +- crc = updcrc(0, 0); ++ updcrc (NULL, 0); + + bi_init(out); + ct_init(&attr, &method); +- lm_init(level, &deflate_flags); ++ if (level == 1) ++ deflate_flags |= FAST; ++ else if (level == 9) ++ deflate_flags |= SLOW; + + put_byte((uch)deflate_flags); /* extra flags */ + put_byte(OS_CODE); /* OS identifier */ +@@ -85,7 +90,11 @@ int zip(in, out) + } + header_bytes = (off_t)outcnt; + +- (void)deflate(); ++#ifdef IBM_Z_DFLTCC ++ dfltcc_deflate (level); ++#else ++ deflate (level); ++#endif + + #ifndef NO_SIZE_CHECK + /* Check input size +@@ -98,7 +107,7 @@ int zip(in, out) + #endif + + /* Write the crc and uncompressed size */ +- put_long(crc); ++ put_long (getcrc ()); + put_long((ulg)bytes_in); + header_bytes += 2*4; + +@@ -126,7 +135,7 @@ int file_read(buf, size) + read_error(); + } + +- crc = updcrc((uch*)buf, len); ++ updcrc ((uch *) buf, len); + bytes_in += (off_t)len; + return (int)len; + } +Index: gzip-1.10/NEWS +=================================================================== +--- gzip-1.10.orig/NEWS ++++ gzip-1.10/NEWS +@@ -20,6 +20,10 @@ GNU gzip NEWS + These bugs most likely do not happen on practical platforms. + [bugs present since the beginning] + ++** Performance improvements ++ ++ IBM Z platforms now support hardware-accelerated deflation. ++ + + * Noteworthy changes in release 1.9 (2018-01-07) [stable] + +Index: gzip-1.10/tests/hufts +=================================================================== +--- gzip-1.10.orig/tests/hufts ++++ gzip-1.10/tests/hufts +@@ -28,6 +28,7 @@ returns_ 1 gzip -dc "$abs_srcdir/hufts-s + compare /dev/null out || fail=1 + + sed 's/.*hufts-segv.gz: /...: /' err > k; mv k err || fail=1 ++grep -v 'Operation-Ending-Supplemental Code' err > k; mv k err || fail=1 + compare exp err || fail=1 + + printf '\037\213\010\000\060\060\060\060\060\060\144\000\000\000' > bug33501 \ +@@ -35,6 +36,7 @@ printf '\037\213\010\000\060\060\060\060 + printf '\ngzip: stdin: invalid compressed data--format violated\n' >exp33501 \ + || framework_failure_ + returns_ 1 gzip -d out33501 2> err33501 || fail=1 ++grep -v 'Operation-Ending-Supplemental Code' err33501 > k; mv k err33501 || fail=1 + compare exp33501 err33501 || fail=1 + + Exit $fail diff --git a/gzip-1.10.tar.xz.sig b/gzip-1.10.tar.xz.sig new file mode 100644 index 0000000..00b5962 --- /dev/null +++ b/gzip-1.10.tar.xz.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCgAdFiEEFV0/xQDINEhtHupnf9n8ywAL7u4FAlwoWScACgkQf9n8ywAL +7u5k8w/9GZSHRagqimmB5Gh7qu4yEtM8gByvidpTFbJlkxz0+hy/7ETNqmIEy38a +89idBNFseW2WlH9A2aw4beP1s288k71AubnWp347OFMACCw/1pUmAdq8UsR3gxMS +G0jLEGVOIy8sUcrNTCqramNfQEZSZFFtC8jAPy4t9kYQRRXHqmHBQJKa7FxteA+x +3JXtHSV6AYOC3iBXCZffipi44r5eEh4fVSakWK8IzzYlYdwzHZ541CT/tMg+iWgf +BPEXV4BF9xwTYzwac8UkG8Cx/OPFnUumSITK8EOLsHa+sorItGmXI84L9UBp9SiC +tzJsOvmoXffDcO565sbfnA6kpA9siQCJ0MGWwalUULwvSufRxlxSDlCcyNiyL7Ki +S1bXaO594EfmBPetvllsQ0EMvrtPk2WL1Oan+5V0Ljkq8CBTvbIXrVNO/PWlAicK +6JzR30LSLSHa3eVtRd3Eiozu+VlJdrbmm5f6+ZCley3nTtAvyQ8WJUMPwHupIfiF +Ov1aqD6w+Qn26GrJcPR/Q6+zc2JGpCMTo9u+24l/mQNfJOZxh99YxV58d6gN7TqN +iGiJOuN8fnUhhrcOrqpC7WoA1awfz8HSHZTeoXkSBrkEYyxPTQKZTpN9lhtZe7TY +Khjj1y00zT75THuhBQQLJGOwGqmc9b5bCCjcC6QT7OSlUVv4W10= +=/Dx0 +-----END PGP SIGNATURE----- diff --git a/gzip.changes b/gzip.changes new file mode 100644 index 0000000..aa3211a --- /dev/null +++ b/gzip.changes @@ -0,0 +1,359 @@ +* Thu May 5 2022 danilo.spinella@suse.com +- Add support to zstd in zgrep, fixes bsc#1198922 + * xz_lzma.patch -> xz_lzma_zstd.patch +* Thu Apr 7 2022 danilo.spinella@suse.com +- Fix escaping of malicious filenames (CVE-2022-1271 bsc#1198062) + * bsc1198062.patch + * bsc1198062-2.patch +* Tue Apr 13 2021 pgajdos@suse.com +- fix DFLTCC segfault [bsc#1177047] +- added patches + fix https://git.savannah.gnu.org/cgit/gzip.git/commit/?id=be0a534ba2b6e77da289de8da79e70843b1028cc + + gzip-1.10-fix-DFLTCC-segfault.patch +* Thu Mar 4 2021 kstreitova@suse.com +- gzip.spec: move %%patch10 from the ifarch condition (mistake) +* Wed Jan 27 2021 kstreitova@suse.com +- add gzip-1.10-fix_count_of_lines_to_skip.patch to fix count + of lines to skip [bsc#1180713] +* Wed Sep 2 2020 kstreitova@suse.com +- Enable DFLTCC compression for s390x for levels 1-6 (i. e. to make + it used by default) by adding -DDFLTCC_LEVEL_MASK=0x7e to CLFAGS. + [jsc#SLE-13775] +* Tue Aug 27 2019 kstreitova@suse.com +- refresh gzip-1.10-ibm_dfltcc_support.patch to fix three data + corruption issues [bsc#1145276] [jsc#SLE-5818] [jsc#SLE-8914] +* Thu Jun 6 2019 kstreitova@suse.com +- add gzip-1.10-ibm_dfltcc_support.patch [jsc#SLE-5818] [jsc#SLE-8914] + * it adds support for DFLTCC (hardware-accelerated deflation) + for s390x arch + * enable it via "--enable-dfltcc" option +* Sun Dec 30 2018 astieger@suse.com +- gzip 1.10: + * Compressed gzip output no longer contains the current time as + a timestamp when the input is not a regular file. Instead, the + output contains a null (zero) timestamp. This makes gzip's + behavior more reproducible when used as part of a pipeline. + * A use of uninitialized memory on some malformed inputs has been + fixed. + * A few theoretical race conditions in signal handers have been + fixed. +- drop upstreamed patches: + * gnulib-libio.patch + * gzip-1.8-deprecate_netstat.patch +* Wed Aug 1 2018 schwab@suse.de +- gnulib-libio.patch: Update gnulib for libio.h removal +* Thu Feb 22 2018 fvogt@suse.com +- Use %%license (boo#1082318) +* Fri Jan 12 2018 meissner@suse.com +- license is GPL-3.0+ +* Thu Jan 11 2018 kbabioch@suse.com +- Update to 1.9 + * Fix suffix handling + * Fix bug when handling pack format while decompressing + * Fix time handling bug + * Improve exit code handling for shell scripts +- remove gzip-1.8-fix_unpack_EOB_check.patch as it is included + upstream now +- refresh manpage-no-date.patch +- spec file cleanups +* Tue Jan 2 2018 kstreitova@suse.com +- add gzip-1.8-deprecate_netstat.patch to get rid of deprecated + 'netstat -n' command in tests/init.sh script +* Fri Dec 1 2017 kstreitova@suse.com +- add gzip-1.8-fix_unpack_EOB_check.patch to fix mishandling of + leading zeros in the end-of-block code [bsc#1067891] +* Wed May 31 2017 bwiedemann@suse.com +- Make build reproducible in spite of gcc profile based optimizations + (boo#1040589) +* Tue May 30 2017 src@posteo.de +- changing the way how gcc profiling is generating to have a reproducible + build +* Tue Apr 11 2017 kstreitova@suse.com +- define %%{_buildshell} to /bin/bash as we newly rely on bash + features like {1..9} +* Thu Mar 23 2017 kstreitova@suse.com +- cleanup with spec-cleaner +- use loop with a range instead of a number list +* Wed Apr 27 2016 mpluskal@suse.com +- Update to 1.8 + * gzip -l no longer falsely reports a write error when writing to + a pipe. + * Port to Oracle Solaris Studio 12 on x86-64. + * When configuring gzip, ./configure DEFS='...-DNO_ASM...' now + suppresses assembler again. +- Small spec file cleanup +* Tue Mar 29 2016 tchvatal@suse.com +- Version update to release 1.7: + * gzip now accepts the --synchronous option + * gzip now accepts the --rsyncable option + * The GZIP environment variable is now obsolescent + * Installed programs like 'zgrep' now use the PATH environment variable as + usual to find subsidiary programs like 'gzip' and 'grep' +- Remove obsolete patch tempfile.diff +- Remove upstreamed patch gzip-rsyncable.diff +- Rebase manpage-no-date.patch to apply to 1.7 version +* Tue Mar 29 2016 tchvatal@suse.com +- Rename reproducible.patch to something actually explanatory: + * manpage-no-date.patch +* Sun Mar 20 2016 bwiedemann@suse.com +- Add reproducible.patch to fix build-compare +* Fri Dec 19 2014 meissner@suse.com +- build with PIE +* Mon May 12 2014 vdziewiecki@suse.com +- Remove unneeded update-alternatives requirement (bnc#876129) +- Clean spec +* Thu Sep 26 2013 schwab@suse.de +- Don't install twice +* Tue Jul 30 2013 sweet_f_a@gmx.de +- add the correct project URL +* Tue Jul 9 2013 schwab@suse.de +- Override broken configure checks +* Mon Jun 10 2013 jengelh@inai.de +- Update to new upstream release 1.6 + * The "--keep" (-k) option was added to not delete input files, + similar to other tools such as xz, lzip, and bzip2. + * A decompression issue with certain invalid data in the "pack" + format was fixed. + * An incorrect overwrite when compiled with optimization was fixed. + * zgrep's handling of multi-digit context options was fixed. + * zmore now acts more like "more". +- More robust make install call +- Provide files for signature verification (we do not actually do + it because gzip is part of the bootstrap cycle; but if you have + gpg-offline listed as Support or in ~/.oscrc, it will be done) +* Thu Mar 28 2013 mmeister@suse.com +- Added url as source. + Please see http://en.opensuse.org/SourceUrls +* Tue Jan 29 2013 vdziewiecki@suse.com +- Add support for xz and lzma (bnc#799561 - zgrep silently fails on + LZMA compressed files) - xz_lzma.patch +* Tue Oct 16 2012 vcizek@suse.com +- update to 1.5 + - gzip -cdf mishandles some concatenated input streams: test it + - gzip -cdf now handles concatenation of gzip'd and uncompressed data + - gzip: fix a data-loss bug when decompressing with --suffix='' + - gzip: fix nondeterministic compression results + - fix "znew -K" to work without use of compress utility + - Decode FHCRC flag properly, as per Internet RFC 1952. + - zgrep: fix parsing of -Eh options + - zgrep: terminate gracefully when a pipeline is interrupted by a signal + - zgrep: fix shell portability bug with -f; fix mishandling of "-e -" + - zless: decompress stdin too, if less 429 or later +- dropped gzip-stdio.in.patch, refreshed others +* Tue Jul 17 2012 aj@suse.de +- Fix build with missing gets declaration (glibc 2.16) +* Tue Feb 7 2012 rschweikert@suse.com +- keep binaries in /usr tree (UsrMerge project) +* Sat Nov 13 2010 cristian.rodriguez@opensuse.org +- disable silent rules. +* Sun Sep 19 2010 vuntz@opensuse.org +- Update to version 1.4: + + gzip -d could segfault and/or clobber the stack, possibly + leading to arbitrary code execution. This affects x86_64 but + not 32-bit systems. This fixes CVE-2010-0001. See also + rh#554418. + + gzip -d would fail with a CRC error for some valid inputs. + So far, the only valid input known to exhibit this failure was + compressed "from FAT filesystem (MS-DOS, OS/2, NT)". In + addition, to trigger the failure, your memcpy implementation + must copy in the "reverse" order. +- Drop gzip-CVE-2010-0001.diff: fixed upstream. +- Remove AutoReqProv: it's default now. +- Use %%configure, %%makeinstall, and %%{_bindir}. +- Update zdiff.diff: some of the patch is upstream now. It's + unclear to me if the rest is still needed :/ So leaving it. +- Rebase zgrep.diff. +* Mon Jun 28 2010 jengelh@medozas.de +- use %%_smp_mflags +* Tue Jan 19 2010 mseben@novell.com +- updated to 1.3.13 + - gzip interprets an argument of "-" as indicating stdin, but when + "-" is not the first name on the command line, it doesn't work. + - remove useless if-before-free tests + - remove useless casts to avoid "make syntax-check" failures + - avoid spurious warnings from clang + - avoid a leak on a error path + - don't misinterpret a failing test as successful + - avoid creating an undersized buffer for the hufts table + A malformed input file can cause gzip to crash with a segmentation + violation or hang in an endless loop. + - avoid silent data loss e.g., on NFS, due to unchecked close of stdout + - build require automake-1.11 and produce xz-compressed tarballs, too +- deprecated futimens.diff and CVE-2009-2624.diff +* Thu Jan 14 2010 mseben@novell.com +- added gzip-CVE-2009-2624.diff and gzip-CVE-2010-0001.diff : fix + possible denial of service and arbitrary code execution +* Sun Dec 6 2009 jengelh@medozas.de +- enabled parallel make +* Tue Mar 10 2009 sf@suse.de +- added doc files (README, TODO, ...) (bnc #414305) +* Wed Jan 7 2009 schwab@suse.de +- Fixup rsyncable patch. +* Thu May 8 2008 schwab@suse.de +- Fix zdiff with two compressed files. +* Sun May 20 2007 schwab@suse.de +- Fix compiling with glibc 2.6. +* Sat Apr 14 2007 schwab@suse.de +- Update to gzip 1.3.12. + * znew now uses $TMPDIR (default /tmp) instead of always using /tmp. +* Tue Mar 27 2007 dmueller@suse.de +- reenable profile feedback +- remove hardcoded -mcpu=pentiumpro for x86 +* Tue Feb 6 2007 schwab@suse.de +- Update to gzip 1.3.11. + * As per the GNU coding standards, the behavior of gzip and its + companion executables no longer depend on the name used to invoke them. + For example, 'gzip' and 'gunzip' are no longer hard links; + instead, 'gunzip' is now a small program that invokes 'gzip -d'. + * zdiff now checks for subsidiary gzip failures, and works around + bugs in IRIX 6 sh, Tru64 4.0F ksh, and Solaris 8 bash. +* Mon Jan 8 2007 schwab@suse.de +- Update to gzip 1.3.10. + * gzip -c and zcat now work on special files, files with special mode bits, + and files with multiple hard links. + * gzip -q now exits with status 2 (not 1) when SIGPIPE is received. + * zcmp and zdiff did not work in the usual case, due to a typo. + * zgrep has many bugs fixed with argument handling, special characters, + and exit status. + * zless no longer mishandles $%%=~ in file names. +* Fri Dec 15 2006 schwab@suse.de +- Update to gzip 1.3.9. + * No major changes; only porting fixes. +* Tue Dec 12 2006 schwab@suse.de +- Update to gzip 1.3.8. + * Fix some gzip problems: + - A security fix from Debian 1.3.5-5 was inadvertently omitted. + - The assembler is now invoked with --noexecstack if supported, + so that gzip can better resist stack-smashing attacks. +* Thu Dec 7 2006 schwab@suse.de +- Update to gzip 1.3.7. + * Fix some gzip problems: + - Refuse to compress setuid or setgid files, or files with the sticky bit. + - Fix more race conditions in setting file permissions and owner, + removing output files, following symbolic links, and dealing with + special files. + - Remove most of the code working around ENAMETOOLONG deficiencies. + Systems with those deficiencies are long-dead, and the workarounds + had race conditions on modern hosts. + - Catch CPU time and file size limit signals, too. + - Check for read errors when closing files. + - Fix a core dump caused by a stray abort mistakenly introduced in 1.3.6. + * Fix some gzexe problems: + - Improve resistance to denial-of-service attacks. + - Fix some quoting and escaping bugs. + - Do not assume /tmp is sticky (though it should be!). + - Do not assume the working directory can be written. + - Rely on PATH in the generated executable, as the man page says. + - Don't assume IFS is sane. + - Exit with signal's status, if signaled. +* Mon Dec 4 2006 schwab@suse.de +- Update to gzip 1.3.6. + * Fix some race conditions in setting file time stamps, permissions, and owner. + * Fix some race conditions in signal handling. + * When gzip exits due to a signal, it exits with the signal's status, not 1. + * gzip now restores file time stamps to the resolution supported by the + time-setting primitives of the operating system, typically 1 microsecond. + Formerly it restored them only to the nearest second. + * gzip -r no longer attempts to reset the last-access times of directories + it reads, as this messes up when other processes are reading the directories. + * The options --version and --help now work on all gzip-installed executables, + and now use a format similar to other GNU programs. + * The manual is now distributed under the terms of the GNU Free + Documentation License without invariant sections or cover texts. + * Port to current versions of Autoconf, Automake, and Gnulib. +* Wed Sep 13 2006 schwab@suse.de +- Verify hash tables when unpacking [#202365]. +* Mon Mar 13 2006 schwab@suse.de +- Add rsyncable patch [#155442]. +* Wed Jan 25 2006 mls@suse.de +- converted neededforbuild to BuildRequires +* Fri Nov 11 2005 pth@suse.de +- Don't obsolete compress. +* Mon Oct 31 2005 dmueller@suse.de +- build with non-executable stack +* Tue Jul 26 2005 schwab@suse.de +- Ignore directory part on saved file name [#79292]. +* Tue Apr 19 2005 kukuk@suse.de +- Remove uncompress symlink [#78331] +* Thu Mar 24 2005 werner@suse.de +- Add support for bzip2 and simply pager options to zmore +* Mon May 3 2004 schwab@suse.de +- Fix quoting issues in zgrep [#39329]. +* Fri Feb 27 2004 schwab@suse.de +- Add %%defattr. +* Tue Dec 2 2003 pthomas@suse.de +- Remove the patch for tail syntax as it's wrong and unnecessary. +* Thu Sep 18 2003 mmj@suse.de +- Fix tail syntax in gzexe [#31229] +* Thu Aug 28 2003 kukuk@suse.de +- Make sure we have no hardlinks from /bin to /usr/bin [Bug #29522] +* Tue Jun 17 2003 pthomas@suse.de +- Update to 1.3.5 + - gzip now removes any output symlink before writing output file. + - zgrep etc. scripts now port to POSIX 1003.1-2001 hosts. + - zforce no longer assumes 14-byte file name length limit. + - zless is now implemented using less and LESSOPEN, not zmore and PAGER. + - assembly-language speedups reenabled; were mistakenly disabled in 1.3. + - Less output is lost when decompressing a truncated file. + - zgrep now supports --, -H, -h, -L, -l, -C, -d, -m and their long + equivalents. +* Wed Jun 4 2003 jh@suse.de +- Enable profile feedback +* Thu Apr 24 2003 ro@suse.de +- fix install_info --delete call and move from preun to postun +* Tue Apr 15 2003 coolo@suse.de +- use BuildRoot +* Sat Feb 8 2003 kukuk@suse.de +- Readded prereq for install-info, else we cannot install info + pages +- Add dir entry to info page +* Sat Feb 8 2003 ro@suse.de +- removed prereq for texinfo to avoid prereq-cycle +* Fri Feb 7 2003 ro@suse.de +- added install_info macros +* Wed Jan 29 2003 kukuk@suse.de +- Remove mimencode requires, it is optional +* Tue Dec 17 2002 werner@suse.de +- The `:' line of zgrep will be removed by configure +- zgrep requzires mimencode from metamail +* Tue Sep 17 2002 ro@suse.de +- removed bogus self-provides +* Thu Mar 14 2002 kukuk@suse.de +- Add uncompress compat link +* Wed Feb 6 2002 coolo@suse.de +- use %%suse_update_config +* Thu Jan 24 2002 okir@suse.de +- fixed tempfile race in zdiff (current code used bash noclobber + which is inherently racey) +* Wed Jun 6 2001 werner@suse.de +- Make zgrep knowing about bzip2 +* Tue Apr 3 2001 uli@suse.de +- fixed for gcc >2.96 +* Tue Mar 27 2001 bk@suse.de +- use i686 insn scheduling on i386 and strip binaries(performance) +- make tmpfiles in gzexe secure and improve znew tempdir creation +- remove unnessary expr use and fix gzip output checking in zforce +- add simple tests if gzip/gunzip work +* Mon Nov 27 2000 aj@suse.de +- Update to gzip 1.3. +* Wed Aug 23 2000 werner@suse.de +- Security changes for the znew script +* Mon May 1 2000 kukuk@suse.de +- LSB-FHS requires /bin/gunzip and /bin/zcat to /bin/gzip +* Tue Apr 18 2000 kukuk@suse.de +- Add /bin/zcat (required by FHS 2.1) +* Fri Feb 25 2000 schwab@suse.de +- cleanup spec file, get rid of Makefile.Linux +- define _GNU_SOURCE for basename declaration +- /usr/man -> /usr/share/man +- add gzip.info to file list +* Mon Sep 13 1999 bs@suse.de +- ran old prepare_spec on spec file to switch to new prepare_spec. +* Fri Mar 6 1998 florian@suse.de +- fixed security bug posted on Dez 27 to bugtraq +* Thu Jan 8 1998 bs@suse.de +- fixed "double" /bin/gzip & /usr/bin/gzip +* Thu Apr 24 1997 bs@suse.de +- added symlink /bin/gunzip +* Sun Apr 13 1997 florian@suse.de +- add bug-fixes from gnu.utils.bugs diff --git a/gzip.keyring b/gzip.keyring new file mode 100644 index 0000000..d1933d6 --- /dev/null +++ b/gzip.keyring @@ -0,0 +1,72 @@ +pub 4096R/000BEEEE 2010-06-14 +uid Jim Meyering +uid Jim Meyering +uid Jim Meyering +uid [ opphevet] Jim Meyering + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.0.19 (GNU/Linux) + +mQINBEwWvdkBEACyOXTiLBZ5MFNM6jmm83ui3MqW0/eD8TcAI4gt0gwOvd/jXerI +ros8dRVook7FBoNiFSiJSMVOiNPUMfv5h5wZm0bje33qTJPL7IanSKXtk/I7Za1G +EJfEnfgZI/d4EIV8wrl0WI1lPEteTgRJbo76zfLIUOHpynVC2Wm5gALJ4oeJIS0A +hYSzbFmHD9dFI7m3sO/HmbhxTiMISy0FbmoqE/cpo8ZX6eahND2UrS2oGNC0Ok8/ +nN8XLPPsikx35FKx6bDTfoAK/svx6PK1sSPfAdoZFZ5Jy6Ti4zubebUD+5I8+bOn +6R9I7P0HerCTqMBLnf9LJHTPhTk8fHEwlAeH+WfpEmN9/4YORb84WY97tFbVK4f/ +icEjnYBc0Ozl4qMGI1g/1R5Q9Z8qxLGsW9tNWyIfAf+2BhLA08RfA0wxmEf2Gnfp +J379s5c0U8xLZegOGRF1tOAEIC+5wRKFN/qU9zpLbUZIGrB+ysVeTlDuCDnTnyUe +WBQeRnfItl4taEN0/axNGB/NuHvxShyzxez/flbyqKwsxc35/a2OCbwmADeUh+ct +sYUGZya/GuXfejWbCuaqZLLkP6Ed9k4+LY+ww6jA7uNPRXpCYoXFo2WN9OaIqfb/ +RDk6zW708qbxvcWKe6j9f8R0lPMYdtUzZhyxZxeZ0/2BdDyXAj1Wvnw1UwARAQAB +tB5KaW0gTWV5ZXJpbmcgPG1leWVyaW5nQGZiLmNvbT6JAjcEEwECACEFAlDwG/0C +Gy8FCwkIBwMFFQoJCAsFFgMCAQACHgECF4AACgkQf9n8ywAL7u75Ag/+IzQ1hoL/ +qwCsVjhFdi2WloZ3+HREC1aeyAKiOduQijWg3dd4YZQeMGFHMgIqaHHOxWAijJP/ +Qi5Y/k5cotE/gUSPX2lEldF+bA1ZpzgZbOiqfjpTFmsy8nXAeDRLusc8Tn/+vQVa +l9ZzcfG21CUEZaDLk+8OFpj8poqczPMsNpmsuy7CjK8TRIoHMVJk+h/P1AYaQpQw +qRg8+/Fzn1AnnNcVnRTE13lcfrG9EmCfF1A+Auy9BsPe2j0LlZHhXGOrK2JGUGO6 +er+yQLy1STsRFw0b/jVp3hbsT8qcLxYx+Ekhli4OeF1pXZRlvbKHQcguuRgBdFtF +nnpcWkHyAVUP4Mpwf3eZRcQnbdDIf42VdAVoh8DKHc3Fxr+NABlj+851SuKoNn4/ +liAOxBku4Za6flHM7EMPLgpkzoB934s1HNNTrfPS6f+9G+C1p7kWuGl/lBq0pWho +t1v8ojQci2UHnxQu+RY4PTpBH2TwqwolpxZERG/pFADsw/peoTgTNdeY059amgvZ +mKk29krXgV4OW083GTM2UTtnrycNvLF4d93EcIZX3Rot0uxYg6g0Btu1ifRJFmzi +XflYoBnIc//971j2Ty7oM1xq+lUiG1oCYKwfbc4ewFjMrLfqtlO/OV2T2spm9cVy +w3e78u3DDEUaTxa4oKt2W2B/XTJb4fx0VCi0H0ppbSBNZXllcmluZyA8amltQG1l +eWVyaW5nLm5ldD6JAjoEEwEIACQCGy8FCwkIBwMFFQoJCAsFFgIDAQACHgECF4AF +AkwXdFQCGQEACgkQf9n8ywAL7u6hfQ/+J5VFGee4r5JF3M+ImCzLmidwRk7Ah2Gu +a1Xv8MvH05kSxUGXp83a3F3Zgo60sRzQ569EBjhCu2Hewz3p3nfWgYqnkKuCIOhg +7oq7dirEaFatdTHgN7tuACI2m60ncdgQa9S13tmmEy407iZqYQJNtLFDe/r6Fcf6 +cDFnjiIsVdk1WPyw3gLs/gjgh+MmyQRtotULAHFPSuq1v2SdE3umaillGH9gSfoa +U8PUdnKRgyaOHA7mC0EHdgHk8Fte+5ZtpbAnWJL7IlZw5ul6br4q3Ry/5UL9GbbR +/ma9AMAYEt42NMhLLnaOHbiVC7iyNqSoVsoLY8VFWprHxd3xe+WtzdEMSLqd6lvm +CF9B+IAsLvvQaas2v+FtOKuDDRcWMFm/ulyPxa5ewSabgB/xhr1n2KROBJuyGXuI +BCzj2XTt2mCjfs6aMV7COoLiDoVDrc3SjM7SIUvndgemQ7dCGmWEAJsRHHU1KW7X +H3ycYi2waiFPL16hTaUGi0sjIR50OOMbzA/JBwUj1rocK5OM1RbdZk4vu1GQwZuD +BGsVvL6eciXPFEWrJNbdqaCYiSKVGByPVUUgLC6qPcVYezCOcdJTrBae9Y+me8B4 +K8hNAU3t/fGlOFxt8Ka5daoPLHbyw9EWo9QNWEHlTOhqhB3w04YJBwrxeI07uRm0 +UhqufTRftUG0H0ppbSBNZXllcmluZyA8bWV5ZXJpbmdAZ251Lm9yZz6JAjcEEwEI +ACEFAkwXc5MCGy8FCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQf9n8ywAL7u7d +Xg//TD0dsvwMl5gGSJspUHz08vwcM9zp2fldabi1GMC0q73nYnoUH9wHLVcPJ77C +Rqh+9lyvd230hnHPPbMksg/L6YetnVAo0NUz8pxx1hZBw8fJDvl4NxTgs8FbwtxL +/ZnAs/RHzEEiECbWWnxaEWYuZAGD4S8u6fnzNfPCYbf/dCEdO4O+FIumPoJCJF9o +rHd3rvtB+P41YKaY1+K8lM02BoY3fXRwbCvX1Rn965/BtIJiUDJLxEXUk2Gq6pZ9 +zPcHKQjHcGs+2zS/Z6wmhuTEhFmpCw0jIt9rzMs5i5JOB0eqLtKD9C6tURA1KK1e +XUvE4X8F7kaXkfPXhLzdLZskTt0kbNr+YU5AZtEDWplaw71t376JKOyn7yLqYLJL +R0KMmn1DpU4kFSMK+zufLGo0gmp0054hwBqM0q8V69AhfJQB/AV9MnpJ4h23N1kI +RxfYMThZr29PBFR0xkq6hOW7sfbZmQDL8j6NaMKWVJx7cFDzMkXXGozuBltjFGa+ +q0Vf9QpDGiMPXIUz9elRZQ/pPP6ha6pycpElp9LJ9DumBAtG2bimhhlEXNP0L7H5 +TQefDCgmfVY2DuyxbPP5knAmvEW4pEXd+UZ+epsRve5mu8yAHp+vznGM+SuBp1sG +UL5VmkFtNnpXhW6hco2s3egz7hZOlsH+L8BbAmw5E+tGfP60IkppbSBNZXllcmlu +ZyA8bWV5ZXJpbmdAcmVkaGF0LmNvbT6JAh8EMAEIAAkFAlCBOrICHSAACgkQf9n8 +ywAL7u7aJQ/+IJqpTT55uVMvnvVGsSnSGEm0Fbirbra3yncsV/9DF5iNpYj3deCf +A4YdKLrcn+F7sep+62rMtk+Pwik1rbU98bbcd/rH0Zg92ePlS2gingyi166XkQs8 +Vgx1WsUH9gGA/vRmtSdso4Gbod1ucmePliMxIxDF3a7zRte9T8GuYFW/cD/yozHi +JrL2k7nVor6+YbIvePToEP/p0XLGeYUn2iZ1XCEp9na2Odw7/g9Z/78aJAXsCvWN +MVXYbKv67lx+4p2u5kwg34gOpnoBfFVMDy+xQYYRM8XrOrcRMnUlBNdFDYue7EB+ +E65PfKfzPaTLPBI2eeeyrBg72H9PG9IY5TDFdvm2KCO7GMnd4Kjg9h9d+r1kfZAX +zXHpzkHMpxarvNoAovaxAr8Xh0lP5PwlMA0GkZXpSTXImYrobwLeR2sowGbwXazq +ozsroO7LGwaI8cRcGmXtCMQR+iS/c2gp80tzKazP+7ao+C/AZr67gzrnJY5uO000 +Vd5lRaTG1T11feTbAhnxFSmQUE5TnUIOfss2dCCO6CMqcrlac6QTYEolgWRBN/Fo +3zAVAPpbXsqY+OEPnHwwWJeCv9ZprW36PRIjktfw4igP38wTimZ0onI4j0SlKLIT +V1KlGZVpG2onBn/Ly5HGepqZd7VbRQTruLXpWEpn56YN+vtrthw1wcM= +=Q4hV +-----END PGP PUBLIC KEY BLOCK----- diff --git a/gzip.spec b/gzip.spec new file mode 100644 index 0000000..4a82864 --- /dev/null +++ b/gzip.spec @@ -0,0 +1,159 @@ +# +# spec file for package gzip +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +%define _buildshell /bin/bash +Name: gzip +Version: 1.10 +Release: 150200.10.1 +Summary: GNU Zip Compression Utilities +License: GPL-3.0-or-later +Group: Productivity/Archiving/Compression +URL: http://www.gnu.org/software/gzip/ +Source: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Source2: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig +Source3: %{name}.keyring +Patch0: zgrep.diff +Patch2: zmore.diff +Patch3: non-exec-stack.diff +Patch6: zdiff.diff +# PATCH FIX OPENSUSE BNC#799561 - zgrep silently fails on LZMA compressed files +# PATCH-FIX-SUSE bsc#1198922 - add support for zstd files as well +Patch7: xz_lzma_zstd.patch +Patch8: manpage-no-date.patch +Patch9: gzip-1.10-ibm_dfltcc_support.patch +Patch10: gzip-1.10-fix_count_of_lines_to_skip.patch +# https://git.savannah.gnu.org/cgit/gzip.git/commit/?id=be0a534ba2b6e77da289de8da79e70843b1028cc +Patch11: gzip-1.10-fix-DFLTCC-segfault.patch +# PATCH-FIX-SECURITY bsc#1198062 danilo.spinella@suse.com +Patch12: bsc1198062.patch +Patch13: bsc1198062-2.patch +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: makeinfo +BuildRequires: xz +Requires(post): %{install_info_prereq} +Requires(preun): %{install_info_prereq} + +%description +Gzip reduces the size of the named files using Lempel-Ziv coding LZ77. +Whenever possible, each file is replaced by one with the extension .gz, +while keeping the same ownership modes and access and modification +times. + +%prep +%setup -q +%patch0 +%patch2 -p1 +%patch3 +%patch6 +%patch7 -p1 +%patch8 -p1 +%ifarch s390x +%patch9 -p1 +%endif +%patch10 -p1 +%ifarch s390x +%patch11 -p1 +%endif +%patch12 -p1 +%patch13 -p1 + +%build +export CFLAGS="%{optflags} -fomit-frame-pointer \ +-W -Wall -Wno-unused-parameter -Wstrict-prototypes -Wpointer-arith -fPIE" +export LDFLAGS="-pie" +# added because of gzip-1.10-ibm_dfltcc_support.patch [jsc#SLE-5818] +autoreconf -f -i +%ifarch s390x +export CFLAGS="$CFLAGS -DDFLTCC_LEVEL_MASK=0x7e" +%endif +%configure --disable-silent-rules \ + gl_cv_func_printf_directive_n=yes \ + gl_cv_func_printf_infinite_long_double=yes \ +%ifarch s390x + --enable-dfltcc \ +%endif + +profile_gzip() +{ + tmpfile=$(mktemp) + trap "rm -f $tmpfile $tmpfile.gz" EXIT + xz -cd %{SOURCE0} > $tmpfile + time ./gzip < $tmpfile > $tmpfile.gz + time ./gzip -d < $tmpfile.gz > /dev/null +} +%if %{do_profiling} +make %{?_smp_mflags} CFLAGS="$CFLAGS -fprofile-generate" LDFLAGS="-pie" +profile_gzip +make clean %{?_smp_mflags} +make %{?_smp_mflags} CFLAGS="$CFLAGS -fprofile-use" LDFLAGS="-pie" +%else +make %{?_smp_mflags} LDFLAGS="-pie" +%endif + +%check +for i in {1..9}; do + for f in build-aux/texinfo.tex /bin/bash; do + basef=${f##*/} + time ./gzip -$i < $f > $basef.gz + ./gzip --test $basef.gz + ./gzip -d < $basef.gz > $basef.test$i + cmp $f $basef.test$i + done +done + +%install +%make_install +#UsrMerge +mkdir -p %{buildroot}/bin +ln -sf %{_bindir}/gzip %{_bindir}/gunzip %{_bindir}/zcat %{buildroot}/bin +#EndUsrMerge +ln -sf zmore %{buildroot}%{_bindir}/zless +ln -sf zmore.1 %{buildroot}%{_mandir}/man1/zless.1 + +%post +%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info} + +%preun +%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info} + +%files +%license COPYING +%doc README AUTHORS ChangeLog TODO NEWS THANKS +#UsrMerge +/bin/gunzip +/bin/gzip +/bin/zcat +#EndUsrMerge +%{_bindir}/gunzip +%{_bindir}/gzexe +%{_bindir}/gzip +%{_bindir}/uncompress +%{_bindir}/zcat +%{_bindir}/zcmp +%{_bindir}/zdiff +%{_bindir}/zegrep +%{_bindir}/zfgrep +%{_bindir}/zforce +%{_bindir}/zgrep +%{_bindir}/zless +%{_bindir}/zmore +%{_bindir}/znew +%{_infodir}/gzip.info%{?ext_info} +%{_mandir}/man1/gunzip.1%{?ext_man} +%{_mandir}/man1/gzexe.1%{?ext_man} +%{_mandir}/man1/gzip.1%{?ext_man} +%{_mandir}/man1/zcat.1%{?ext_man} +%{_mandir}/man1/zcmp.1%{?ext_man} +%{_mandir}/man1/zdiff.1%{?ext_man} +%{_mandir}/man1/zforce.1%{?ext_man} +%{_mandir}/man1/zgrep.1%{?ext_man} +%{_mandir}/man1/zless.1%{?ext_man} +%{_mandir}/man1/zmore.1%{?ext_man} +%{_mandir}/man1/znew.1%{?ext_man} + +%changelog diff --git a/manpage-no-date.patch b/manpage-no-date.patch new file mode 100644 index 0000000..fe40a4c --- /dev/null +++ b/manpage-no-date.patch @@ -0,0 +1,21 @@ +Index: gzip-1.9/doc/gzip.texi +=================================================================== +--- gzip-1.9.orig/doc/gzip.texi ++++ gzip-1.9/doc/gzip.texi +@@ -9,7 +9,7 @@ + @c %**end of header + @copying + This manual is for GNU Gzip +-(version @value{VERSION}, @value{UPDATED}), ++(version @value{VERSION}), + and documents commands for compressing and decompressing data. + + Copyright @copyright{} 1998-1999, 2001-2002, 2006-2007, 2009-2018 Free Software +@@ -47,7 +47,6 @@ Free Documentation License''. + @title GNU gzip + @subtitle The data compression program + @subtitle for Gzip version @value{VERSION} +-@subtitle @value{UPDATED} + @author by Jean-loup Gailly + + @page diff --git a/non-exec-stack.diff b/non-exec-stack.diff new file mode 100644 index 0000000..238c07e --- /dev/null +++ b/non-exec-stack.diff @@ -0,0 +1,9 @@ +Index: lib/match.c +=================================================================== +--- lib/match.c.orig ++++ lib/match.c +@@ -770,3 +770,4 @@ match_init: + # endif /* __ia64__ */ + #endif /* mc68000 || mc68020 */ + #endif /* i386 || _I386 */ ++ .section .note.GNU-stack,"",@progbits diff --git a/xz_lzma_zstd.patch b/xz_lzma_zstd.patch new file mode 100644 index 0000000..a247760 --- /dev/null +++ b/xz_lzma_zstd.patch @@ -0,0 +1,33 @@ +Index: gzip-1.10/zgrep.1 +=================================================================== +--- gzip-1.10.orig/zgrep.1 ++++ gzip-1.10/zgrep.1 +@@ -11,7 +11,7 @@ The + .I Zgrep + invokes + .I grep +-on compressed or gzipped files. ++on compressed, xz'ed, lzma'ed, zstd'ed, bzip2'ed or gzipped files. + All options specified are passed directly to + .IR grep . + If no file is specified, then the standard input is decompressed +Index: gzip-1.10/zgrep.in +=================================================================== +--- gzip-1.10.orig/zgrep.in ++++ gzip-1.10/zgrep.in +@@ -215,6 +215,15 @@ do + *.bz2) + uncompress=bzip2 + ;; ++ *.xz) ++ uncompress=xz ++ ;; ++ *.lzma) ++ uncompress=lzma ++ ;; ++ *.zst) ++ uncompress=zstd ++ ;; + *) + uncompress=gzip + ;; diff --git a/zdiff.diff b/zdiff.diff new file mode 100644 index 0000000..e3a6f11 --- /dev/null +++ b/zdiff.diff @@ -0,0 +1,17 @@ +Index: zdiff.in +=================================================================== +--- zdiff.in.orig 2012-01-01 09:53:58.000000000 +0100 ++++ zdiff.in 2012-10-16 13:40:46.854905141 +0200 +@@ -105,9 +105,9 @@ elif test $# -eq 2; then + 5<&0 + then + gzip_status=$( +- exec 4>&1 +- (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- | +- ( (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- &1 6<&0 ++ (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- 6<&- | ++ ( (gzip -cdfq -- "$2" 4>&- 0<&6 6<&-; echo $? >&4) 3>&- 5<&- &3) 5<&0 + ) + cmp_status=$? diff --git a/zgrep.diff b/zgrep.diff new file mode 100644 index 0000000..3136e9b --- /dev/null +++ b/zgrep.diff @@ -0,0 +1,24 @@ +Index: zgrep.in +=================================================================== +--- zgrep.in.orig 2012-01-01 09:53:58.000000000 +0100 ++++ zgrep.in 2012-10-16 13:22:26.304769138 +0200 +@@ -174,10 +174,18 @@ res=0 + + for i + do ++ case $i in ++ *.bz2) ++ uncompress=bzip2 ++ ;; ++ *) ++ uncompress=gzip ++ ;; ++ esac + # Fail if gzip or grep (or sed) fails. + gzip_status=$( + exec 5>&1 +- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | ++ ($uncompress -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/zmore.diff b/zmore.diff new file mode 100644 index 0000000..89cf401 --- /dev/null +++ b/zmore.diff @@ -0,0 +1,44 @@ +--- + zmore.in | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +Index: gzip-1.6/zmore.in +=================================================================== +--- gzip-1.6.orig/zmore.in ++++ gzip-1.6/zmore.in +@@ -44,6 +44,29 @@ case $1 in + exit 1;; + esac + ++opt= ++pager () ++{ ++ eval ${PAGER-more} \$opt ++ cat > /dev/null ++} ++ ++while :; do ++ case $1 in ++ --) ++ shift ++ break ++ ;; ++ [-+]*) ++ opt="$opt $1" ++ shift ++ ;; ++ *) ++ break ++ ;; ++ esac ++done ++ + if test $# = 0; then + if test -t 0; then + printf >&2 '%s\n' "$0: missing operands; try '$0 --help' for help" +@@ -57,4 +80,4 @@ do + test $# -lt 2 || + printf '::::::::::::::\n%s\n::::::::::::::\n' "$FILE" || break + gzip -cdfq -- "$FILE" +-done 2>&1 | eval ${PAGER-more} ++done 2>&1 | pager