Sync from SUSE:SLFO:Main zip revision 56a23c1b5a341d5d7f15ccb1eb040f06

This commit is contained in:
Adrian Schröter 2024-05-04 02:38:03 +02:00
commit ac932a64af
15 changed files with 893 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,97 @@
https://sourceforge.net/p/infozip/patches/25/
From 706b9fdc032582a258f0f8e5444fde4ee5bab220 Mon Sep 17 00:00:00 2001
From: Mingye Wang <arthur200126@gmail.com>
Date: Sat, 25 Jan 2020 23:07:03 +0800
Subject: [PATCH 2/2] unix: reproducible directory order (scandir)
This commit replaces the readdir() loop with scandir. This means a well-
defined, reproducible sort order, with the downside that we will need to
store ALL directory entries in memory to sort them.
I am too lazy to add a switch to change how it is supposed to work. This
is only a proof-of-concept.
Co-Authored-By: Bernhard M. Wiedemann <bwiedemann suse.de>
---
unix/unix.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
Index: zip30/unix/unix.c
===================================================================
--- zip30.orig/unix/unix.c
+++ zip30/unix/unix.c
@@ -92,6 +92,10 @@ DIR *dirp;
#define closedir(dirp) fclose(dirp)
#endif /* NO_DIR */
+#ifdef NO_SCANDIR
+/* TODO Port the FreeBSD libc version */
+#error "We need scandir now."
+#endif
local char *readd(d)
DIR *d; /* directory stream to read from */
@@ -111,12 +115,14 @@ int caseflag; /* true to force
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
- DIR *d; /* directory stream from opendir() */
- char *e; /* pointer to name from readd() */
+ char *e; /* pointer to name from scandir() */
+ int c; /* number of entries from scandir() */
+ int i; /* entry index */
int m; /* matched flag */
char *p; /* path for recursion */
z_stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
+ struct dirent **namelist;
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
@@ -176,14 +182,16 @@ int caseflag; /* true to force
}
}
/* recurse into directory */
- if (recurse && (d = opendir(n)) != NULL)
+ if (recurse && (c = scandir(n, &namelist, NULL, alphasort)) >= 0)
{
- while ((e = readd(d)) != NULL) {
+ for (i = 0; i < c; i++) {
+ e = namelist[i]->d_name;
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
- closedir(d);
+ for (; i < c; i++) free(namelist[i]);
+ free(namelist);
free((zvoid *)p);
return ZE_MEM;
}
@@ -197,8 +205,9 @@ int caseflag; /* true to force
}
free((zvoid *)a);
}
+ free(namelist[i]);
}
- closedir(d);
+ free(namelist);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) */
Index: zip30/test.sh
===================================================================
--- /dev/null
+++ zip30/test.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+mkdir -p test/{a,b,c}
+echo x > test/a/x
+echo y > test/a/y
+echo y > test/b/y
+export SOURCE_DATE_EPOCH=1
+./zip -X -r test.zip test
+md5sum test.zip
+echo "89057b9c9501ce122973d24b68a0522a test.zip" | md5sum -c
+

37
reproducible.patch Normal file
View File

@ -0,0 +1,37 @@
Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2019-05-03
Override mtime with zip -X
and SOURCE_DATE_EPOCH
to allow for reproducible builds of .zip files
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
Index: zip30/zipup.c
===================================================================
--- zip30.orig/zipup.c
+++ zip30/zipup.c
@@ -414,6 +414,7 @@ struct zlist far *z; /* zip entry to
ush tempcext = 0;
char *tempextra = NULL;
char *tempcextra = NULL;
+ const char *source_date_epoch;
#ifdef WINDLL
@@ -674,6 +675,13 @@ struct zlist far *z; /* zip entry to
} /* strcmp(z->name, "-") == 0 */
+ if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) {
+ time_t epoch = strtoull(source_date_epoch, NULL, 10);
+ if (epoch > 0) {
+ ulg epochtim = unix2dostime(&epoch);
+ if (z->tim > epochtim) z->tim = epochtim;
+ }
+ }
if (extra_fields == 2) {
unsigned len;
char *p;

View File

@ -0,0 +1,10 @@
--- zip.c
+++ zip.c
@@ -730,6 +730,7 @@
" -r recurse into directories (see Recursion below)",
" -m after archive created, delete original files (move into archive)",
" -j junk directory names (store just file names)",
+" -k Attempt to convert the names and paths to conform to MSDOS",
" -q quiet operation",
" -v verbose operation (just \"zip -v\" shows version information)",
" -c prompt for one-line comment for each entry",

13
zip-3.0-fix-doc.patch Normal file
View File

@ -0,0 +1,13 @@
Index: zip30/zip.txt
===================================================================
--- zip30.orig/zip.txt
+++ zip30/zip.txt
@@ -1620,7 +1620,7 @@ OPTIONS
See -i for more on include and exclude.
-X
- --no-extra
+ --strip-extra
Do not save extra file attributes (Extended Attributes on OS/2,
uid/gid and file times on Unix). The zip format uses extra
fields to include additional information for each entry. Some

View File

@ -0,0 +1,65 @@
--- zipfile.c
+++ zipfile.c
@@ -2166,7 +2166,7 @@ int readlocal(localz, z)
#ifndef UTIL
ulg start_disk = 0;
uzoff_t start_offset = 0;
- char *split_path;
+ char *split_path = NULL;
start_disk = z->dsk;
start_offset = z->off;
@@ -2197,6 +2197,7 @@ int readlocal(localz, z)
split_path = get_in_split_path(in_path, start_disk);
}
}
+ if (split_path) free(split_path);
#endif
/* For utilities assume archive is on one disk for now */
@@ -6014,7 +6015,7 @@ int zipcopy(z)
ulg e = 0; /* extended local header size */
ulg start_disk = 0;
uzoff_t start_offset = 0;
- char *split_path;
+ char *split_path = NULL;
char buf[LOCHEAD + 1];
struct zlist far *localz;
int r;
@@ -6063,6 +6064,7 @@ int zipcopy(z)
split_path = get_in_split_path(in_path, start_disk);
}
}
+ if (split_path) free(split_path);
if (zfseeko(in_file, start_offset, SEEK_SET) != 0) {
fclose(in_file);
--- zip.c
+++ zip.c
@@ -3450,6 +3450,7 @@ char **argv; /* command line
}
}
*/
+ free(value); /* Added by Polo from forum */
if (kk == 3) {
first_listarg = argnum;
kk = 4;
--- fileio.c
+++ fileio.c
@@ -696,6 +696,7 @@ int newnamew(namew, isdir, casesensitive
return ZE_MEM;
}
strcpy(z->name, name);
+ if (z->oname) free(z->oname);
z->oname = oname;
oname = NULL;
z->dosflag = dosflag;
@@ -959,6 +960,7 @@ int newname(name, isdir, casesensitive)
return ZE_MEM;
}
strcpy(z->name, name);
+ if (z->oname) free(z->oname);
z->oname = oname;
z->dosflag = dosflag;

253
zip-3.0-iso8859_2.patch Normal file
View File

@ -0,0 +1,253 @@
Index: ebcdic.h
===================================================================
--- ebcdic.h.orig 2005-04-09 23:10:02.000000000 +0200
+++ ebcdic.h 2010-05-21 18:47:36.891591234 +0200
@@ -277,6 +277,24 @@ ZCONST uch Far iso2oem[] = {
0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */
};
#endif /* OEM_RUS */
+ZCONST uch Far iso2oem_2[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
+ 0x20, 0xA4, 0xF4, 0x9D, 0xCF, 0x95, 0x97, 0xF5,
+ 0xF9, 0xE6, 0xB8, 0x9B, 0x8D, 0x2D, 0xA6, 0xBD,
+ 0x20, 0xA5, 0xF2, 0x88, 0xEF, 0x96, 0x98, 0xF3,
+ 0xF7, 0xE7, 0xAD, 0x9C, 0xAB, 0xF1, 0xA7, 0xBE,
+ 0xE8, 0xB5, 0xB6, 0xC6, 0x8E, 0x91, 0x8F, 0x80,
+ 0xAC, 0x90, 0xA8, 0xD3, 0xB7, 0xD6, 0xD7, 0xD2,
+ 0xD1, 0xE3, 0xD5, 0xE0, 0xE2, 0x8A, 0x99, 0x9E,
+ 0xFC, 0xDE, 0xE9, 0xEB, 0x9A, 0xED, 0xDD, 0xE1,
+ 0xEA, 0xA0, 0x83, 0xC7, 0x84, 0x92, 0x86, 0x87,
+ 0x9F, 0x82, 0xA9, 0x89, 0xD8, 0xA1, 0x8C, 0xD4,
+ 0xD0, 0xE4, 0xE5, 0xA2, 0x93, 0x8B, 0x94, 0xF6,
+ 0xFD, 0x85, 0xA3, 0xFB, 0x81, 0xEC, 0xEE, 0xFA
+};
#endif /* IZ_ISO2OEM_ARRAY */
#ifdef IZ_OEM2ISO_ARRAY
@@ -319,6 +337,25 @@ ZCONST uch Far oem2iso[] = {
0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, 0xA6, 0xA0 /* F8 - FF */
};
#endif /* OEM_RUS */
+
+ZCONST uch Far oem2iso_2[] = {
+ 0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xF9, 0xE6, 0xE7,
+ 0xB3, 0xEB, 0xD5, 0xF5, 0xEE, 0xAC, 0xC4, 0xC6,
+ 0xC9, 0xC5, 0xE5, 0xF4, 0xF6, 0xA5, 0xB5, 0xA6,
+ 0xB6, 0xD6, 0xDC, 0xAB, 0xBB, 0xA3, 0xD7, 0xE8,
+ 0xE1, 0xED, 0xF3, 0xFA, 0xA1, 0xB1, 0xAE, 0xBE,
+ 0xCA, 0xEA, 0xAA, 0xBC, 0xC8, 0xBA, 0x3C, 0x3E,
+ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xC1, 0xC2, 0xCC,
+ 0xAA, 0xB9, 0xBA, 0xBB, 0xBC, 0xAF, 0xBF, 0xBF,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC3, 0xE3,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xA4,
+ 0xF0, 0xD0, 0xCF, 0xCB, 0xEF, 0xD2, 0xCD, 0xCE,
+ 0xEC, 0xD9, 0xDA, 0xDB, 0xDC, 0xDE, 0xD9, 0xDF,
+ 0xD3, 0xDF, 0xD4, 0xD1, 0xF1, 0xF2, 0xA9, 0xB9,
+ 0xC0, 0xDA, 0xE0, 0xDB, 0xFD, 0xDD, 0xFE, 0xB4,
+ 0xF0, 0xBD, 0xB2, 0xB7, 0xA2, 0xA7, 0xF7, 0xB8,
+ 0xF8, 0xA8, 0xFF, 0xFB, 0xD8, 0xF8, 0xFE, 0xFF
+};
#endif /* IZ_OEM2ISO_ARRAY */
#if defined(THEOS) || defined(THEOS_SUPPORT)
Index: globals.c
===================================================================
--- globals.c.orig 2008-05-25 19:26:38.000000000 +0200
+++ globals.c 2010-05-21 18:47:36.895590875 +0200
@@ -32,6 +32,8 @@ int pathput = 1; /* 1=store path
int scanimage = 1; /* 1=scan through image files */
#endif
int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
+int winify = 0; /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */
+int iso8859_2 = 0; /* 1=ISO8859-2 will be used instead of ISO8859-1 */
int dosify = 0; /* 1=make new entries look like MSDOS */
int verbose = 0; /* 1=report oddities in zip file structure */
int fix = 0; /* 1=fix the zip file, 2=FF, 3=ZipNote */
Index: man/zip.1
===================================================================
--- man/zip.1.orig 2008-06-17 02:39:40.000000000 +0200
+++ man/zip.1 2010-05-21 18:47:36.895590875 +0200
@@ -18,7 +18,7 @@
zip \- package and compress (archive) files
.SH SYNOPSIS
.B zip
-.RB [\- aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$ ]
+.RB [\- aABcdDeEfFghjklLmoOqrRSTuvVwXyz!@$ ]
[\-\-longoption ...]
.RB [\- b " path]"
.RB [\- n " suffixes]"
@@ -1322,7 +1322,15 @@ Attempt to convert the names and paths t
store only the MSDOS attribute (just the user write attribute from Unix),
and mark the entry as made under MSDOS (even though it was not);
for compatibility with PKUNZIP under MSDOS which cannot handle certain
-names such as those with two dots.
+names such as those with two dots. Conversion from ISO8859-1 to
+IBM PC CP 852 is used. See also
+.B \-OO
+.TP
+.B \-K
+Attempt to convert the names and paths to conform to MS Windows. Behaviour
+similar to
+.B \-k
+but long names are used.
.TP
.PD 0
.B \-l
@@ -1578,6 +1586,12 @@ with encrypted entries, \fIzipcloak\fP w
them to normal entries.
.TP
.PD 0
+.B \-OO
+File names will be converted from ISO8859-2 instead of from ISO8859-1. See
+.B \-k
+for details.
+.TP
+.PD 0
.B \-p
.TP
.PD
Index: unix/unix.c
===================================================================
--- unix/unix.c.orig 2008-06-19 06:26:18.000000000 +0200
+++ unix/unix.c 2010-05-21 18:47:36.975590824 +0200
@@ -267,9 +267,14 @@ int *pdosflag; /* output: force
return NULL;
strcpy(n, t);
- if (dosify)
+ if ((dosify) && (!winify))
msname(n);
+#ifdef IZ_ISO2OEM_ARRAY
+ if (dosify)
+ str_iso_to_oem(n, n);
+#endif
+
#ifdef EBCDIC
strtoasc(n, n); /* here because msname() needs native coding */
#endif
Index: util.c
===================================================================
--- util.c.orig 2008-03-29 13:19:08.000000000 +0100
+++ util.c 2010-05-21 18:47:37.287590701 +0200
@@ -725,7 +725,10 @@ char *str_iso_to_oem(dst, src)
char *dst;
{
char *dest_start = dst;
- while (*dst++ = (char)iso2oem[(uch)(*src++)]);
+ if (!iso8859_2)
+ while (*src) { *dst++ = (*src & 0x80) ? iso2oem[*src++ & 0x7f] : *src++; }
+ else
+ while (*src) { *dst++ = (*src & 0x80) ? iso2oem_2[*src++ & 0x7f] : *src++; }
return dest_start;
}
#endif
@@ -736,7 +739,10 @@ char *str_oem_to_iso(dst, src)
char *dst;
{
char *dest_start = dst;
- while (*dst++ = (char)oem2iso[(uch)(*src++)]);
+ if (!iso8859_2)
+ while (*src) { *dst++ = (*src & 0x80) ? oem2iso[*src++ & 0x7f] : *src++; }
+ else
+ while (*src) { *dst++ = (*src & 0x80) ? oem2iso_2[*src++ & 0x7f] : *src++; }
return dest_start;
}
#endif
Index: zip.c
===================================================================
--- zip.c.orig 2008-07-05 18:34:06.000000000 +0200
+++ zip.c 2010-05-21 18:48:04.779644629 +0200
@@ -1942,7 +1942,7 @@ int set_filetype(out_path)
#ifdef UNICODE_TEST
#define o_sC 0x146
#endif
-
+#define o_OO 0x147
/* the below is mainly from the old main command line
switch with a few changes */
@@ -2025,6 +2025,7 @@ struct option_struct far options[] = {
#endif /* ?MACOS */
{"J", "junk-sfx", o_NO_VALUE, o_NOT_NEGATABLE, 'J', "strip self extractor from archive"},
{"k", "DOS-names", o_NO_VALUE, o_NOT_NEGATABLE, 'k', "force use of 8.3 DOS names"},
+ {"K", "latin1-entries", o_NO_VALUE, o_NOT_NEGATABLE, 'K', "convert file names from CP850 to ISO8859-1"},
{"l", "to-crlf", o_NO_VALUE, o_NOT_NEGATABLE, 'l', "convert text file line ends - LF->CRLF"},
{"ll", "from-crlf", o_NO_VALUE, o_NOT_NEGATABLE, o_ll, "convert text file line ends - CRLF->LF"},
{"lf", "logfile-path",o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_lf, "log to log file at path (default overwrite)"},
@@ -2043,6 +2044,7 @@ struct option_struct far options[] = {
#endif
{"o", "latest-time", o_NO_VALUE, o_NOT_NEGATABLE, 'o', "use latest entry time as archive time"},
{"O", "output-file", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'O', "set out zipfile different than in zipfile"},
+ {"OO", "iso8859-2", o_NO_VALUE, o_NOT_NEGATABLE, o_OO, "Use ISO8859-2 instead of ISO8859-1"},
{"p", "paths", o_NO_VALUE, o_NOT_NEGATABLE, 'p', "store paths"},
{"P", "password", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'P', "encrypt entries, option value is password"},
#if defined(QDOS) || defined(QLZIP)
@@ -2289,6 +2291,8 @@ char **argv; /* command line
dispose = 0; /* 1=remove files after put in zip file */
pathput = 1; /* 1=store path with name */
method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
+ winify = 0; /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */
+ iso8859_2 = 0; /* 1=ISO8859-2 will be used instead of ISO8859-1 */
dosify = 0; /* 1=make new entries look like MSDOS */
verbose = 0; /* 1=report oddities in zip file structure */
fix = 0; /* 1=fix the zip file */
@@ -2859,6 +2863,8 @@ char **argv; /* command line
junk_sfx = 1; break;
case 'k': /* Make entries using DOS names (k for Katz) */
dosify = 1; break;
+ case 'K': /* file names will be converted from IBM PC CP 850 to ISO8859-1 */
+ winify = dosify = 1; break;
case 'l': /* Translate end-of-line */
translate_eol = 1; break;
case o_ll:
@@ -2915,6 +2921,8 @@ char **argv; /* command line
free(value);
have_out = 1;
break;
+ case o_OO: /* ISO8859-2 will be used instead of ISO8859-1 */
+ iso8859_2 = 1; break;
case 'p': /* Store path with name */
break; /* (do nothing as annoyance avoidance) */
case 'P': /* password for encryption */
Index: zip.h
===================================================================
--- zip.h.orig 2008-05-25 19:23:22.000000000 +0200
+++ zip.h 2010-05-21 18:47:37.339590945 +0200
@@ -311,9 +311,11 @@ extern ZCONST uch ebcdic[256];
/* Are these ever used? 6/12/05 EG */
#ifdef IZ_ISO2OEM_ARRAY /* ISO 8859-1 (Win CP 1252) --> OEM CP 850 */
extern ZCONST uch Far iso2oem[128];
+extern ZCONST uch Far iso2oem_2[128];
#endif
#ifdef IZ_OEM2ISO_ARRAY /* OEM CP 850 --> ISO 8859-1 (Win CP 1252) */
extern ZCONST uch Far oem2iso[128];
+extern ZCONST uch Far oem2iso_2[128];
#endif
extern char errbuf[FNMAX+4081]; /* Handy place to build error messages */
@@ -342,6 +344,8 @@ extern int des_good; /* Good
extern ulg des_crc; /* Data descriptor CRC */
extern uzoff_t des_csize; /* Data descriptor csize */
extern uzoff_t des_usize; /* Data descriptor usize */
+extern int winify; /* file names will be converted from IBM PC CP 850 to ISO8859-1 */
+extern int iso8859_2; /* ISO8859-2 will be used instead of ISO8859-1 */
extern int dosify; /* Make new entries look like MSDOS */
extern char *special; /* Don't compress special suffixes */
extern int verbose; /* Report oddities in zip file structure */
Index: unix/Makefile
===================================================================
--- unix/Makefile.orig 2008-05-07 08:33:56.000000000 +0200
+++ unix/Makefile 2010-05-21 18:47:37.363590733 +0200
@@ -57,7 +57,7 @@ IZ_OUR_BZIP2_DIR = bzip2
# CFLAGS flags for C compile
# LFLAGS1 flags after output file spec, before obj file list
# LFLAGS2 flags after obj file list (libraries, etc)
-CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
+CFLAGS_NOOPT = -I. -DUNIX -DIZ_ISO2OEM_ARRAY $(LOCAL_ZIP)
CFLAGS = -O2 $(CFLAGS_NOOPT)
LFLAGS1 =
LFLAGS2 = -s

View File

@ -0,0 +1,47 @@
Date: Thu Apr 3 23:00:00 UTC 2014
From: tbehrens@suse.com
Don't clobber include/exclude pattern lists by in2ex/ex2in's chopping
off path prefixes.
--- zip.c~ 2008-07-05 18:34:06.000000000 +0200
+++ zip.c 2014-04-03 22:38:36.855065116 +0200
@@ -3217,9 +3217,14 @@
/* if nothing matches include list then still create an empty archive */
allow_empty_archive = 1;
case 'x': /* Exclude following files */
+ {
+ int old_pathput = pathput;
+ pathput = 1;
add_filter((int) option, value);
+ pathput = old_pathput;
free(value);
break;
+ }
#ifdef S_IFLNK
case 'y': /* Store symbolic links as such */
linkput = 1; break;
@@ -3322,8 +3327,11 @@
/* just ignore as just marks what follows as non-option arguments */
} else if (kk == 6) {
+ int old_pathput = pathput;
+ pathput = 1;
/* value is R pattern */
add_filter((int)'R', value);
+ pathput = old_pathput;
free(value);
if (first_listarg == 0) {
first_listarg = argnum;
@@ -3387,8 +3395,11 @@
{
kk = 4;
if (recurse == 2) {
+ int old_pathput = pathput;
+ pathput = 1;
/* reading patterns from stdin */
add_filter((int)'R', pp);
+ pathput = old_pathput;
} else {
/* file argument now processed later */
add_name(pp);

View File

@ -0,0 +1,17 @@
--- crc_i386.S
+++ crc_i386.S
@@ -302,3 +302,6 @@
#endif /* i386 || _i386 || _I386 || __i386 */
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
+
+.section .note.GNU-stack, "", @progbits
+.previous
--- match.S
+++ match.S
@@ -405,3 +405,5 @@
#endif /* i386 || _I386 || _i386 || __i386 */
#endif /* !USE_ZLIB */
+.section .note.GNU-stack, "", @progbits
+.previous

11
zip-3.0-optflags.patch Normal file
View File

@ -0,0 +1,11 @@
--- unix/Makefile
+++ unix/Makefile
@@ -202,7 +202,7 @@
eval $(MAKE) $(MAKEF) zips `cat flags`
generic_gcc:
- $(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E"
+ $(MAKE) $(MAKEF) generic CPP="gcc -E"
# AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
att6300nodir:

16
zip-3.0-tempfile.patch Normal file
View File

@ -0,0 +1,16 @@
--- fileio.c
+++ fileio.c
@@ -1490,6 +1490,13 @@
strcat(t, "ziXXXXXX"); /* must use lowercase for Linux dos file system */
# if defined(UNIX) && !defined(NO_MKSTEMP)
/* tempname should not be called */
+ {
+ int fd;
+
+ if ((fd = mkstemp(t)) < 0)
+ return NULL;
+ close(fd);
+ }
return t;
# else
return mktemp(t);

17
zip-notimestamp.patch Normal file
View File

@ -0,0 +1,17 @@
Index: unix/unix.c
===================================================================
--- unix/unix.c.orig
+++ unix/unix.c
@@ -835,11 +835,7 @@ void version_local()
/* Define the compile date string */
-#ifdef __DATE__
-# define COMPILE_DATE " on " __DATE__
-#else
-# define COMPILE_DATE ""
-#endif
+#define COMPILE_DATE ""
printf("Compiled with %s for Unix (%s)%s.\n\n",
COMPILER_NAME, OS_NAME, COMPILE_DATE);

196
zip.changes Normal file
View File

@ -0,0 +1,196 @@
-------------------------------------------------------------------
Tue Jun 21 14:35:28 UTC 2022 - Danilo Spinella <danilo.spinella@suse.com>
- Remove FORTIFY_SOURCE=3 as it triggers a buffer overflow,
fixes bsc#1200712
-------------------------------------------------------------------
Sun Feb 13 08:37:38 UTC 2022 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add 0002-unix-reproducible-directory-order-scandir.patch
to make zip file creation reproducible
- Add build time %check
-------------------------------------------------------------------
Fri May 3 10:41:10 UTC 2019 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add reproducible.patch to allow to override mtime values
stored in .zip (boo#1047218)
- Add zip-3.0-fix-doc.patch for the --strip-extra param
-------------------------------------------------------------------
Tue Nov 28 16:29:02 UTC 2017 - kstreitova@suse.com
- add zip-3.0-fix-memory_leaks.patch to fix memory leaks in zip.c,
zipfile.c and fileio.c files [bsc#1068346]
-------------------------------------------------------------------
Thu Jun 18 10:00:00 UTC 2015 - hsk@imb-jena.de
- add libbz2-devel as build requirement
-------------------------------------------------------------------
Thu Apr 3 23:00:00 UTC 2014 - tbehrens@suse.com
- Fix bnc#785305
* Add patch zip-3.0-nomutilation.patch
-------------------------------------------------------------------
Fri Apr 5 07:31:51 UTC 2013 - idonmez@suse.com
- Add Source URL, see http://en.opensuse.org/SourceUrls
- Cleanup spec file
-------------------------------------------------------------------
Fri May 21 18:52:08 CEST 2010 - pth@suse.de
- Update to Zip 3.0:
* large-file support (i.e., > 2GB)
* support for more than 65536 files per archive
* multi-part archive support
* bzip2 compression support
* Unicode (UTF-8) filename and (partial) comment support
* difference mode (for incremental backups)
* filesystem-synch mode
* cross-archive copy mode
* extended progress info and logging
* improved archive-fixing support
* improved streaming and piping
* improved command-line parser
* improved Unix FIFO support
* Unix 32-bit UIDs/GIDs (requires UnZip 6.0 to restore)
-------------------------------------------------------------------
Sat Mar 6 03:07:03 UTC 2010 - aj@suse.de
- Do not record build time in executable to have reproduceable builds.
-------------------------------------------------------------------
Thu Dec 17 21:00:06 CET 2009 - jengelh@medozas.de
- enable parallel building
-------------------------------------------------------------------
Tue Nov 24 17:20:58 UTC 2009 - crrodriguez@opensuse.org
- refresh patches
-------------------------------------------------------------------
Fri Aug 3 02:59:50 CEST 2007 - dmueller@suse.de
- update to 2.32:
* fixed -R operation to match the supplied file patterns
* handle cases where -x, -R, and -i patterns are mixed
* added some directory-search speedups
* fixed bug when encrypting large uncompressible files
* fixed selection of files to delete by date
* added -MM option where each input file pattern must
match at least one file and all input files must be readable
* added check for when Zip tries to exceed seek limit in output file
* minor changes to compile with Visual C++ 2005
* added support for Unix FIFOs (named pipes)
* other minor fixes
-------------------------------------------------------------------
Wed Jan 25 21:43:46 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Thu Dec 15 11:31:34 CET 2005 - pth@suse.de
- Compile with (limited) large file support. This will support
single files exceeding 2 GB as long as the archive stays below
that theshold.
-------------------------------------------------------------------
Mon Oct 31 15:05:10 CET 2005 - dmueller@suse.de
- build with non-executable stack
-------------------------------------------------------------------
Mon Jul 18 11:57:48 CEST 2005 - rommel@suse.de
- update to version 2.31 (has the crypto stuff previously in zip-2.3.patch,
obsoletes zip-longpath.patch, a few more fixes)
-------------------------------------------------------------------
Mon Apr 25 16:39:07 CEST 2005 - meissner@suse.de
- correctly use RPM_OPT_FLAGS.
-------------------------------------------------------------------
Thu Dec 2 13:16:56 CET 2004 - rommel@suse.de
- reworked zip-longpath.patch, missing free's after malloc
-------------------------------------------------------------------
Thu Nov 11 11:58:24 CET 2004 - rommel@suse.de
- added zip-longpath.patch (Bugzilla #47932)
-------------------------------------------------------------------
Fri Jan 9 16:01:10 CET 2004 - adrian@suse.de
- build as user
-------------------------------------------------------------------
Wed Sep 18 01:33:03 CEST 2002 - ro@suse.de
- removed bogus self-provides
-------------------------------------------------------------------
Thu Jan 24 13:57:45 CET 2002 - grimmer@suse.de
- added zip-2.3-iso8859_2.patch to fix coding conversion
between Microsoft and Linux file names
(originally from http://www.axis.cz/linux/zip_unzip.php3,
enhanced to support both ISO8859-1 and ISO8859-2 by Petr Mladek
<pmladek@suse.cz>)
-------------------------------------------------------------------
Wed Jan 23 13:46:59 CET 2002 - okir@suse.de
- Fixed tempfile race
-------------------------------------------------------------------
Mon Jun 18 13:39:45 CEST 2001 - schwab@suse.de
- Fix cpp directives inside macro call.
-------------------------------------------------------------------
Thu Dec 14 12:29:19 CET 2000 - grimmer@suse.de
- added encryption patch
- bzipped sources
- now Provides and Obsoletes crzip
-------------------------------------------------------------------
Wed Mar 1 15:21:14 CET 2000 - schwab@suse.de
- /usr/man -> /usr/share/man
-------------------------------------------------------------------
Fri Dec 17 16:22:34 MET 1999 - grimmer@suse.de
- Update to 2.3
- Spec file cleanups
-------------------------------------------------------------------
Mon Sep 13 17:23:57 CEST 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
-------------------------------------------------------------------
Mon Feb 22 16:33:10 MET 1999 - grimmer@suse.de
- New version (2.2)
- specfile updates
- added french PAC-info
----------------------------------------------------------------------------
Thu Feb 6 11:56:09 CET 1997 - rj@suse.de
- Version 2.01:
- ownerships changed
- some cosmetic changes

88
zip.spec Normal file
View File

@ -0,0 +1,88 @@
#
# spec file for package zip
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: zip
Version: 3.0
Release: 0
%define file_version 30
Summary: File compression program
License: BSD-3-Clause
Group: Productivity/Archiving/Compression
URL: https://github.com/distropatches/zip/commits/opensuse
Source: http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz
Patch2: zip-3.0-iso8859_2.patch
Patch3: zip-3.0-add_options_to_help.patch
Patch4: zip-3.0-nonexec-stack.patch
Patch5: zip-3.0-optflags.patch
Patch6: zip-3.0-tempfile.patch
Patch7: zip-notimestamp.patch
Patch8: zip-3.0-nomutilation.patch
# PATCH-FIX-UPSTREAM bsc#1068346 kstreitova@suse.com -- fix memory leaks
Patch9: zip-3.0-fix-memory_leaks.patch
Patch10: reproducible.patch
Patch11: zip-3.0-fix-doc.patch
Patch12: 0002-unix-reproducible-directory-order-scandir.patch
Provides: crzip = %{version}
Obsoletes: crzip < %{version}
BuildRequires: libbz2-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Zip is a compression and file packaging utility. It is compatible with
PKZIP(tm) 2.04g (Phil Katz ZIP) for MS-DOS systems.
%prep
%setup -q -n zip%{file_version}
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
# Remove FORTIFY_SOURCE=3 for bsc#1200712
EXTRA_CFLAGS="$(echo %{optflags} | sed -E 's/-[A-Z]?_FORTIFY_SOURCE[=]?[0-9]*//g') -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
make %{?_smp_mflags} -f unix/Makefile prefix=/usr CC="gcc $EXTRA_CFLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc
%install
mkdir -p %{buildroot}%{_prefix}/bin
mkdir -p %{buildroot}%{_mandir}/man1
make install -f unix/Makefile BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir}/man1
%check
sh -e ./test.sh
%files
%defattr(-,root,root)
%doc BUGS CHANGES INSTALL LICENSE README TODO WHATSNEW WHERE
%doc %{_mandir}/man1/zip.1.gz
%doc %{_mandir}/man1/zipcloak.1.gz
%doc %{_mandir}/man1/zipnote.1.gz
%doc %{_mandir}/man1/zipsplit.1.gz
%{_bindir}/zip
%{_bindir}/zipcloak
%{_bindir}/zipnote
%{_bindir}/zipsplit
%changelog

BIN
zip30.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.