From aa667cf72c2ddd99f6bda07663f90ff1179d4fa594a562ad13bfae39847b43fc Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 17 Oct 2012 09:19:18 +0000 Subject: [PATCH] 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 --- gzip-1.4.tar.gz | 3 -- gzip-1.5.tar.gz | 3 ++ gzip-rsyncable.diff | 88 ++++++++++++++++++++++----------------------- gzip-stdio.in.patch | 14 -------- gzip.changes | 16 +++++++++ gzip.spec | 4 +-- zdiff.diff | 22 ++++++------ zgrep.diff | 9 ++--- zmore.diff | 27 +++++++------- 9 files changed, 91 insertions(+), 95 deletions(-) delete mode 100644 gzip-1.4.tar.gz create mode 100644 gzip-1.5.tar.gz delete mode 100644 gzip-stdio.in.patch diff --git a/gzip-1.4.tar.gz b/gzip-1.4.tar.gz deleted file mode 100644 index 0fb6645..0000000 --- a/gzip-1.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d166cfd3da380da1bd535633e8890bfb5664f9e68870a611d1dc01a3e9f711ee -size 907411 diff --git a/gzip-1.5.tar.gz b/gzip-1.5.tar.gz new file mode 100644 index 0000000..2f17f19 --- /dev/null +++ b/gzip-1.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5d56e8ffc9918e8c941fab56e04121194f9870adeeb859e09c09eac264035a3 +size 1114684 diff --git a/gzip-rsyncable.diff b/gzip-rsyncable.diff index f7b0ff1..cb33dd0 100644 --- a/gzip-rsyncable.diff +++ b/gzip-rsyncable.diff @@ -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. ================================================================================ -Index: gzip-1.3.13/deflate.c +Index: gzip-1.5/deflate.c =================================================================== ---- gzip-1.3.13.orig/deflate.c -+++ gzip-1.3.13/deflate.c +--- gzip-1.5.orig/deflate.c 2012-04-24 18:25:28.000000000 +0200 ++++ gzip-1.5/deflate.c 2012-10-16 13:56:09.316621817 +0200 @@ -131,6 +131,14 @@ #endif /* 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. */ @@ -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 */ +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 * 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 /* prev will be initialized on the fly */ @@ -44,7 +44,7 @@ Index: gzip-1.3.13/deflate.c /* Set the default configuration parameters: */ 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); match_start -= WSIZE; strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */ @@ -53,7 +53,7 @@ Index: gzip-1.3.13/deflate.c 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 -@@ -590,7 +639,7 @@ local void fill_window() +@@ -596,7 +645,7 @@ local void fill_window() local off_t deflate_fast() { 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 */ 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; + 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. */ -@@ -648,9 +698,14 @@ local off_t deflate_fast() - /* No match, output a literal byte */ +@@ -655,8 +705,13 @@ local off_t deflate_fast() Tracevv((stderr,"%c",window[strstart])); flush = ct_tally (0, window[strstart]); -+ RSYNC_ROLL(strstart, 1); lookahead--; - strstart++; ++ RSYNC_ROLL(strstart, 1); + strstart++; } + if (rsync && strstart > rsync_chunk_end) { + rsync_chunk_end = 0xFFFFFFFFUL; + flush = 2; -+ } ++ } if (flush) FLUSH_BLOCK(0), block_start = strstart; /* 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; prev_length -= 2; @@ -141,7 +140,7 @@ Index: gzip-1.3.13/deflate.c do { strstart++; INSERT_STRING(strstart, hash_head); -@@ -736,24 +792,39 @@ off_t deflate() +@@ -742,24 +798,39 @@ off_t deflate() match_available = 0; match_length = MIN_MATCH-1; strstart++; @@ -185,10 +184,10 @@ Index: gzip-1.3.13/deflate.c strstart++; 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.3.13/doc/gzip.texi +--- gzip-1.5.orig/doc/gzip.texi 2012-01-01 09:53:58.000000000 +0100 ++++ 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 into the directory and compress all the files it finds there (or decompress them in the case of @command{gunzip}). @@ -204,11 +203,11 @@ Index: gzip-1.3.13/doc/gzip.texi @item --suffix @var{suf} @itemx -S @var{suf} 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.3.13/gzip.c -@@ -229,6 +229,7 @@ int ofd; /* output fil +--- gzip-1.5.orig/gzip.c 2012-04-24 18:25:28.000000000 +0200 ++++ gzip-1.5/gzip.c 2012-10-16 13:56:09.318621877 +0200 +@@ -213,6 +213,7 @@ int ofd; /* output fil unsigned insize; /* valid bytes in inbuf */ unsigned inptr; /* index of next byte to be processed in inbuf */ unsigned outcnt; /* bytes in output buffer */ @@ -216,15 +215,15 @@ Index: gzip-1.3.13/gzip.c 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 */ {"lzw", 0, 0, 'Z'}, /* make output compatible with old compress */ {"bits", 1, 0, 'b'}, /* max number of bits per code (implies -Z) */ + {"rsyncable", 0, 0, 'R'}, /* make rsync-friendly archive */ + { 0, 0, 0, 0 } }; - -@@ -363,6 +365,7 @@ local void help() +@@ -353,6 +355,7 @@ local void help() " -Z, --lzw produce output compatible with old compress", " -b, --bits=BITS max number of bits per code (implies -Z)", #endif @@ -232,21 +231,20 @@ Index: gzip-1.3.13/gzip.c "", "With no FILE, or when FILE is -, read standard input.", "", -@@ -493,6 +496,9 @@ int main (argc, argv) - recursive = 1; +@@ -482,6 +485,8 @@ int main (int argc, char **argv) + recursive = 1; #endif - break; + break; + case 'R': + rsync = 1; break; -+ - case 'S': + case 'S': #ifdef NO_MULTIPLE_DOTS 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.3.13/gzip.h -@@ -158,6 +158,7 @@ EXTERN(uch, window); /* Sliding +--- gzip-1.5.orig/gzip.h 2012-01-01 09:53:58.000000000 +0100 ++++ gzip-1.5/gzip.h 2012-10-16 14:01:29.319241177 +0200 +@@ -140,6 +140,7 @@ EXTERN(uch, window); /* Sliding extern unsigned insize; /* valid bytes in inbuf */ extern unsigned inptr; /* index of next byte to be processed in inbuf */ 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_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 */ - void ct_init OF((ush *attr, int *method)); - int ct_tally OF((int dist, int lc)); --off_t flush_block OF((char *buf, ulg stored_len, int eof)); -+off_t flush_block OF((char *buf, ulg stored_len, int pad, int eof)); + extern void ct_init (ush *attr, int *method); + extern int ct_tally (int dist, int lc); +-extern off_t flush_block (char *buf, ulg stored_len, int eof); ++extern off_t flush_block (char *buf, ulg stored_len, int pad, int eof); /* in bits.c */ - void bi_init OF((file_t zipfile)); -Index: gzip-1.3.13/trees.c + extern void bi_init (file_t zipfile); +Index: gzip-1.5/trees.c =================================================================== ---- gzip-1.3.13.orig/trees.c -+++ gzip-1.3.13/trees.c +--- gzip-1.5.orig/trees.c 2012-01-01 09:53:58.000000000 +0100 ++++ gzip-1.5/trees.c 2012-10-16 13:56:09.318621877 +0200 @@ -59,12 +59,13 @@ * void ct_tally (int dist, int lc); * Save the match info and tally the frequency counts. diff --git a/gzip-stdio.in.patch b/gzip-stdio.in.patch deleted file mode 100644 index d3f98d7..0000000 --- a/gzip-stdio.in.patch +++ /dev/null @@ -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@ diff --git a/gzip.changes b/gzip.changes index 1508a08..7a3136e 100644 --- a/gzip.changes +++ b/gzip.changes @@ -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 diff --git a/gzip.spec b/gzip.spec index 614a45e..10769c6 100644 --- a/gzip.spec +++ b/gzip.spec @@ -19,7 +19,7 @@ Name: gzip Url: http://www.gzip.org/ PreReq: %{install_info_prereq} update-alternatives -Version: 1.4 +Version: 1.5 Release: 0 Summary: GNU Zip Compression Utilities License: GPL-2.0+ @@ -31,7 +31,6 @@ Patch2: zmore.diff Patch3: non-exec-stack.diff Patch4: http://rsync.samba.org/ftp/unpacked/rsync/patches/gzip-rsyncable.diff Patch6: zdiff.diff -Patch7: gzip-stdio.in.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -48,7 +47,6 @@ times. %patch3 %patch4 -p1 %patch6 -%patch7 -p1 %build CFLAGS="$RPM_OPT_FLAGS -fomit-frame-pointer \ diff --git a/zdiff.diff b/zdiff.diff index b76ae2c..446e49a 100644 --- a/zdiff.diff +++ b/zdiff.diff @@ -1,17 +1,17 @@ Index: zdiff.in =================================================================== ---- zdiff.in.orig -+++ 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 +- (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=$? + eval "$cmp" /dev/fd/5 - >&3) 5<&0 + ) + cmp_status=$? diff --git a/zgrep.diff b/zgrep.diff index 4fe44fc..e0ed030 100644 --- a/zgrep.diff +++ b/zgrep.diff @@ -1,8 +1,8 @@ Index: zgrep.in =================================================================== ---- zgrep.in.orig -+++ zgrep.in -@@ -176,13 +176,21 @@ res=0 +--- 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 @@ -17,9 +17,6 @@ Index: zgrep.in # Fail if gzip or grep (or sed) fails. gzip_status=$( exec 5>&1 - if test $pat_on_stdin -eq 1; then - eval "exec $pat_fd<&0" - fi - (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | + ($uncompress -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- | if test $files_with_matches -eq 1; then diff --git a/zmore.diff b/zmore.diff index 02a3d09..21e196c 100644 --- a/zmore.diff +++ b/zmore.diff @@ -1,8 +1,8 @@ Index: zmore.in =================================================================== ---- zmore.in.orig -+++ zmore.in -@@ -55,11 +55,33 @@ else +--- zmore.in.orig 2012-01-01 09:53:58.000000000 +0100 ++++ zmore.in 2012-10-16 13:34:42.842966614 +0200 +@@ -55,11 +55,34 @@ else trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 fi @@ -28,21 +28,22 @@ Index: zmore.in + ;; + esac +done ++ if test $# = 0; then if test -t 0; then - echo "$usage" + echo >&2 "$0: invalid number of operands; try \`$0 --help' for help" else -- gzip -cdfq | eval ${PAGER-more} +- gzip -cdfq | eval ${PAGER-more} + gzip -cdfq | pager fi else FIRST=1 -@@ -83,7 +105,7 @@ else - fi - if test "$ANS" != 's'; then - echo "------> $FILE <------" -- gzip -cdfq -- "$FILE" | eval ${PAGER-more} +@@ -83,7 +106,7 @@ else + fi + if test "$ANS" != 's'; then + echo "------> $FILE <------" +- gzip -cdfq -- "$FILE" | eval ${PAGER-more} + gzip -cdfq -- "$FILE" | pager - fi - if test -t 1; then - FIRST=0 + fi + if test -t 1; then + FIRST=0