New upstream version

This commit is contained in:
Michal Luscon 2012-06-20 15:55:56 +02:00
parent 85ae3d2a4e
commit 54372e33f6
11 changed files with 150 additions and 231 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
gzip-1.4.tar.xz
/gzip-1.5.tar.xz

View File

@ -1,14 +1,6 @@
--- gzip-1.3.10/zgrep.in.pom 2006-12-30 04:01:51.000000000 +0100
+++ gzip-1.3.10/zgrep.in 2007-02-06 10:54:33.000000000 +0100
@@ -146,7 +146,7 @@
exec 3>&1
res=0
-
+trap break SIGPIPE
for i
do
# Fail if gzip or grep (or sed) fails.
@@ -190,5 +190,8 @@
r=$?
test "$gzip_status" -eq 0 || test "$gzip_status" -eq 2 || r=2

View File

@ -1,22 +1,22 @@
--- gzip-1.3.9/unlzh.c.4337 2007-01-15 16:31:53.000000000 +0100
+++ gzip-1.3.9/unlzh.c 2007-01-15 16:38:08.000000000 +0100
@@ -154,8 +154,8 @@
@@ -146,8 +146,8 @@
start[1] = 0;
for (i = 1; i <= 16; i++)
start[i + 1] = start[i] + (count[i] << (16 - i));
start[i + 1] = start[i] + (count[i] << (16 - i));
- if ((start[17] & 0xffff) != 0)
- gzip_error ("Bad table\n");
+ if ((start[17] & 0xffff) != 0 || tablebits > 16) /* 16 for weight below */
+ if ((start[17] & 0xffff) != 0 || tablebits > 16) /* 16 for weight below */
+ gzip_error ("Bad table (case b)\n");
jutbits = 16 - tablebits;
for (i = 1; i <= (unsigned)tablebits; i++) {
@@ -169,15 +169,15 @@
@@ -161,15 +162,15 @@
i = start[tablebits + 1] >> jutbits;
if (i != 0) {
- k = 1 << tablebits;
- while (i != k) table[i++] = 0;
- k = 1 << tablebits;
- while (i != k) table[i++] = 0;
+ k = MIN(1 << tablebits, DIST_BUFSIZE);
+ while (i < k) table[i++] = 0;
}
@ -24,73 +24,73 @@
avail = nchar;
mask = (unsigned) 1 << (15 - tablebits);
for (ch = 0; ch < (unsigned)nchar; ch++) {
if ((len = bitlen[ch]) == 0) continue;
- nextcode = start[len] + weight[len];
+ nextcode = MIN(start[len] + weight[len], DIST_BUFSIZE);
if (len <= (unsigned)tablebits) {
if ((unsigned) 1 << tablebits < nextcode)
gzip_error ("Bad table\n");
@@ -220,7 +220,7 @@
for (i = 0; i < 256; i++) pt_table[i] = c;
if ((len = bitlen[ch]) == 0) continue;
- nextcode = start[len] + weight[len];
+ nextcode = MIN(start[len] + weight[len], DIST_BUFSIZE);
if (len <= (unsigned)tablebits) {
if ((unsigned) 1 << tablebits < nextcode)
gzip_error ("Bad table\n");
@@ -212,7 +213,7 @@
for (i = 0; i < 256; i++) pt_table[i] = c;
} else {
i = 0;
- while (i < n) {
+ while (i < MIN(n,NPT)) {
c = bitbuf >> (BITBUFSIZ - 3);
if (c == 7) {
mask = (unsigned) 1 << (BITBUFSIZ - 1 - 3);
@@ -232,7 +232,7 @@
pt_len[i++] = c;
if (i == i_special) {
c = getbits(2);
- while (--c >= 0) pt_len[i++] = 0;
+ while (--c >= 0 && i < NPT) pt_len[i++] = 0;
}
}
while (i < nn) pt_len[i++] = 0;
@@ -252,7 +252,7 @@
for (i = 0; i < 4096; i++) c_table[i] = c;
i = 0;
- while (i < n) {
+ while (i < MIN(n,NPT)) {
c = bitbuf >> (BITBUFSIZ - 3);
if (c == 7) {
mask = (unsigned) 1 << (BITBUFSIZ - 1 - 3);
@@ -224,7 +225,7 @@
pt_len[i++] = c;
if (i == i_special) {
c = getbits(2);
- while (--c >= 0) pt_len[i++] = 0;
+ while (--c >= 0 && i < NPT) pt_len[i++] = 0;
}
}
while (i < nn) pt_len[i++] = 0;
@@ -244,7 +245,7 @@
for (i = 0; i < 4096; i++) c_table[i] = c;
} else {
i = 0;
- while (i < n) {
+ while (i < MIN(n,NC)) {
c = pt_table[bitbuf >> (BITBUFSIZ - 8)];
if (c >= NT) {
mask = (unsigned) 1 << (BITBUFSIZ - 1 - 8);
@@ -267,7 +267,7 @@
if (c == 0) c = 1;
else if (c == 1) c = getbits(4) + 3;
else c = getbits(CBIT) + 20;
- while (--c >= 0) c_len[i++] = 0;
+ while (--c >= 0 && i < NC) c_len[i++] = 0;
} else c_len[i++] = c - 2;
}
while (i < NC) c_len[i++] = 0;
@@ -360,7 +360,7 @@
i = 0;
- while (i < n) {
+ while (i < MIN(n,NC)) {
c = pt_table[bitbuf >> (BITBUFSIZ - 8)];
if (c >= NT) {
mask = (unsigned) 1 << (BITBUFSIZ - 1 - 8);
@@ -259,7 +260,7 @@
if (c == 0) c = 1;
else if (c == 1) c = getbits(4) + 3;
else c = getbits(CBIT) + 20;
- while (--c >= 0) c_len[i++] = 0;
+ while (--c >= 0 && i < NC) c_len[i++] = 0;
} else c_len[i++] = c - 2;
}
while (i < NC) c_len[i++] = 0;
@@ -352,7 +353,7 @@
while (--j >= 0) {
buffer[r] = buffer[i];
i = (i + 1) & (DICSIZ - 1);
- if (++r == count) return r;
+ if (++r >= count) return r;
buffer[r] = buffer[i];
i = (i + 1) & (DICSIZ - 1);
- if (++r == count) return r;
+ if (++r >= count) return r;
}
for ( ; ; ) {
c = decode_c();
@@ -370,14 +370,14 @@
}
if (c <= UCHAR_MAX) {
buffer[r] = c;
- if (++r == count) return r;
+ if (++r >= count) return r;
} else {
j = c - (UCHAR_MAX + 1 - THRESHOLD);
i = (r - decode_p() - 1) & (DICSIZ - 1);
while (--j >= 0) {
buffer[r] = buffer[i];
i = (i + 1) & (DICSIZ - 1);
- if (++r == count) return r;
+ if (++r >= count) return r;
}
}
c = decode_c();
@@ -362,14 +363,14 @@
}
if (c <= UCHAR_MAX) {
buffer[r] = c;
- if (++r == count) return r;
+ if (++r >= count) return r;
} else {
j = c - (UCHAR_MAX + 1 - THRESHOLD);
i = (r - decode_p() - 1) & (DICSIZ - 1);
while (--j >= 0) {
buffer[r] = buffer[i];
i = (i + 1) & (DICSIZ - 1);
- if (++r == count) return r;
+ if (++r >= count) return r;
}
}
}
--- gzip-1.3.9/gzip.h.4337 2007-01-15 16:31:53.000000000 +0100
+++ gzip-1.3.9/gzip.h 2007-01-15 16:38:52.000000000 +0100
@ -105,9 +105,9 @@
* suffix table instead of its output buffer, so it does not use put_ubyte
--- gzip-1.3.9/unpack.c.4337 2007-01-15 16:31:53.000000000 +0100
+++ gzip-1.3.9/unpack.c 2007-01-15 16:39:12.000000000 +0100
@@ -26,9 +26,6 @@
@@ -21,9 +21,6 @@
#include "tailor.h"
#include "gzip.h"
#include "crypt.h"
-#define MIN(a,b) ((a) <= (b) ? (a) : (b))
-/* The arguments must not have side effects. */
@ -115,3 +115,4 @@
#define MAX_BITLEN 25
/* Maximum length of Huffman codes. (Minor modifications to the code
* would be needed to support 32 bits codes, but pack never generates

View File

@ -1,42 +0,0 @@
diff -up gzip-1.3.13/gzip.1.noemptysuffix gzip-1.3.13/gzip.1
--- gzip-1.3.13/gzip.1.noemptysuffix 2009-09-26 20:43:28.000000000 +0200
+++ gzip-1.3.13/gzip.1 2010-02-22 14:29:54.828770607 +0100
@@ -291,15 +291,14 @@ will descend into the directory and comp
).
.TP
.B \-S .suf --suffix .suf
-Use suffix .suf instead of .gz. Any suffix can be given, but suffixes
+When compressing, use suffix .suf instead of .gz.
+Any non-empty suffix can be given, but suffixes
other than .z and .gz should be avoided to avoid confusion when files
-are transferred to other systems. A null suffix forces gunzip to try
-decompression on all given files regardless of suffix, as in:
+are transferred to other systems.
- gunzip -S "" * (*.* for MSDOS)
+When decompressing, add .suf to the beginning of the list of
+suffixes to try, when deriving an output file name from an input file name.
-Previous versions of gzip used
-the .z suffix. This was changed to avoid a conflict with
.IR pack "(1)".
.TP
.B \-t --test
diff -up gzip-1.3.13/gzip.c.noemptysuffix gzip-1.3.13/gzip.c
--- gzip-1.3.13/gzip.c.noemptysuffix 2010-02-22 14:29:54.000000000 +0100
+++ gzip-1.3.13/gzip.c 2010-02-22 14:34:33.480895239 +0100
@@ -547,11 +547,11 @@ int main (argc, argv)
program_name);
}
#endif
- if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
- fprintf(stderr, "%s: incorrect suffix '%s'\n",
- program_name, z_suffix);
+ if (z_len == 0 || z_len > MAX_SUFFIX) {
+ fprintf(stderr, "%s: invalid suffix '%s'\n", program_name, z_suffix);
do_exit(ERROR);
}
+
if (do_lzw && !decompress) work = lzw;
/* Allocate all global buffers (for DYN_ALLOC option) */

View File

@ -17,7 +17,7 @@ diff -up gzip-1.3.13/deflate.c.rsync 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 */
@ -102,26 +102,28 @@ diff -up gzip-1.3.13/deflate.c.rsync 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()
@@ -674,7 +674,8 @@
flush = ct_tally(strstart-match_start, match_length - MIN_MATCH);
lookahead -= match_length;
+ RSYNC_ROLL(strstart, match_length);
/* Insert new strings in the hash table only if the match length
-
+
+ RSYNC_ROLL(strstart, 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()
@@ -703,9 +704,14 @@
/* No match, output a literal byte */
Tracevv((stderr,"%c",window[strstart]));
flush = ct_tally (0, window[strstart]);
+ RSYNC_ROLL(strstart, 1);
lookahead--;
strstart++;
strstart++;
}
+ if (rsync && strstart > rsync_chunk_end) {
+ 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
@ -206,14 +208,16 @@ diff -up gzip-1.3.13/gzip.c.rsync gzip-1.3.13/gzip.c
static int handled_sig[] =
{
@@ -282,6 +283,7 @@ struct option longopts[] =
@@ -271,7 +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 */
-
+ {"rsyncable", 0, 0, 'R'}, /* make rsync-friendly archive */
{ 0, 0, 0, 0 }
};
@@ -363,6 +365,7 @@ local void help()
" -Z, --lzw produce output compatible with old compress",
" -b, --bits=BITS max number of bits per code (implies -Z)",
@ -222,16 +226,17 @@ diff -up gzip-1.3.13/gzip.c.rsync 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;
@@ -484,6 +484,9 @@ int main (int argc, char **argv)
recursive = 1;
#endif
break;
+
break;
+
+ case 'R':
+ rsync = 1; break;
case 'S':
+ rsync = 1; break;
case 'S':
#ifdef NO_MULTIPLE_DOTS
if (*optarg == '.') optarg++;
diff -up gzip-1.3.13/gzip.h.rsync gzip-1.3.13/gzip.h
--- gzip-1.3.13/gzip.h.rsync 2009-09-26 20:43:28.000000000 +0200
+++ gzip-1.3.13/gzip.h 2009-12-01 16:14:24.664394713 +0100
@ -243,15 +248,16 @@ diff -up gzip-1.3.13/gzip.h.rsync 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));
@@ -288,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));
extern void bi_init (file_t zipfile);
diff -up gzip-1.3.13/trees.c.rsync gzip-1.3.13/trees.c
--- gzip-1.3.13/trees.c.rsync 2009-09-26 20:43:28.000000000 +0200
+++ gzip-1.3.13/trees.c 2009-12-01 16:14:24.655388257 +0100

View File

@ -1,11 +1,11 @@
--- gzip-1.3.5/unlzh.c.len 2006-11-22 09:35:10.000000000 +0100
+++ gzip-1.3.5/unlzh.c 2006-11-22 09:38:52.000000000 +0100
@@ -199,7 +199,7 @@
}
*p = ch;
}
- start[len] = nextcode;
+ start[len] = start[len] + weight[len];
@@ -189,7 +189,7 @@
}
*p = ch;
}
- start[len] = nextcode;
+ start[len] = start[len] + weight[len];
}
}

View File

@ -1,29 +1,29 @@
--- gzip-1.3.3/unlzh.c.4338 2006-09-07 10:49:31.000000000 +0200
+++ gzip-1.3.3/unlzh.c 2006-09-07 11:37:53.000000000 +0200
@@ -260,7 +260,7 @@
if (bitbuf & mask) c = right[c];
else c = left [c];
mask >>= 1;
- } while (c >= NT);
+ } while (c >= NT && (mask || c != left[c]));
}
fillbuf((int) pt_len[c]);
if (c <= 2) {
@@ -296,7 +296,7 @@
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NC);
+ } while (j >= NC && (mask || j != left[j]));
@@ -252,7 +252,7 @@ local void read_c_len()
if (bitbuf & mask) c = right[c];
else c = left [c];
mask >>= 1;
- } while (c >= NT);
+ } while (c >= NT && (mask || c != left[c]));
}
fillbuf((int) pt_len[c]);
if (c <= 2) {
@@ -288,7 +288,7 @@ local unsigned decode_c()
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NC);
+ } while (j >= NC && (mask || j != left[j]));
}
fillbuf((int) c_len[j]);
return j;
@@ -313,7 +313,7 @@
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NP);
+ } while (j >= NP && (mask || j != left[j]));
@@ -305,7 +305,7 @@ local unsigned decode_p()
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NP);
+ } while (j >= NP && (mask || j != left[j]));
}
fillbuf((int) pt_len[j]);
if (j != 0) j = ((unsigned) 1 << (j - 1)) + getbits((int) (j - 1));

View File

@ -1,21 +1,19 @@
--- gzip-1.3.9/zmore.in.pom 2007-01-15 15:31:26.000000000 +0100
+++ gzip-1.3.9/zmore.in 2007-01-15 15:34:06.000000000 +0100
@@ -66,7 +66,7 @@
--v*) exec echo "$version";;
esac
--- gzip-1.3.9/zmore.in.pom 2007-01-15 15:31:26.000000000 +0100
+++ gzip-1.3.9/zmore.in 2007-01-15 15:34:06.000000000 +0100
@@ -70,7 +70,7 @@
--v*) exec echo "$version";;
esac
- < "$FILE" || continue
+ if test -e $FILE || test -e $FILE.gz; then
if test $FIRST -eq 0; then
echo $n1 "--More--(Next file: $FILE)$n2"
stty $cb -echo 2>/dev/null
@@ -83,6 +83,8 @@
fi
if test -t 1; then
FIRST=0
- fi
+ fi
+ else < $FILE
+ fi
- < "$FILE" || continue
+ if test -e $FILE || test -e $FILE.gz; then
if test $FIRST -eq 0; then
echo $n1 "--More--(Next file: $FILE)$n2"
stty $cb -echo 2>/dev/null
@@ -88,5 +88,7 @@
if test -t 1; then
FIRST=0
fi
+ else < $FILE
+ fi
done
fi

View File

@ -1,33 +0,0 @@
--- gzip-1.3.9/znew.in.stderr 2007-01-15 14:23:54.000000000 +0100
+++ gzip-1.3.9/znew.in 2007-01-15 14:25:37.000000000 +0100
@@ -92,7 +92,7 @@
done
if test $# -eq 0; then
- echo "$usage"
+ echo "$usage" >&2
exit 1
fi
--- gzip-1.3.9/zforce.in.stderr 2007-01-15 14:23:54.000000000 +0100
+++ gzip-1.3.9/zforce.in 2007-01-15 14:23:54.000000000 +0100
@@ -40,7 +40,7 @@
Report bugs to <bug-gzip@gnu.org>."
if test $# = 0; then
- echo "$usage"
+ echo "$usage" >&2
exit 1
fi
--- gzip-1.3.9/zmore.in.stderr 2006-12-09 05:25:56.000000000 +0100
+++ gzip-1.3.9/zmore.in 2007-01-15 14:23:54.000000000 +0100
@@ -53,7 +53,7 @@
if test $# = 0; then
if test -t 0; then
- echo "$usage"
+ echo "$usage" >&2
else
gzip -cdfq | eval ${PAGER-more}
fi

View File

@ -1,15 +1,13 @@
Summary: The GNU data compression program
Name: gzip
Version: 1.4
Release: 6%{?dist}
Version: 1.5
Release: 1%{?dist}
# info pages are under GFDL license
License: GPLv3+ and GFDL
Group: Applications/File
Source: http://ftp.gnu.org/gnu/gzip/gzip-%{version}.tar.xz
Patch0: gzip-1.3.12-openbsd-owl-tmp.patch
Patch1: gzip-1.3.5-zforce.patch
Patch2: gzip-1.3.9-stderr.patch
Patch3: gzip-1.3.10-zgreppipe.patch
Patch4: gzip-1.3.13-rsync.patch
Patch5: gzip-1.3.9-addsuffix.patch
Patch6: gzip-1.3.5-cve-2006-4338.patch
@ -17,7 +15,6 @@ Patch7: gzip-1.3.13-cve-2006-4337.patch
Patch8: gzip-1.3.5-cve-2006-4337_len.patch
# Fixed in upstream code.
# http://thread.gmane.org/gmane.comp.gnu.gzip.bugs/378
Patch11: gzip-1.3.13-noemptysuffix.patch
URL: http://www.gzip.org/
# Requires should not be added for gzip wrappers (eg. zdiff, zgrep,
# zless) of another tools, because gzip "extends" the tools by its
@ -41,14 +38,11 @@ very commonly used data compression program.
%setup -q
%patch0 -p1 -b .owl-tmp
%patch1 -p1 -b .zforce
%patch2 -p1 -b .stderr
%patch3 -p1 -b .nixi
%patch4 -p1 -b .rsync
%patch5 -p1 -b .addsuffix
%patch6 -p1 -b .4338
%patch7 -p1 -b .4337
%patch8 -p1 -b .4337l
%patch11 -p1 -b .noemptysuffix
%build
export DEFS="NO_ASM"
@ -89,6 +83,8 @@ fi
%{_infodir}/gzip.info*
%changelog
* Tue Jun 19 2012 Michal Luscon <mluscon@redhat.com> 1.5-1
* Wed Jan 25 2012 Harald Hoyer <harald@redhat.com> 1.4-6
- add filesystem guard

View File

@ -1 +1 @@
fc7be225884ae5324b44167ced89f50a gzip-1.4.tar.xz
2a431e169b6f62f7332ef6d47cc53bae gzip-1.5.tar.xz