SHA256
1
0
forked from pool/gzip

Accepting request 138375 from home:vitezslav_cizek:branches:Base:System

- 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

OBS-URL: https://build.opensuse.org/request/show/138375
OBS-URL: https://build.opensuse.org/package/show/Base:System/gzip?expand=0&rev=20
This commit is contained in:
Marcus Meissner 2012-10-17 09:19:18 +00:00 committed by Git OBS Bridge
parent 3a51a4ab67
commit aa667cf72c
9 changed files with 91 additions and 95 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d166cfd3da380da1bd535633e8890bfb5664f9e68870a611d1dc01a3e9f711ee
size 907411

3
gzip-1.5.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b5d56e8ffc9918e8c941fab56e04121194f9870adeeb859e09c09eac264035a3
size 1114684

View File

@ -5,10 +5,10 @@ tried out in the default gzip for Debian Sarge, and may go into the
upstream gzip at somepoint in the not-too-distant future. upstream gzip at somepoint in the not-too-distant future.
================================================================================ ================================================================================
Index: gzip-1.3.13/deflate.c Index: gzip-1.5/deflate.c
=================================================================== ===================================================================
--- gzip-1.3.13.orig/deflate.c --- gzip-1.5.orig/deflate.c 2012-04-24 18:25:28.000000000 +0200
+++ gzip-1.3.13/deflate.c +++ gzip-1.5/deflate.c 2012-10-16 13:56:09.316621817 +0200
@@ -131,6 +131,14 @@ @@ -131,6 +131,14 @@
#endif #endif
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
@ -25,7 +25,7 @@ Index: gzip-1.3.13/deflate.c
* Local data used by the "longest match" routines. * Local data used by the "longest match" routines.
*/ */
@@ -212,6 +220,8 @@ local int compr_level; @@ -212,6 +220,8 @@ local int compr_level;
unsigned near good_match; unsigned good_match;
/* Use a faster search when the previous match is longer than this */ /* Use a faster search when the previous match is longer than this */
+local ulg rsync_sum; /* rolling sum of rsync window */ +local ulg rsync_sum; /* rolling sum of rsync window */
@ -33,7 +33,7 @@ Index: gzip-1.3.13/deflate.c
/* Values for max_lazy_match, good_match and max_chain_length, depending on /* Values for max_lazy_match, good_match and max_chain_length, depending on
* the desired pack level (0..9). The values given below have been tuned to * the desired pack level (0..9). The values given below have been tuned to
@@ -310,6 +320,10 @@ void lm_init (pack_level, flags) @@ -314,6 +324,10 @@ void lm_init (pack_level, flags)
#endif #endif
/* prev will be initialized on the fly */ /* prev will be initialized on the fly */
@ -44,7 +44,7 @@ Index: gzip-1.3.13/deflate.c
/* Set the default configuration parameters: /* Set the default configuration parameters:
*/ */
max_lazy_match = configuration_table[pack_level].max_lazy; max_lazy_match = configuration_table[pack_level].max_lazy;
@@ -546,6 +560,8 @@ local void fill_window() @@ -550,6 +564,8 @@ local void fill_window()
memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE); memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
match_start -= WSIZE; match_start -= WSIZE;
strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */ strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */
@ -53,7 +53,7 @@ Index: gzip-1.3.13/deflate.c
block_start -= (long) WSIZE; block_start -= (long) WSIZE;
@@ -573,13 +589,46 @@ local void fill_window() @@ -579,13 +595,46 @@ local void fill_window()
} }
} }
@ -101,7 +101,7 @@ Index: gzip-1.3.13/deflate.c
/* =========================================================================== /* ===========================================================================
* Processes a new input file and return its compressed length. This * Processes a new input file and return its compressed length. This
@@ -590,7 +639,7 @@ local void fill_window() @@ -596,7 +645,7 @@ local void fill_window()
local off_t deflate_fast() local off_t deflate_fast()
{ {
IPos hash_head; /* head of the hash chain */ IPos hash_head; /* head of the hash chain */
@ -110,30 +110,29 @@ Index: gzip-1.3.13/deflate.c
unsigned match_length = 0; /* length of best match */ unsigned match_length = 0; /* length of best match */
prev_length = MIN_MATCH-1; prev_length = MIN_MATCH-1;
@@ -620,6 +669,7 @@ local off_t deflate_fast() @@ -626,6 +675,7 @@ local off_t deflate_fast()
lookahead -= match_length; lookahead -= match_length;
+ RSYNC_ROLL(strstart, match_length); + RSYNC_ROLL(strstart, match_length);
/* Insert new strings in the hash table only if the match length /* Insert new strings in the hash table only if the match length
* is not too large. This saves time but degrades compression. * is not too large. This saves time but degrades compression.
*/ */
@@ -648,9 +698,14 @@ local off_t deflate_fast() @@ -655,8 +705,13 @@ local off_t deflate_fast()
/* No match, output a literal byte */
Tracevv((stderr,"%c",window[strstart])); Tracevv((stderr,"%c",window[strstart]));
flush = ct_tally (0, window[strstart]); flush = ct_tally (0, window[strstart]);
+ RSYNC_ROLL(strstart, 1);
lookahead--; lookahead--;
strstart++; + RSYNC_ROLL(strstart, 1);
strstart++;
} }
+ if (rsync && strstart > rsync_chunk_end) { + if (rsync && strstart > rsync_chunk_end) {
+ rsync_chunk_end = 0xFFFFFFFFUL; + rsync_chunk_end = 0xFFFFFFFFUL;
+ flush = 2; + flush = 2;
+ } + }
if (flush) FLUSH_BLOCK(0), block_start = strstart; if (flush) FLUSH_BLOCK(0), block_start = strstart;
/* Make sure that we always have enough lookahead, except /* Make sure that we always have enough lookahead, except
@@ -724,6 +779,7 @@ off_t deflate() @@ -730,6 +785,7 @@ off_t deflate()
*/ */
lookahead -= prev_length-1; lookahead -= prev_length-1;
prev_length -= 2; prev_length -= 2;
@ -141,7 +140,7 @@ Index: gzip-1.3.13/deflate.c
do { do {
strstart++; strstart++;
INSERT_STRING(strstart, hash_head); INSERT_STRING(strstart, hash_head);
@@ -736,24 +792,39 @@ off_t deflate() @@ -742,24 +798,39 @@ off_t deflate()
match_available = 0; match_available = 0;
match_length = MIN_MATCH-1; match_length = MIN_MATCH-1;
strstart++; strstart++;
@ -185,10 +184,10 @@ Index: gzip-1.3.13/deflate.c
strstart++; strstart++;
lookahead--; lookahead--;
} }
Index: gzip-1.3.13/doc/gzip.texi Index: gzip-1.5/doc/gzip.texi
=================================================================== ===================================================================
--- gzip-1.3.13.orig/doc/gzip.texi --- gzip-1.5.orig/doc/gzip.texi 2012-01-01 09:53:58.000000000 +0100
+++ gzip-1.3.13/doc/gzip.texi +++ gzip-1.5/doc/gzip.texi 2012-10-16 13:56:09.317621847 +0200
@@ -353,6 +353,14 @@ specified on the command line are direct @@ -353,6 +353,14 @@ specified on the command line are direct
into the directory and compress all the files it finds there (or into the directory and compress all the files it finds there (or
decompress them in the case of @command{gunzip}). decompress them in the case of @command{gunzip}).
@ -204,11 +203,11 @@ Index: gzip-1.3.13/doc/gzip.texi
@item --suffix @var{suf} @item --suffix @var{suf}
@itemx -S @var{suf} @itemx -S @var{suf}
Use suffix @var{suf} instead of @samp{.gz}. Any suffix can be Use suffix @var{suf} instead of @samp{.gz}. Any suffix can be
Index: gzip-1.3.13/gzip.c Index: gzip-1.5/gzip.c
=================================================================== ===================================================================
--- gzip-1.3.13.orig/gzip.c --- gzip-1.5.orig/gzip.c 2012-04-24 18:25:28.000000000 +0200
+++ gzip-1.3.13/gzip.c +++ gzip-1.5/gzip.c 2012-10-16 13:56:09.318621877 +0200
@@ -229,6 +229,7 @@ int ofd; /* output fil @@ -213,6 +213,7 @@ int ofd; /* output fil
unsigned insize; /* valid bytes in inbuf */ unsigned insize; /* valid bytes in inbuf */
unsigned inptr; /* index of next byte to be processed in inbuf */ unsigned inptr; /* index of next byte to be processed in inbuf */
unsigned outcnt; /* bytes in output buffer */ unsigned outcnt; /* bytes in output buffer */
@ -216,15 +215,15 @@ Index: gzip-1.3.13/gzip.c
static int handled_sig[] = static int handled_sig[] =
{ {
@@ -282,6 +283,7 @@ struct option longopts[] = @@ -270,6 +271,7 @@ static const struct option longopts[] =
{"best", 0, 0, '9'}, /* compress better */ {"best", 0, 0, '9'}, /* compress better */
{"lzw", 0, 0, 'Z'}, /* make output compatible with old compress */ {"lzw", 0, 0, 'Z'}, /* make output compatible with old compress */
{"bits", 1, 0, 'b'}, /* max number of bits per code (implies -Z) */ {"bits", 1, 0, 'b'}, /* max number of bits per code (implies -Z) */
+ {"rsyncable", 0, 0, 'R'}, /* make rsync-friendly archive */ + {"rsyncable", 0, 0, 'R'}, /* make rsync-friendly archive */
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@@ -353,6 +355,7 @@ local void help()
@@ -363,6 +365,7 @@ local void help()
" -Z, --lzw produce output compatible with old compress", " -Z, --lzw produce output compatible with old compress",
" -b, --bits=BITS max number of bits per code (implies -Z)", " -b, --bits=BITS max number of bits per code (implies -Z)",
#endif #endif
@ -232,21 +231,20 @@ Index: gzip-1.3.13/gzip.c
"", "",
"With no FILE, or when FILE is -, read standard input.", "With no FILE, or when FILE is -, read standard input.",
"", "",
@@ -493,6 +496,9 @@ int main (argc, argv) @@ -482,6 +485,8 @@ int main (int argc, char **argv)
recursive = 1; recursive = 1;
#endif #endif
break; break;
+ case 'R': + case 'R':
+ rsync = 1; break; + rsync = 1; break;
+ case 'S':
case 'S':
#ifdef NO_MULTIPLE_DOTS #ifdef NO_MULTIPLE_DOTS
if (*optarg == '.') optarg++; if (*optarg == '.') optarg++;
Index: gzip-1.3.13/gzip.h Index: gzip-1.5/gzip.h
=================================================================== ===================================================================
--- gzip-1.3.13.orig/gzip.h --- gzip-1.5.orig/gzip.h 2012-01-01 09:53:58.000000000 +0100
+++ gzip-1.3.13/gzip.h +++ gzip-1.5/gzip.h 2012-10-16 14:01:29.319241177 +0200
@@ -158,6 +158,7 @@ EXTERN(uch, window); /* Sliding @@ -140,6 +140,7 @@ EXTERN(uch, window); /* Sliding
extern unsigned insize; /* valid bytes in inbuf */ extern unsigned insize; /* valid bytes in inbuf */
extern unsigned inptr; /* index of next byte to be processed in inbuf */ extern unsigned inptr; /* index of next byte to be processed in inbuf */
extern unsigned outcnt; /* bytes in output buffer */ extern unsigned outcnt; /* bytes in output buffer */
@ -254,19 +252,19 @@ Index: gzip-1.3.13/gzip.h
extern off_t bytes_in; /* number of input bytes */ extern off_t bytes_in; /* number of input bytes */
extern off_t bytes_out; /* number of output bytes */ extern off_t bytes_out; /* number of output bytes */
@@ -306,7 +307,7 @@ off_t deflate OF((void)); @@ -287,7 +288,7 @@ extern off_t deflate (void);
/* in trees.c */ /* in trees.c */
void ct_init OF((ush *attr, int *method)); extern void ct_init (ush *attr, int *method);
int ct_tally OF((int dist, int lc)); extern int ct_tally (int dist, int lc);
-off_t flush_block OF((char *buf, ulg stored_len, int eof)); -extern off_t flush_block (char *buf, ulg stored_len, int eof);
+off_t flush_block OF((char *buf, ulg stored_len, int pad, int eof)); +extern off_t flush_block (char *buf, ulg stored_len, int pad, int eof);
/* in bits.c */ /* in bits.c */
void bi_init OF((file_t zipfile)); extern void bi_init (file_t zipfile);
Index: gzip-1.3.13/trees.c Index: gzip-1.5/trees.c
=================================================================== ===================================================================
--- gzip-1.3.13.orig/trees.c --- gzip-1.5.orig/trees.c 2012-01-01 09:53:58.000000000 +0100
+++ gzip-1.3.13/trees.c +++ gzip-1.5/trees.c 2012-10-16 13:56:09.318621877 +0200
@@ -59,12 +59,13 @@ @@ -59,12 +59,13 @@
* void ct_tally (int dist, int lc); * void ct_tally (int dist, int lc);
* Save the match info and tally the frequency counts. * Save the match info and tally the frequency counts.

View File

@ -1,14 +0,0 @@
Index: gzip-1.4/lib/stdio.in.h
===================================================================
--- gzip-1.4.orig/lib/stdio.in.h
+++ gzip-1.4/lib/stdio.in.h
@@ -125,7 +125,9 @@ extern int fclose (FILE *stream) _GL_ARG
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
#undef gets
+#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Oct 16 10:48:48 UTC 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 19:00:13 UTC 2012 - aj@suse.de Tue Jul 17 19:00:13 UTC 2012 - aj@suse.de

View File

@ -19,7 +19,7 @@
Name: gzip Name: gzip
Url: http://www.gzip.org/ Url: http://www.gzip.org/
PreReq: %{install_info_prereq} update-alternatives PreReq: %{install_info_prereq} update-alternatives
Version: 1.4 Version: 1.5
Release: 0 Release: 0
Summary: GNU Zip Compression Utilities Summary: GNU Zip Compression Utilities
License: GPL-2.0+ License: GPL-2.0+
@ -31,7 +31,6 @@ Patch2: zmore.diff
Patch3: non-exec-stack.diff Patch3: non-exec-stack.diff
Patch4: http://rsync.samba.org/ftp/unpacked/rsync/patches/gzip-rsyncable.diff Patch4: http://rsync.samba.org/ftp/unpacked/rsync/patches/gzip-rsyncable.diff
Patch6: zdiff.diff Patch6: zdiff.diff
Patch7: gzip-stdio.in.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
@ -48,7 +47,6 @@ times.
%patch3 %patch3
%patch4 -p1 %patch4 -p1
%patch6 %patch6
%patch7 -p1
%build %build
CFLAGS="$RPM_OPT_FLAGS -fomit-frame-pointer \ CFLAGS="$RPM_OPT_FLAGS -fomit-frame-pointer \

View File

@ -1,17 +1,17 @@
Index: zdiff.in Index: zdiff.in
=================================================================== ===================================================================
--- zdiff.in.orig --- zdiff.in.orig 2012-01-01 09:53:58.000000000 +0100
+++ zdiff.in +++ zdiff.in 2012-10-16 13:40:46.854905141 +0200
@@ -105,9 +105,9 @@ elif test $# -eq 2; then @@ -105,9 +105,9 @@ elif test $# -eq 2; then
5<&0 5<&0
then then
gzip_status=$( gzip_status=$(
- exec 4>&1 - exec 4>&1
- (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- | - (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- |
- ( (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null | - ( (gzip -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
+ exec 4>&1 6<&0 + exec 4>&1 6<&0
+ (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- 6<&- | + (gzip -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- 6<&- |
+ ( (gzip -cdfq -- "$2" 4>&- 0<&6 6<&-; echo $? >&4) 3>&- 5<&- </dev/null | + ( (gzip -cdfq -- "$2" 4>&- 0<&6 6<&-; echo $? >&4) 3>&- 5<&- </dev/null |
eval "$cmp" /dev/fd/5 - >&3) 5<&0 eval "$cmp" /dev/fd/5 - >&3) 5<&0
) )
cmp_status=$? cmp_status=$?

View File

@ -1,8 +1,8 @@
Index: zgrep.in Index: zgrep.in
=================================================================== ===================================================================
--- zgrep.in.orig --- zgrep.in.orig 2012-01-01 09:53:58.000000000 +0100
+++ zgrep.in +++ zgrep.in 2012-10-16 13:22:26.304769138 +0200
@@ -176,13 +176,21 @@ res=0 @@ -174,10 +174,18 @@ res=0
for i for i
do do
@ -17,9 +17,6 @@ Index: zgrep.in
# Fail if gzip or grep (or sed) fails. # Fail if gzip or grep (or sed) fails.
gzip_status=$( gzip_status=$(
exec 5>&1 exec 5>&1
if test $pat_on_stdin -eq 1; then
eval "exec $pat_fd<&0"
fi
- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | - (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
+ ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | + ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
if test $files_with_matches -eq 1; then if test $files_with_matches -eq 1; then

View File

@ -1,8 +1,8 @@
Index: zmore.in Index: zmore.in
=================================================================== ===================================================================
--- zmore.in.orig --- zmore.in.orig 2012-01-01 09:53:58.000000000 +0100
+++ zmore.in +++ zmore.in 2012-10-16 13:34:42.842966614 +0200
@@ -55,11 +55,33 @@ else @@ -55,11 +55,34 @@ else
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
fi fi
@ -28,21 +28,22 @@ Index: zmore.in
+ ;; + ;;
+ esac + esac
+done +done
+
if test $# = 0; then if test $# = 0; then
if test -t 0; then if test -t 0; then
echo "$usage" echo >&2 "$0: invalid number of operands; try \`$0 --help' for help"
else else
- gzip -cdfq | eval ${PAGER-more} - gzip -cdfq | eval ${PAGER-more}
+ gzip -cdfq | pager + gzip -cdfq | pager
fi fi
else else
FIRST=1 FIRST=1
@@ -83,7 +105,7 @@ else @@ -83,7 +106,7 @@ else
fi fi
if test "$ANS" != 's'; then if test "$ANS" != 's'; then
echo "------> $FILE <------" echo "------> $FILE <------"
- gzip -cdfq -- "$FILE" | eval ${PAGER-more} - gzip -cdfq -- "$FILE" | eval ${PAGER-more}
+ gzip -cdfq -- "$FILE" | pager + gzip -cdfq -- "$FILE" | pager
fi fi
if test -t 1; then if test -t 1; then
FIRST=0 FIRST=0