summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-05-02 22:00:50 +0000
committerMike Frysinger <vapier@gentoo.org>2005-05-02 22:00:50 +0000
commitfa1f71d0f5cfbd10d1267d49eec217d63bbb46fc (patch)
tree69fc0557dcb6ad95191a085ad317f29cd6f6f5ad /app-arch
parentmask mozilla (diff)
downloadgentoo-2-fa1f71d0f5cfbd10d1267d49eec217d63bbb46fc.tar.gz
gentoo-2-fa1f71d0f5cfbd10d1267d49eec217d63bbb46fc.tar.bz2
gentoo-2-fa1f71d0f5cfbd10d1267d49eec217d63bbb46fc.zip
Add a bunch of patches from Redhat, break up the Debian patch we used, and add fixes for security #89946 and #90626.
(Portage version: 2.0.51.21)
Diffstat (limited to 'app-arch')
-rw-r--r--app-arch/gzip/ChangeLog15
-rw-r--r--app-arch/gzip/files/digest-gzip-1.3.5-r61
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-asm-execstack.patch15
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-debian.patch121
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-gunzip-dir.patch17
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-gzip-perm.patch68
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-infodir.patch38
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-rsync.patch279
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-zgrep-sed.patch33
-rw-r--r--app-arch/gzip/files/gzip-1.3.5-znew-tempfile.patch19
-rw-r--r--app-arch/gzip/gzip-1.3.5-r6.ebuild85
11 files changed, 670 insertions, 21 deletions
diff --git a/app-arch/gzip/ChangeLog b/app-arch/gzip/ChangeLog
index 08699b6e5574..d9facefad364 100644
--- a/app-arch/gzip/ChangeLog
+++ b/app-arch/gzip/ChangeLog
@@ -1,6 +1,17 @@
# ChangeLog for app-arch/gzip
-# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-arch/gzip/ChangeLog,v 1.45 2005/01/04 19:28:14 vapier Exp $
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/gzip/ChangeLog,v 1.46 2005/05/02 22:00:50 vapier Exp $
+
+*gzip-1.3.5-r6 (02 May 2005)
+
+ 02 May 2005; Mike Frysinger <vapier@gentoo.org>
+ +files/gzip-1.3.5-asm-execstack.patch, +files/gzip-1.3.5-debian.patch,
+ +files/gzip-1.3.5-gunzip-dir.patch, +files/gzip-1.3.5-gzip-perm.patch,
+ +files/gzip-1.3.5-infodir.patch, +files/gzip-1.3.5-rsync.patch,
+ +files/gzip-1.3.5-zgrep-sed.patch, -files/gzip-1.3.5-znew-tempfile.patch,
+ +gzip-1.3.5-r6.ebuild:
+ Add a bunch of patches from Redhat, break up the Debian patch we used, and
+ add fixes for security #89946 and #90626.
*gzip-1.3.5-r5 (04 Jan 2005)
diff --git a/app-arch/gzip/files/digest-gzip-1.3.5-r6 b/app-arch/gzip/files/digest-gzip-1.3.5-r6
new file mode 100644
index 000000000000..07db7e681363
--- /dev/null
+++ b/app-arch/gzip/files/digest-gzip-1.3.5-r6
@@ -0,0 +1 @@
+MD5 3d6c191dfd2bf307014b421c12dc8469 gzip-1.3.5.tar.gz 331550
diff --git a/app-arch/gzip/files/gzip-1.3.5-asm-execstack.patch b/app-arch/gzip/files/gzip-1.3.5-asm-execstack.patch
new file mode 100644
index 000000000000..40cda597ae7b
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-asm-execstack.patch
@@ -0,0 +1,15 @@
+Ripped from Fedora.
+Include stack markings in the asm code so the final binary
+isn't assumed to require executable markings.
+--- gzip-1.3.5/match.c
++++ gzip-1.3.5/match.c
+@@ -54,6 +54,9 @@
+ .globl _match_init
+ .globl _longest_match
+
++ .section .note.GNU-stack, "", @progbits
++ .previous
++
+ .text
+
+ _match_init:
diff --git a/app-arch/gzip/files/gzip-1.3.5-debian.patch b/app-arch/gzip/files/gzip-1.3.5-debian.patch
new file mode 100644
index 000000000000..0e4908f1e1e7
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-debian.patch
@@ -0,0 +1,121 @@
+Hunks ripped from Debian's patchset.
+
+--- gzip-1.3.5.orig/gzexe.in
++++ gzip-1.3.5/gzexe.in
+@@ -42,8 +42,10 @@
+ exit 1
+ fi
+
++set -C
+ tmp=gz$$
+-trap "rm -f $tmp; exit 1" 1 2 3 5 10 13 15
++trap "rm -f $tmp; exit 1" HUP INT QUIT TRAP USR1 PIPE TERM
++: > $tmp || exit 1
+
+ decomp=0
+ res=0
+@@ -53,8 +55,8 @@
+ shift
+ fi
+
+-echo hi > zfoo1$$
+-echo hi > zfoo2$$
++echo hi > zfoo1$$ || exit 1
++echo hi > zfoo2$$ || exit 1
+ if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then
+ cpmod=${CPMOD-cpmod}
+ fi
+@@ -110,26 +112,28 @@
+ writable=0
+ chmod u+w $tmp 2>/dev/null
+ fi
++ : >| $tmp # truncate the file, ignoring set -C
+ fi
+ if test $decomp -eq 0; then
+- sed 1q $0 > $tmp
++ sed 1q $0 >> $tmp
+ sed "s|^if tail|if $tail|" >> $tmp <<'EOF'
+-skip=22
++skip=23
+ set -C
+ umask=`umask`
+ umask 77
+-if tail +$skip "$0" | "BINDIR"/gzip -cd > /tmp/gztmp$$; then
++tmpfile=`tempfile -p gztmp -d /tmp` || exit 1
++if tail +$skip "$0" | /bin/gzip -cd >> $tmpfile; then
+ umask $umask
+- /bin/chmod 700 /tmp/gztmp$$
++ /bin/chmod 700 $tmpfile
+ prog="`echo $0 | /bin/sed 's|^.*/||'`"
+- if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then
+- trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0
+- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null &
++ if /bin/ln $tmpfile "/tmp/$prog" 2>/dev/null; then
++ trap '/bin/rm -f $tmpfile "/tmp/$prog"; exit $res' 0
++ (/bin/sleep 5; /bin/rm -f $tmpfile "/tmp/$prog") 2>/dev/null &
+ /tmp/"$prog" ${1+"$@"}; res=$?
+ else
+- trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0
+- (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null &
+- /tmp/gztmp$$ ${1+"$@"}; res=$?
++ trap '/bin/rm -f $tmpfile; exit $res' 0
++ (/bin/sleep 5; /bin/rm -f $tmpfile) 2>/dev/null &
++ $tmpfile ${1+"$@"}; res=$?
+ fi
+ else
+ echo Cannot decompress $0; exit 1
+@@ -144,8 +148,8 @@
+
+ else
+ # decompression
+- skip=22
+- if sed -e 1d -e 2q "$i" | grep "^skip=[0-9][0-9]*$" >/dev/null; then
++ skip=23
++ if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
+ eval `sed -e 1d -e 2q "$i"`
+ fi
+ if tail +$skip "$i" | gzip -cd > $tmp; then
+--- gzip-1.3.5.orig/zmore.in
++++ gzip-1.3.5/zmore.in
+@@ -34,16 +34,16 @@
+ cb='min 1 -icanon'; ncb='icanon eof ^d'
+ fi
+ if test $? -eq 0 && test -n "$oldtty"; then
+- trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
++ trap 'stty $oldtty 2>/dev/null; exit' INT QUIT TRAP USR1 PIPE TERM
+ else
+- trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
++ trap 'stty $ncb echo 2>/dev/null; exit' INT QUIT TRAP USR1 PIPE TERM
+ fi
+
+ if test $# = 0; then
+ if test -t 0; then
+ echo usage: ${ZMORE_PROGRAM_NAME-zmore} files...
+ else
+- gzip -cdfq | eval ${PAGER-more}
++ gzip -cdfq | eval more
+ fi
+ else
+ FIRST=1
+@@ -62,7 +62,7 @@
+ fi
+ if test "$ANS" != 's'; then
+ echo "------> $FILE <------"
+- gzip -cdfq "$FILE" | eval ${PAGER-more}
++ gzip -cdfq "$FILE" | more
+ fi
+ if test -t 1; then
+ FIRST=0
+--- gzip-1.3.5.orig/znew.in
++++ gzip-1.3.5/znew.in
+@@ -16,8 +16,8 @@
+ warn="(does not preserve modes and timestamp)"
+ tmp=/tmp/zfoo.$$
+ set -C
+-echo hi > $tmp.1
+-echo hi > $tmp.2
++echo hi > $tmp.1 || exit 1
++echo hi > $tmp.2 || exit 1
+ if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
+ cpmod=${CPMOD-cpmod}
+ warn=""
diff --git a/app-arch/gzip/files/gzip-1.3.5-gunzip-dir.patch b/app-arch/gzip/files/gzip-1.3.5-gunzip-dir.patch
new file mode 100644
index 000000000000..5f0e4ab08a66
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-gunzip-dir.patch
@@ -0,0 +1,17 @@
+Fix a bug reported by Ulf Harnhammar (patch by him too):
+gzip: dir traversal bug when using "gunzip -N"
+
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=305255
+http://bugs.gentoo.org/show_bug.cgi?id=89946
+
+--- gzip-1.3.5/gzip.c
++++ gzip-1.3.5/gzip.c
+@@ -1344,6 +1344,8 @@
+ error("corrupted input -- file name too large");
+ }
+ }
++ char *base2 = base_name (base); /* strip any paths that may exists */
++ strcpy(base, base2); /* in the output name */
+ /* If necessary, adapt the name to local OS conventions: */
+ if (!list) {
+ MAKE_LEGAL_NAME(base);
diff --git a/app-arch/gzip/files/gzip-1.3.5-gzip-perm.patch b/app-arch/gzip/files/gzip-1.3.5-gzip-perm.patch
new file mode 100644
index 000000000000..1ee4aee55e5e
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-gzip-perm.patch
@@ -0,0 +1,68 @@
+Ripped from Fedora.
+
+Get rid of a possible race condition:
+ - close output file
+ - bad man plays with output file
+ - try to chmod output file
+Run the chmod on the file descriptor before we close it instead.
+
+--- gzip-1.3.5/gzip.c
++++ gzip-1.3.5/gzip.c
+@@ -881,6 +881,20 @@
+ }
+
+ close(ifd);
++ /* ofd ownership and permissions have to be set before close(ofd)*/
++ if (!to_stdout) {
++ if (fchmod(ofd, istat.st_mode & 07777)) {
++ int e = errno;
++ WARN((stderr, "%s: ", progname));
++ if (!quiet) {
++ errno = e;
++ perror(ofname);
++ }
++ }
++#ifndef NO_CHOWN
++ fchown(ofd, istat.st_uid, istat.st_gid); /* Copy ownership */
++#endif
++ }
+ if (!to_stdout && close(ofd)) {
+ write_error();
+ }
+@@ -902,7 +916,7 @@
+ }
+ fprintf(stderr, "\n");
+ }
+- /* Copy modes, times, ownership, and remove the input file */
++ /* Copy times and remove the input file */
+ if (!to_stdout) {
+ copy_stat(&istat);
+ }
+@@ -1715,7 +1729,7 @@
+
+
+ /* ========================================================================
+- * Copy modes, times, ownership from input file to output file.
++ * Copy times from input file to output file.
+ * IN assertion: to_stdout is false.
+ */
+ local void copy_stat(ifstat)
+@@ -1730,18 +1744,6 @@
+ }
+ reset_times(ofname, ifstat);
+ #endif
+- /* Copy the protection modes */
+- if (chmod(ofname, ifstat->st_mode & 07777)) {
+- int e = errno;
+- WARN((stderr, "%s: ", progname));
+- if (!quiet) {
+- errno = e;
+- perror(ofname);
+- }
+- }
+-#ifndef NO_CHOWN
+- chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
+-#endif
+ remove_ofname = 0;
+ /* It's now safe to remove the input file: */
+ if (xunlink (ifname)) {
diff --git a/app-arch/gzip/files/gzip-1.3.5-infodir.patch b/app-arch/gzip/files/gzip-1.3.5-infodir.patch
new file mode 100644
index 000000000000..bbe3c0dd9b5d
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-infodir.patch
@@ -0,0 +1,38 @@
+Taken from Debian.
+
+--- gzip-1.3.5/gzip.texi
++++ gzip-1.3.5/gzip.texi
+@@ -6,7 +6,14 @@
+ @finalout
+ @setchapternewpage odd
+ @c %**end of header
++@dircategory Utilities
++@direntry
++* gzip: (gzip). The gzip command for compressing files.
++@end direntry
++
+ @copying
++This file documents the GNU `gzip' command for compressing files.
++
+ This manual is for Gzip
+ (version @value{VERSION}, @value{UPDATED}),
+ and documents commands for compressing and decompressing data.
+@@ -31,18 +38,6 @@
+ @end quotation
+ @end copying
+
+-@c Debian install-info (up through at least version 1.9.20) uses only the
+-@c first dircategory. Put this one first, as it is more useful in practice.
+-@dircategory Individual utilities
+-@direntry
+-* gzip: (gzip)Invoking gzip. Compress files.
+-@end direntry
+-
+-@dircategory Utilities
+-@direntry
+-* Gzip: (gzip). The gzip command for compressing files.
+-@end direntry
+-
+ @titlepage
+ @title gzip
+ @subtitle The data compression program
diff --git a/app-arch/gzip/files/gzip-1.3.5-rsync.patch b/app-arch/gzip/files/gzip-1.3.5-rsync.patch
new file mode 100644
index 000000000000..6f4d7f22fd8e
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-rsync.patch
@@ -0,0 +1,279 @@
+Patch by Rusty Russell that adds --rsyncable option to gzip.
+
+Debian & Fedora use this, so let's join the party :p.
+
+--- gzip-1.3.2/deflate.c
++++ gzip-1.3.2/deflate.c
+@@ -122,6 +122,14 @@
+ #endif
+ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
++#ifndef RSYNC_WIN
++# define RSYNC_WIN 4096
++#endif
++/* Size of rsync window, must be < MAX_DIST */
++
++#define RSYNC_SUM_MATCH(sum) ((sum) % RSYNC_WIN == 0)
++/* Whether window sum matches magic value */
++
+ /* ===========================================================================
+ * Local data used by the "longest match" routines.
+ */
+@@ -203,6 +211,8 @@
+ unsigned near good_match;
+ /* Use a faster search when the previous match is longer than this */
+
++local ulg rsync_sum; /* rolling sum of rsync window */
++local ulg rsync_chunk_end; /* next rsync sequence point */
+
+ /* 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
+@@ -301,6 +311,10 @@
+ #endif
+ /* prev will be initialized on the fly */
+
++ /* rsync params */
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ rsync_sum = 0;
++
+ /* Set the default configuration parameters:
+ */
+ max_lazy_match = configuration_table[pack_level].max_lazy;
+@@ -537,6 +551,8 @@
+ memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
+ match_start -= WSIZE;
+ strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */
++ if (rsync_chunk_end != 0xFFFFFFFFUL)
++ rsync_chunk_end -= WSIZE;
+
+ block_start -= (long) WSIZE;
+
+@@ -564,13 +580,46 @@
+ }
+ }
+
++local void rsync_roll(start, num)
++ unsigned start;
++ unsigned num;
++{
++ unsigned i;
++
++ if (start < RSYNC_WIN) {
++ /* before window fills. */
++ for (i = start; i < RSYNC_WIN; i++) {
++ if (i == start + num) return;
++ rsync_sum += (ulg)window[i];
++ }
++ num -= (RSYNC_WIN - start);
++ start = RSYNC_WIN;
++ }
++
++ /* buffer after window full */
++ for (i = start; i < start+num; i++) {
++ /* New character in */
++ rsync_sum += (ulg)window[i];
++ /* Old character out */
++ rsync_sum -= (ulg)window[i - RSYNC_WIN];
++ if (rsync_chunk_end == 0xFFFFFFFFUL && RSYNC_SUM_MATCH(rsync_sum))
++ rsync_chunk_end = i;
++ }
++}
++
++/* ===========================================================================
++ * Set rsync_chunk_end if window sum matches magic value.
++ */
++#define RSYNC_ROLL(s, n) \
++ do { if (rsync) rsync_roll((s), (n)); } while(0)
++
+ /* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+ #define FLUSH_BLOCK(eof) \
+ flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
+- (char*)NULL, (long)strstart - block_start, (eof))
++ (char*)NULL, (long)strstart - block_start, flush-1, (eof))
+
+ /* ===========================================================================
+ * Processes a new input file and return its compressed length. This
+@@ -581,7 +630,7 @@
+ local off_t deflate_fast()
+ {
+ IPos hash_head; /* head of the hash chain */
+- int flush; /* set if current block must be flushed */
++ int flush; /* set if current block must be flushed, 2=>and padded */
+ unsigned match_length = 0; /* length of best match */
+
+ prev_length = MIN_MATCH-1;
+@@ -610,6 +659,7 @@
+
+ lookahead -= 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.
+ */
+@@ -638,9 +688,14 @@
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c",window[strstart]));
+ flush = ct_tally (0, window[strstart]);
++ RSYNC_ROLL(strstart, 1);
+ lookahead--;
+ 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
+@@ -713,6 +768,7 @@
+ */
+ lookahead -= prev_length-1;
+ prev_length -= 2;
++ RSYNC_ROLL(strstart, prev_length+1);
+ do {
+ strstart++;
+ INSERT_STRING(strstart, hash_head);
+@@ -725,24 +781,39 @@
+ match_available = 0;
+ match_length = MIN_MATCH-1;
+ strstart++;
+- if (flush) FLUSH_BLOCK(0), block_start = strstart;
+
++ if (rsync && strstart > rsync_chunk_end) {
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
++ }
++ if (flush) FLUSH_BLOCK(0), block_start = strstart;
+ } else if (match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr,"%c",window[strstart-1]));
+- if (ct_tally (0, window[strstart-1])) {
+- FLUSH_BLOCK(0), block_start = strstart;
+- }
++ flush = ct_tally (0, window[strstart-1]);
++ if (rsync && strstart > rsync_chunk_end) {
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
++ }
++ if (flush) FLUSH_BLOCK(0), block_start = strstart;
++ RSYNC_ROLL(strstart, 1);
+ strstart++;
+ lookahead--;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
++ if (rsync && strstart > rsync_chunk_end) {
++ /* Reset huffman tree */
++ rsync_chunk_end = 0xFFFFFFFFUL;
++ flush = 2;
++ FLUSH_BLOCK(0), block_start = strstart;
++ }
+ match_available = 1;
++ RSYNC_ROLL(strstart, 1);
+ strstart++;
+ lookahead--;
+ }
+--- gzip-1.3.2/gzip.c
++++ gzip-1.3.2/gzip.c
+@@ -249,6 +249,7 @@
+ unsigned insize; /* valid bytes in inbuf */
+ unsigned inptr; /* index of next byte to be processed in inbuf */
+ unsigned outcnt; /* bytes in output buffer */
++int rsync = 0; /* make ryncable chunks */
+
+ struct option longopts[] =
+ {
+@@ -278,6 +279,7 @@
+ {"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 }
+ };
+
+@@ -368,6 +370,7 @@
+ " -Z --lzw produce output compatible with old compress",
+ " -b --bits maxbits max number of bits per code (implies -Z)",
+ #endif
++ " --rsyncable Make rsync-friendly archive",
+ " file... files to (de)compress. If none given, use standard input.",
+ "Report bugs to <bug-gzip@gnu.org>.",
+ 0};
+@@ -546,6 +549,9 @@
+ #else
+ recursive = 1; break;
+ #endif
++ case 'R':
++ rsync = 1; break;
++
+ case 'S':
+ #ifdef NO_MULTIPLE_DOTS
+ if (*optarg == '.') optarg++;
+--- gzip-1.3.2/gzip.h
++++ gzip-1.3.2/gzip.h
+@@ -133,6 +133,7 @@
+ 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 */
++extern int rsync; /* deflate into rsyncable chunks */
+
+ extern off_t bytes_in; /* number of input bytes */
+ extern off_t bytes_out; /* number of output bytes */
+@@ -281,7 +282,7 @@
+ /* 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));
+
+ /* in bits.c */
+ void bi_init OF((file_t zipfile));
+--- gzip-1.3.2/gzip.texi
++++ gzip-1.3.2/gzip.texi
+@@ -340,6 +340,14 @@
+ into the directory and compress all the files it finds there (or
+ decompress them in the case of @code{gunzip}).
+
++@item --rsyncable
++While compressing, synchronize the output occasionally based on the
++input. This reduces compression by about 1 percent most cases, but
++means that the @code{rsync} program can take advantage of similarities
++in the uncompressed input when syncronizing two files compressed with
++this flag. @code{gunzip} cannot tell the difference between a
++compressed file created with this option, and one created without it.
++
+ @item --suffix @var{suf}
+ @itemx -S @var{suf}
+ Use suffix @samp{@var{suf}} instead of @samp{.gz}. Any suffix can be
+--- gzip-1.3.2/trees.c
++++ gzip-1.3.2/trees.c
+@@ -847,9 +847,10 @@
+ * trees or store, and output the encoded block to the zip file. This function
+ * returns the total compressed length for the file so far.
+ */
+-off_t flush_block(buf, stored_len, eof)
++off_t flush_block(buf, stored_len, pad, eof)
+ char *buf; /* input block, or NULL if too old */
+ ulg stored_len; /* length of input block */
++ int pad; /* pad output to byte boundary */
+ int eof; /* true if this is the last block for a file */
+ {
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+@@ -941,6 +942,10 @@
+ Assert (input_len == bytes_in, "bad input size");
+ bi_windup();
+ compressed_len += 7; /* align on byte boundary */
++ } else if (pad && (compressed_len % 8) != 0) {
++ send_bits((STORED_BLOCK<<1)+eof, 3); /* send block type */
++ compressed_len = (compressed_len + 3 + 7) & ~7L;
++ copy_block(buf, 0, 1); /* with header */
+ }
+
+ return compressed_len >> 3;
diff --git a/app-arch/gzip/files/gzip-1.3.5-zgrep-sed.patch b/app-arch/gzip/files/gzip-1.3.5-zgrep-sed.patch
new file mode 100644
index 000000000000..9681818ac539
--- /dev/null
+++ b/app-arch/gzip/files/gzip-1.3.5-zgrep-sed.patch
@@ -0,0 +1,33 @@
+Ripped from Fedora.
+
+http://bugs.gentoo.org/90626
+
+--- zgrep.in
++++ zgrep.in
+@@ -24,7 +24,7 @@
+
+ PATH="BINDIR:$PATH"; export PATH
+
+-prog=`echo $0 | sed 's|.*/||'`
++prog=`echo "$0" | sed 's|.*/||'`
+ case "$prog" in
+ *egrep) grep=${EGREP-egrep -a} ;;
+ *fgrep) grep=${FGREP-fgrep -a} ;;
+@@ -112,12 +112,15 @@
+ fi
+ $uncompress -cdfq "$i" |
+ if test $files_with_matches -eq 1; then
+- $grep $opt "$pat" > /dev/null && echo $i
++ $grep $opt "$pat" > /dev/null && printf "%s\n" "$i"
+ elif test $files_without_matches -eq 1; then
+- $grep $opt "$pat" > /dev/null || echo $i
++ $grep $opt "$pat" > /dev/null || printf "%s\n" "$i"
+ elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then
+ $grep $opt "$pat"
+ else
++ i=${i//\\/\\\\}
++ i=${i//|/\\|}
++ i=${i//&/\\&}
+ if test $with_filename -eq 1; then
+ sed_script="s|^[^:]*:|${i}:|"
+ else
diff --git a/app-arch/gzip/files/gzip-1.3.5-znew-tempfile.patch b/app-arch/gzip/files/gzip-1.3.5-znew-tempfile.patch
deleted file mode 100644
index 14f671280db8..000000000000
--- a/app-arch/gzip/files/gzip-1.3.5-znew-tempfile.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./znew.in~ 2004-11-11 19:40:30.000000000 +0100
-+++ ./znew.in 2004-11-11 19:51:20.100650392 +0100
-@@ -14,10 +14,15 @@
- # block is the disk block size (best guess, need not be exact)
-
- warn="(does not preserve modes and timestamp)"
--tmp=/tmp/zfoo.$$
-+tmp=`tempfile -d /tmp -p zfoo` || {
-+ echo 'cannot create a temporary file' >&2
-+ exit 1
-+}
- set -C
- echo hi > $tmp.1 || exit 1
- echo hi > $tmp.2 || exit 1
-+trap 'rm -f $tmp.1; exit 2' HUP INT PIPE TERM 0
-+trap 'rm -f $tmp.2; exit 2' HUP INT PIPE TERM 0
- if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
- cpmod=${CPMOD-cpmod}
- warn=""
diff --git a/app-arch/gzip/gzip-1.3.5-r6.ebuild b/app-arch/gzip/gzip-1.3.5-r6.ebuild
new file mode 100644
index 000000000000..9896af87e028
--- /dev/null
+++ b/app-arch/gzip/gzip-1.3.5-r6.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/gzip/gzip-1.3.5-r6.ebuild,v 1.1 2005/05/02 22:00:50 vapier Exp $
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Standard GNU compressor"
+HOMEPAGE="http://www.gnu.org/software/gzip/gzip.html"
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="nls build static pic"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+PROVIDE="virtual/gzip"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-debian.patch
+ epatch "${FILESDIR}"/${P}-znew-tempfile-2.patch
+ epatch "${FILESDIR}"/${P}-gunzip-dir.patch
+ epatch "${FILESDIR}"/${P}-asm-execstack.patch
+ epatch "${FILESDIR}"/${P}-gzip-perm.patch
+ epatch "${FILESDIR}"/${P}-infodir.patch
+ epatch "${FILESDIR}"/${P}-rsync.patch
+ epatch "${FILESDIR}"/${P}-zgrep-sed.patch
+}
+
+src_compile() {
+ use static && append-flags -static
+ # avoid text relocation in gzip
+ use pic && export DEFS="NO_ASM"
+ econf --exec-prefix=/ $(use_enable nls) || die
+ emake || die
+}
+
+src_install() {
+ dodir /usr/bin /usr/share/man/man1
+ make prefix=${D}/usr \
+ exec_prefix=${D}/ \
+ mandir=${D}/usr/share/man \
+ infodir=${D}/usr/share/info \
+ install || die
+
+ cd ${D}/bin
+
+ for i in gzexe zforce zgrep zmore znew zcmp
+ do
+ sed -i -e "s:${D}::" ${i} || die
+ chmod 755 ${i}
+ done
+
+ # No need to waste space -- these guys should be links
+ # gzcat is equivilant to zcat, but historically zcat
+ # was a link to compress.
+ rm -f gunzip zcat zcmp zegrep zfgrep
+ dosym gzip /bin/gunzip
+ dosym gzip /bin/gzcat
+ dosym gzip /bin/zcat
+ dosym zdiff /bin/zcmp
+ dosym zgrep /bin/zegrep
+ dosym zgrep /bin/zfgrep
+
+ if ! use build
+ then
+ cd ${D}/usr/share/man/man1
+ rm -f gunzip.* zcmp.* zcat.*
+ ln -s gzip.1.gz gunzip.1.gz
+ ln -s zdiff.1.gz zcmp.1.gz
+ ln -s gzip.1.gz zcat.1.gz
+ ln -s gzip.1.gz gzcat.1.gz
+ cd ${S}
+ rm -rf ${D}/usr/man ${D}/usr/lib
+ dodoc ChangeLog NEWS README THANKS TODO
+ docinto txt
+ dodoc algorithm.doc gzip.doc
+ else
+ rm -rf ${D}/usr
+ fi
+}