unzip: Add patches from cygwin.
This commit is contained in:
parent
d1523d51cf
commit
a3ebfdc5b1
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
pkgname=unzip
|
pkgname=unzip
|
||||||
pkgver=6.0
|
pkgver=6.0
|
||||||
pkgrel=1
|
pkgrel=2
|
||||||
pkgdesc="Unpacks .zip archives such as those made by PKZIP"
|
pkgdesc="Unpacks .zip archives such as those made by PKZIP"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="http://www.info-zip.org/"
|
url="http://www.info-zip.org/"
|
||||||
@ -10,8 +10,37 @@ license=('custom')
|
|||||||
groups=('compression')
|
groups=('compression')
|
||||||
depends=('libbz2' 'bash')
|
depends=('libbz2' 'bash')
|
||||||
makedepends=('libbz2-devel')
|
makedepends=('libbz2-devel')
|
||||||
source=('http://downloads.sourceforge.net/infozip/unzip60.tar.gz')
|
source=('http://downloads.sourceforge.net/infozip/unzip60.tar.gz'
|
||||||
md5sums=('62b490407489521db863b523a7f86375')
|
unzip-6.0-attribs-overflow.patch
|
||||||
|
unzip-6.0-bzip2-configure.patch
|
||||||
|
unzip-6.0-caseinsensitive.patch
|
||||||
|
unzip-6.0-close.patch
|
||||||
|
unzip-6.0-fix-recmatch.patch
|
||||||
|
unzip-6.0-format-secure.patch
|
||||||
|
unzip-6.0-nostrip.patch
|
||||||
|
unzip-6.0-symlink.patch)
|
||||||
|
md5sums=('62b490407489521db863b523a7f86375'
|
||||||
|
'19341ef8810558e0cb4e3fe25b3eff70'
|
||||||
|
'f67c65f71335fa44a95604b143b5441c'
|
||||||
|
'3b7146de6a2bf218505df57f44c46194'
|
||||||
|
'b383c235084cef96f57e05e804c2ccef'
|
||||||
|
'42115ad210f80df74e66b3a872f73407'
|
||||||
|
'1f089d890c5a52b43128515163f04b8d'
|
||||||
|
'006596fa54bcc8952a8d0d4a3953c076'
|
||||||
|
'2612ba34fa7416be4c7e28899d401d40')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
cd ${srcdir}/${pkgname}${pkgver/./}
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-bzip2-configure.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-close.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-attribs-overflow.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-nostrip.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-fix-recmatch.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-symlink.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-caseinsensitive.patch
|
||||||
|
patch -p1 -i ${srcdir}/unzip-6.0-format-secure.patch
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd ${srcdir}/${pkgname}${pkgver/./}
|
cd ${srcdir}/${pkgname}${pkgver/./}
|
||||||
@ -25,16 +54,17 @@ build() {
|
|||||||
sed -i "/MANDIR =/s#)/#)/share/#" unix/Makefile
|
sed -i "/MANDIR =/s#)/#)/share/#" unix/Makefile
|
||||||
|
|
||||||
# make -- from Debian
|
# make -- from Debian
|
||||||
make -f unix/Makefile LOCAL_UNZIP="$CFLAGS" prefix=/usr LF2="" \
|
make \
|
||||||
CC=gcc LD=gcc AS=gcc \
|
-f unix/Makefile generic_gcc CC=gcc LD=gcc AS=gcc \
|
||||||
D_USE_BZ2=-DUSE_BZIP2 L_BZ2=-lbz2 E=".exe" CP="cp" LN="ln -s" unzips
|
CF_NOOPT="${CFLAGS} -DUNIX -I." \
|
||||||
|
E=".exe" CP="cp" LN="ln -s"
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd ${srcdir}/${pkgname}${pkgver/./}
|
cd ${srcdir}/${pkgname}${pkgver/./}
|
||||||
|
|
||||||
# install -- from Debian
|
# install -- from Debian
|
||||||
make -f unix/Makefile prefix=${pkgdir}/usr INSTALL_PROGRAM="install" install
|
make -f unix/Makefile prefix=${pkgdir}/usr LN="ln -s" MANDIR=${D}/usr/share/man/man1 INSTALL_PROGRAM="install" install
|
||||||
|
|
||||||
# install the license file
|
# install the license file
|
||||||
install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/unzip/LICENSE
|
install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/unzip/LICENSE
|
||||||
|
|||||||
12
unzip/unzip-6.0-attribs-overflow.patch
Normal file
12
unzip/unzip-6.0-attribs-overflow.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -up unzip60/zipinfo.c.attribs-overflow unzip60/zipinfo.c
|
||||||
|
--- unzip60/zipinfo.c.attribs-overflow 2009-11-30 09:55:39.000000000 +0100
|
||||||
|
+++ unzip60/zipinfo.c 2009-11-30 09:56:42.844263244 +0100
|
||||||
|
@@ -1881,7 +1881,7 @@ static int zi_short(__G) /* return PK-
|
||||||
|
#endif
|
||||||
|
int k, error, error_in_archive=PK_COOL;
|
||||||
|
unsigned hostnum, hostver, methid, methnum, xattr;
|
||||||
|
- char *p, workspace[12], attribs[16];
|
||||||
|
+ char *p, workspace[12], attribs[17];
|
||||||
|
char methbuf[5];
|
||||||
|
static ZCONST char dtype[5]="NXFS"; /* normal, maximum, fast, superfast */
|
||||||
|
static ZCONST char Far os[NUM_HOSTS+1][4] = {
|
||||||
30
unzip/unzip-6.0-bzip2-configure.patch
Normal file
30
unzip/unzip-6.0-bzip2-configure.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
diff -up unzip60/unix/configure.bzip2-configure unzip60/unix/configure
|
||||||
|
--- unzip60/unix/configure.bzip2-configure 2009-04-16 21:25:12.000000000 +0200
|
||||||
|
+++ unzip60/unix/configure 2009-11-18 11:22:14.598389194 +0100
|
||||||
|
@@ -640,7 +640,24 @@ else
|
||||||
|
D_USE_BZ2="-DUSE_BZIP2"
|
||||||
|
L_BZ2="${BZLF} -lbz2"
|
||||||
|
else
|
||||||
|
- echo "-- bzip2 sources not found - no bzip2 support"
|
||||||
|
+ echo " Check if OS already has bzip2 library installed"
|
||||||
|
+ cat > conftest.c << _EOF_
|
||||||
|
+#include "bzlib.h"
|
||||||
|
+int main()
|
||||||
|
+{
|
||||||
|
+ bz_stream strm;
|
||||||
|
+ BZ2_bzCompressEnd(&strm);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+_EOF_
|
||||||
|
+ $CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
|
||||||
|
+ if test $? -eq 0; then
|
||||||
|
+ echo "-- OS supports bzip2 - linking in bzip2"
|
||||||
|
+ D_USE_BZ2="-DUSE_BZIP2"
|
||||||
|
+ L_BZ2="${BZLF} -lbz2"
|
||||||
|
+ else
|
||||||
|
+ echo "-- Either bzlib.h or libbz2.a not found - no bzip2"
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
131
unzip/unzip-6.0-caseinsensitive.patch
Normal file
131
unzip/unzip-6.0-caseinsensitive.patch
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
diff --git a/match.c b/match.c
|
||||||
|
index 6cd656f..4e569f5 100644
|
||||||
|
--- a/match.c
|
||||||
|
+++ b/match.c
|
||||||
|
@@ -190,10 +190,10 @@ char *___tmp_ptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-static int recmatch(p, s, cs)
|
||||||
|
+static int recmatch(p, s, ci)
|
||||||
|
ZCONST char *p; /* sh pattern to match */
|
||||||
|
ZCONST char *s; /* string to match it to */
|
||||||
|
-int cs; /* flag: force case-sensitive matching */
|
||||||
|
+int ci; /* flag: force case-insensitive matching */
|
||||||
|
/* Recursively compare the sh pattern p with the string s and return 1 if
|
||||||
|
they match, and 0 or 2 if they don't or if there is a syntax error in the
|
||||||
|
pattern. This routine recurses on itself no deeper than the number of
|
||||||
|
@@ -214,7 +214,7 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
if (CLEN(p) == 2) {
|
||||||
|
if (CLEN(s) == 2) {
|
||||||
|
return (*p == *s && *(p+1) == *(s+1)) ?
|
||||||
|
- recmatch(p + 2, s + 2, cs) : 0;
|
||||||
|
+ recmatch(p + 2, s + 2, ci) : 0;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -230,9 +230,9 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
/* '?' (or '%' or '#') matches any character (but not an empty string) */
|
||||||
|
if (c == WILDCHR_SINGLE) {
|
||||||
|
if (wild_stop_at_dir)
|
||||||
|
- return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+ return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), ci) : 0;
|
||||||
|
else
|
||||||
|
- return *s ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+ return *s ? recmatch(p, s + CLEN(s), ci) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* WILDCHR_MULTI ('*') matches any number of characters, including zero */
|
||||||
|
@@ -253,14 +253,14 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
# endif /* ?AMIGA */
|
||||||
|
/* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
|
||||||
|
for (; *s && *s != DIRSEP_CHR; INCSTR(s))
|
||||||
|
- if ((c = recmatch(p, s, cs)) != 0)
|
||||||
|
+ if ((c = recmatch(p, s, ci)) != 0)
|
||||||
|
return c;
|
||||||
|
/* end of pattern: matched if at end of string, else continue */
|
||||||
|
if (*p == 0)
|
||||||
|
return (*s == 0);
|
||||||
|
/* continue to match if at DIRSEP_CHR in pattern, else give up */
|
||||||
|
return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
|
||||||
|
- ? recmatch(p, s, cs) : 2;
|
||||||
|
+ ? recmatch(p, s, ci) : 2;
|
||||||
|
}
|
||||||
|
/* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
|
||||||
|
p++; /* move p past the second WILDCHR_MULTI */
|
||||||
|
@@ -308,17 +308,17 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
*/
|
||||||
|
if (q != srest)
|
||||||
|
return 0;
|
||||||
|
- return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
|
||||||
|
+ return ((!ci ? strcmp(p, q) : namecmp(p, q)) == 0);
|
||||||
|
}
|
||||||
|
#else /* !_MBCS */
|
||||||
|
- return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
|
||||||
|
+ return ((!ci ? strcmp(p, srest) : namecmp(p, srest)) == 0);
|
||||||
|
#endif /* ?_MBCS */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* pattern contains more wildcards, continue with recursion... */
|
||||||
|
for (; *s; INCSTR(s))
|
||||||
|
- if ((c = recmatch(p, s, cs)) != 0)
|
||||||
|
+ if ((c = recmatch(p, s, ci)) != 0)
|
||||||
|
return c;
|
||||||
|
return 2; /* 2 means give up--shmatch will return false */
|
||||||
|
}
|
||||||
|
@@ -353,17 +353,17 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
c = *(p-1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- uch cc = (cs ? (uch)*s : case_map((uch)*s));
|
||||||
|
+ uch cc = (!ci ? (uch)*s : to_up((uch)*s));
|
||||||
|
uch uc = (uch) c;
|
||||||
|
if (*(p+1) != '-')
|
||||||
|
for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
|
||||||
|
/* compare range */
|
||||||
|
- if ((cs ? uc : case_map(uc)) == cc)
|
||||||
|
- return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
|
||||||
|
+ if ((!ci ? uc : to_up(uc)) == cc)
|
||||||
|
+ return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), ci);
|
||||||
|
c = e = 0; /* clear range, escape flags */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
|
||||||
|
+ return r ? recmatch(q + CLEN(q), s + CLEN(s), ci) : 0;
|
||||||
|
/* bracket match failed */
|
||||||
|
}
|
||||||
|
#endif /* !VMS */
|
||||||
|
@@ -382,18 +382,18 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
{
|
||||||
|
/* Match "...]" with "]". Continue after "]" in both. */
|
||||||
|
if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||||
|
- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||||
|
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
|
||||||
|
|
||||||
|
/* Else, look for a reduced match in s, until "]" in or end of s. */
|
||||||
|
for (; *s && (*s != ']'); INCSTR(s))
|
||||||
|
if (*s == '.')
|
||||||
|
/* If reduced match, then continue after "..." in p, "." in s. */
|
||||||
|
- if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
|
||||||
|
+ if ((c = recmatch( (p+ CLEN( p)), s, ci)) != 0)
|
||||||
|
return (int)c;
|
||||||
|
|
||||||
|
/* Match "...]" with "]". Continue after "]" in both. */
|
||||||
|
if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||||
|
- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||||
|
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
|
||||||
|
|
||||||
|
/* No reduced match. Quit. */
|
||||||
|
return 2;
|
||||||
|
@@ -402,8 +402,8 @@ int cs; /* flag: force case-sensitive matching */
|
||||||
|
#endif /* def VMS */
|
||||||
|
|
||||||
|
/* Just a character--compare it */
|
||||||
|
- return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
|
||||||
|
- recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+ return (!ci ? c == *s : to_up((uch)c) == to_up((uch)*s)) ?
|
||||||
|
+ recmatch(p, s + CLEN(s), ci) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
176
unzip/unzip-6.0-close.patch
Normal file
176
unzip/unzip-6.0-close.patch
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
diff -up unzip60/extract.c.close unzip60/extract.c
|
||||||
|
--- unzip60/extract.c.close 2009-03-14 02:32:52.000000000 +0100
|
||||||
|
+++ unzip60/extract.c 2009-11-19 08:17:23.481263496 +0100
|
||||||
|
@@ -1924,24 +1924,21 @@ static int extract_or_test_member(__G)
|
||||||
|
|
||||||
|
#ifdef VMS /* VMS: required even for stdout! (final flush) */
|
||||||
|
if (!uO.tflag) /* don't close NULL file */
|
||||||
|
- close_outfile(__G);
|
||||||
|
+ error = close_outfile(__G);
|
||||||
|
#else
|
||||||
|
#ifdef DLL
|
||||||
|
if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
|
||||||
|
if (G.redirect_data)
|
||||||
|
FINISH_REDIRECT();
|
||||||
|
else
|
||||||
|
- close_outfile(__G);
|
||||||
|
+ error = close_outfile(__G);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
|
||||||
|
- close_outfile(__G);
|
||||||
|
+ error = close_outfile(__G);
|
||||||
|
#endif
|
||||||
|
#endif /* VMS */
|
||||||
|
|
||||||
|
- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
|
||||||
|
-
|
||||||
|
-
|
||||||
|
if (G.disk_full) { /* set by flush() */
|
||||||
|
if (G.disk_full > 1) {
|
||||||
|
#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
|
||||||
|
diff -up unzip60/unix/unix.c.close unzip60/unix/unix.c
|
||||||
|
--- unzip60/unix/unix.c.close 2009-01-24 00:31:26.000000000 +0100
|
||||||
|
+++ unzip60/unix/unix.c 2009-11-19 08:33:25.568389171 +0100
|
||||||
|
@@ -1096,10 +1096,41 @@ static int get_extattribs(__G__ pzt, z_u
|
||||||
|
#ifndef MTS
|
||||||
|
|
||||||
|
/****************************/
|
||||||
|
+/* Function CloseError() */
|
||||||
|
+/***************************/
|
||||||
|
+
|
||||||
|
+int CloseError(__G)
|
||||||
|
+ __GDEF
|
||||||
|
+{
|
||||||
|
+ int errval = PK_OK;
|
||||||
|
+
|
||||||
|
+ if (fclose(G.outfile) < 0) {
|
||||||
|
+ switch (errno) {
|
||||||
|
+ case ENOSPC:
|
||||||
|
+ /* Do we need this on fileio.c? */
|
||||||
|
+ Info(slide, 0x4a1, ((char *)slide, "%s: write error (disk full?). Continue? (y/n/^C) ",
|
||||||
|
+ FnFilter1(G.filename)));
|
||||||
|
+ fgets(G.answerbuf, 9, stdin);
|
||||||
|
+ if (*G.answerbuf == 'y') /* stop writing to this file */
|
||||||
|
+ G.disk_full = 1; /* pass to next */
|
||||||
|
+ else
|
||||||
|
+ G.disk_full = 2; /* no: exit program */
|
||||||
|
+
|
||||||
|
+ errval = PK_DISK;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ errval = PK_WARN;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return errval;
|
||||||
|
+} /* End of CloseError() */
|
||||||
|
+
|
||||||
|
+/****************************/
|
||||||
|
/* Function close_outfile() */
|
||||||
|
/****************************/
|
||||||
|
|
||||||
|
-void close_outfile(__G) /* GRR: change to return PK-style warning level */
|
||||||
|
+int close_outfile(__G)
|
||||||
|
__GDEF
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
@@ -1108,6 +1139,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
} zt;
|
||||||
|
ulg z_uidgid[2];
|
||||||
|
int have_uidgid_flg;
|
||||||
|
+ int errval = PK_OK;
|
||||||
|
|
||||||
|
have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
|
||||||
|
|
||||||
|
@@ -1141,16 +1173,16 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
Info(slide, 0x201, ((char *)slide,
|
||||||
|
"warning: symbolic link (%s) failed: mem alloc overflow\n",
|
||||||
|
FnFilter1(G.filename)));
|
||||||
|
- fclose(G.outfile);
|
||||||
|
- return;
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
+ return errval ? errval : PK_WARN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
|
||||||
|
Info(slide, 0x201, ((char *)slide,
|
||||||
|
"warning: symbolic link (%s) failed: no mem\n",
|
||||||
|
FnFilter1(G.filename)));
|
||||||
|
- fclose(G.outfile);
|
||||||
|
- return;
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
+ return errval ? errval : PK_WARN;
|
||||||
|
}
|
||||||
|
slnk_entry->next = NULL;
|
||||||
|
slnk_entry->targetlen = ucsize;
|
||||||
|
@@ -1174,10 +1206,10 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
"warning: symbolic link (%s) failed\n",
|
||||||
|
FnFilter1(G.filename)));
|
||||||
|
free(slnk_entry);
|
||||||
|
- fclose(G.outfile);
|
||||||
|
- return;
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
+ return errval ? errval : PK_WARN;
|
||||||
|
}
|
||||||
|
- fclose(G.outfile); /* close "link" file for good... */
|
||||||
|
+ errval = CloseError(G.outfile, G.filename); /* close "link" file for good... */
|
||||||
|
slnk_entry->target[ucsize] = '\0';
|
||||||
|
if (QCOND2)
|
||||||
|
Info(slide, 0, ((char *)slide, "-> %s ",
|
||||||
|
@@ -1188,7 +1220,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
else
|
||||||
|
G.slink_head = slnk_entry;
|
||||||
|
G.slink_last = slnk_entry;
|
||||||
|
- return;
|
||||||
|
+ return errval;
|
||||||
|
}
|
||||||
|
#endif /* SYMLINKS */
|
||||||
|
|
||||||
|
@@ -1201,7 +1233,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(NO_FCHOWN))
|
||||||
|
- fclose(G.outfile);
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* if -X option was specified and we have UID/GID info, restore it */
|
||||||
|
@@ -1227,7 +1259,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
|
||||||
|
- fclose(G.outfile);
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
|
||||||
|
@@ -1239,7 +1271,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
|
||||||
|
perror("fchmod (file attributes) error");
|
||||||
|
|
||||||
|
- fclose(G.outfile);
|
||||||
|
+ errval = CloseError(G.outfile, G.filename);
|
||||||
|
#endif /* !NO_FCHOWN && !NO_FCHMOD */
|
||||||
|
|
||||||
|
/* skip restoring time stamps on user's request */
|
||||||
|
@@ -1267,6 +1299,7 @@ void close_outfile(__G) /* GRR: chang
|
||||||
|
#endif
|
||||||
|
#endif /* NO_FCHOWN || NO_FCHMOD */
|
||||||
|
|
||||||
|
+ return errval;
|
||||||
|
} /* end function close_outfile() */
|
||||||
|
|
||||||
|
#endif /* !MTS */
|
||||||
|
diff -up unzip60/unzpriv.h.close unzip60/unzpriv.h
|
||||||
|
--- unzip60/unzpriv.h.close 2009-04-20 01:59:26.000000000 +0200
|
||||||
|
+++ unzip60/unzpriv.h 2009-11-19 08:19:08.610388618 +0100
|
||||||
|
@@ -2604,7 +2604,7 @@ char *GetLoadPath OF((__GPRO));
|
||||||
|
int SetFileSize OF((FILE *file, zusz_t filesize)); /* local */
|
||||||
|
#endif
|
||||||
|
#ifndef MTS /* macro in MTS */
|
||||||
|
- void close_outfile OF((__GPRO)); /* local */
|
||||||
|
+ int close_outfile OF((__GPRO)); /* local */
|
||||||
|
#endif
|
||||||
|
#ifdef SET_SYMLINK_ATTRIBS
|
||||||
|
int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */
|
||||||
477
unzip/unzip-6.0-fix-recmatch.patch
Normal file
477
unzip/unzip-6.0-fix-recmatch.patch
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
diff -up unzip60/match.c.recmatch unzip60/match.c
|
||||||
|
--- unzip60/match.c.recmatch 2005-08-14 13:00:36.000000000 -0400
|
||||||
|
+++ unzip60/match.c 2013-05-28 10:29:57.949077543 -0400
|
||||||
|
@@ -27,16 +27,14 @@
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Copyright on recmatch() from Zip's util.c (although recmatch() was almost
|
||||||
|
- certainly written by Mark Adler...ask me how I can tell :-) ):
|
||||||
|
+ Copyright on recmatch() from Zip's util.c
|
||||||
|
+ Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||||
|
|
||||||
|
- Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
|
||||||
|
- Kai Uwe Rommel and Igor Mandrichenko.
|
||||||
|
+ See the accompanying file LICENSE, version 2004-May-22 or later
|
||||||
|
+ for terms of use.
|
||||||
|
+ If, for some reason, both of these files are missing, the Info-ZIP license
|
||||||
|
+ also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||||
|
|
||||||
|
- Permission is granted to any individual or institution to use, copy,
|
||||||
|
- or redistribute this software so long as all of the original files are
|
||||||
|
- included unmodified, that it is not sold for profit, and that this copy-
|
||||||
|
- right notice is retained.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -53,7 +51,7 @@
|
||||||
|
|
||||||
|
A set is composed of characters or ranges; a range looks like ``character
|
||||||
|
hyphen character'' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of
|
||||||
|
- characters allowed in the [..] pattern construct. Other characters are
|
||||||
|
+ characters ALlowed in the [..] pattern construct. Other characters are
|
||||||
|
allowed (i.e., 8-bit characters) if your system will support them.
|
||||||
|
|
||||||
|
To suppress the special syntactic significance of any of ``[]*?!^-\'', in-
|
||||||
|
@@ -101,8 +99,32 @@
|
||||||
|
# define WILDCHAR '?'
|
||||||
|
# define BEG_RANGE '['
|
||||||
|
# define END_RANGE ']'
|
||||||
|
+# define WILDCHR_SINGLE '?'
|
||||||
|
+# define DIRSEP_CHR '/'
|
||||||
|
+# define WILDCHR_MULTI '*'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifdef WILD_STOP_AT_DIR
|
||||||
|
+ int wild_stop_at_dir = 1; /* default wildcards do not include / in matches */
|
||||||
|
+#else
|
||||||
|
+ int wild_stop_at_dir = 0; /* default wildcards do include / in matches */
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * case mapping functions. case_map is used to ignore case in comparisons,
|
||||||
|
+ * to_up is used to force upper case even on Unix (for dosify option).
|
||||||
|
+ */
|
||||||
|
+#ifdef USE_CASE_MAP
|
||||||
|
+# define case_map(c) upper[(c) & 0xff]
|
||||||
|
+# define to_up(c) upper[(c) & 0xff]
|
||||||
|
+#else
|
||||||
|
+# define case_map(c) (c)
|
||||||
|
+# define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
|
||||||
|
+#endif /* USE_CASE_MAP */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
#if 0 /* GRR: add this to unzip.h someday... */
|
||||||
|
#if !(defined(MSDOS) && defined(DOSWILD))
|
||||||
|
#ifdef WILD_STOP_AT_DIR
|
||||||
|
@@ -114,8 +136,8 @@ int recmatch OF((ZCONST uch *pattern, ZC
|
||||||
|
int ignore_case __WDLPRO));
|
||||||
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
|
-static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string,
|
||||||
|
- int ignore_case __WDLPRO));
|
||||||
|
+static int recmatch OF((ZCONST char *, ZCONST char *,
|
||||||
|
+ int));
|
||||||
|
static char *isshexp OF((ZCONST char *p));
|
||||||
|
static int namecmp OF((ZCONST char *s1, ZCONST char *s2));
|
||||||
|
|
||||||
|
@@ -154,192 +176,240 @@ int match(string, pattern, ignore_case _
|
||||||
|
}
|
||||||
|
dospattern[j-1] = '\0'; /* nuke the end "." */
|
||||||
|
}
|
||||||
|
- j = recmatch((uch *)dospattern, (uch *)string, ignore_case __WDL);
|
||||||
|
+ j = recmatch(dospattern, string, ignore_case);
|
||||||
|
free(dospattern);
|
||||||
|
return j == 1;
|
||||||
|
} else
|
||||||
|
#endif /* MSDOS && DOSWILD */
|
||||||
|
- return recmatch((uch *)pattern, (uch *)string, ignore_case __WDL) == 1;
|
||||||
|
+ return recmatch(pattern, string, ignore_case) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef _MBCS
|
||||||
|
+
|
||||||
|
+char *___tmp_ptr;
|
||||||
|
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
-static int recmatch(p, s, ic __WDL)
|
||||||
|
- ZCONST uch *p; /* sh pattern to match */
|
||||||
|
- ZCONST uch *s; /* string to which to match it */
|
||||||
|
- int ic; /* true for case insensitivity */
|
||||||
|
- __WDLDEF /* directory sepchar for WildStopAtDir mode, or 0 */
|
||||||
|
+static int recmatch(p, s, cs)
|
||||||
|
+ZCONST char *p; /* sh pattern to match */
|
||||||
|
+ZCONST char *s; /* string to match it to */
|
||||||
|
+int cs; /* flag: force case-sensitive matching */
|
||||||
|
/* Recursively compare the sh pattern p with the string s and return 1 if
|
||||||
|
- * they match, and 0 or 2 if they don't or if there is a syntax error in the
|
||||||
|
- * pattern. This routine recurses on itself no more deeply than the number
|
||||||
|
- * of characters in the pattern. */
|
||||||
|
+ they match, and 0 or 2 if they don't or if there is a syntax error in the
|
||||||
|
+ pattern. This routine recurses on itself no deeper than the number of
|
||||||
|
+ characters in the pattern. */
|
||||||
|
{
|
||||||
|
- unsigned int c; /* pattern char or start of range in [-] loop */
|
||||||
|
+ int c; /* pattern char or start of range in [-] loop */
|
||||||
|
+ /* Get first character, the pattern for new recmatch calls follows */
|
||||||
|
+ /* borrowed from Zip's global.c */
|
||||||
|
+ int no_wild = 0;
|
||||||
|
+ int allow_regex=1;
|
||||||
|
+ /* This fix provided by akt@m5.dion.ne.jp for Japanese.
|
||||||
|
+ See 21 July 2006 mail.
|
||||||
|
+ It only applies when p is pointing to a doublebyte character and
|
||||||
|
+ things like / and wildcards are not doublebyte. This probably
|
||||||
|
+ should not be needed. */
|
||||||
|
|
||||||
|
- /* Get first character, the pattern for new recmatch calls follows */
|
||||||
|
- c = *p; INCSTR(p);
|
||||||
|
+#ifdef _MBCS
|
||||||
|
+ if (CLEN(p) == 2) {
|
||||||
|
+ if (CLEN(s) == 2) {
|
||||||
|
+ return (*p == *s && *(p+1) == *(s+1)) ?
|
||||||
|
+ recmatch(p + 2, s + 2, cs) : 0;
|
||||||
|
+ } else {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif /* ?_MBCS */
|
||||||
|
|
||||||
|
- /* If that was the end of the pattern, match if string empty too */
|
||||||
|
- if (c == 0)
|
||||||
|
- return *s == 0;
|
||||||
|
+ c = *POSTINCSTR(p);
|
||||||
|
|
||||||
|
- /* '?' (or '%') matches any character (but not an empty string). */
|
||||||
|
- if (c == WILDCHAR)
|
||||||
|
-#ifdef WILD_STOP_AT_DIR
|
||||||
|
- /* If uO.W_flag is non-zero, it won't match '/' */
|
||||||
|
- return (*s && (!sepc || *s != (uch)sepc))
|
||||||
|
- ? recmatch(p, s + CLEN(s), ic, sepc) : 0;
|
||||||
|
-#else
|
||||||
|
- return *s ? recmatch(p, s + CLEN(s), ic) : 0;
|
||||||
|
-#endif
|
||||||
|
+ /* If that was the end of the pattern, match if string empty too */
|
||||||
|
+ if (c == 0)
|
||||||
|
+ return *s == 0;
|
||||||
|
+
|
||||||
|
+ /* '?' (or '%' or '#') matches any character (but not an empty string) */
|
||||||
|
+ if (c == WILDCHR_SINGLE) {
|
||||||
|
+ if (wild_stop_at_dir)
|
||||||
|
+ return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+ else
|
||||||
|
+ return *s ? recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- /* '*' matches any number of characters, including zero */
|
||||||
|
+ /* WILDCHR_MULTI ('*') matches any number of characters, including zero */
|
||||||
|
#ifdef AMIGA
|
||||||
|
- if (c == '#' && *p == '?') /* "#?" is Amiga-ese for "*" */
|
||||||
|
- c = '*', p++;
|
||||||
|
+ if (!no_wild && c == '#' && *p == '?') /* "#?" is Amiga-ese for "*" */
|
||||||
|
+ c = WILDCHR_MULTI, p++;
|
||||||
|
#endif /* AMIGA */
|
||||||
|
- if (c == '*') {
|
||||||
|
-#ifdef WILD_STOP_AT_DIR
|
||||||
|
- if (sepc) {
|
||||||
|
- /* check for single "*" or double "**" */
|
||||||
|
-# ifdef AMIGA
|
||||||
|
- if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
|
||||||
|
- c = '*', p++;
|
||||||
|
- if (c != '*') {
|
||||||
|
-# else /* !AMIGA */
|
||||||
|
- if (*p != '*') {
|
||||||
|
-# endif /* ?AMIGA */
|
||||||
|
- /* single "*": this doesn't match the dirsep character */
|
||||||
|
- for (; *s && *s != (uch)sepc; INCSTR(s))
|
||||||
|
- if ((c = recmatch(p, s, ic, sepc)) != 0)
|
||||||
|
- return (int)c;
|
||||||
|
- /* end of pattern: matched if at end of string, else continue */
|
||||||
|
- if (*p == '\0')
|
||||||
|
- return (*s == 0);
|
||||||
|
- /* continue to match if at sepc in pattern, else give up */
|
||||||
|
- return (*p == (uch)sepc || (*p == '\\' && p[1] == (uch)sepc))
|
||||||
|
- ? recmatch(p, s, ic, sepc) : 2;
|
||||||
|
- }
|
||||||
|
- /* "**": this matches slashes */
|
||||||
|
- ++p; /* move p behind the second '*' */
|
||||||
|
- /* and continue with the non-W_flag code variant */
|
||||||
|
- }
|
||||||
|
-#endif /* WILD_STOP_AT_DIR */
|
||||||
|
+ if (!no_wild && c == WILDCHR_MULTI)
|
||||||
|
+ {
|
||||||
|
+ if (wild_stop_at_dir) {
|
||||||
|
+ /* Check for an immediately following WILDCHR_MULTI */
|
||||||
|
+# ifdef AMIGA
|
||||||
|
+ if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
|
||||||
|
+ c = WILDCHR_MULTI, p++;
|
||||||
|
+ if (c != WILDCHR_MULTI) {
|
||||||
|
+# else /* !AMIGA */
|
||||||
|
+ if (*p != WILDCHR_MULTI) {
|
||||||
|
+# endif /* ?AMIGA */
|
||||||
|
+ /* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
|
||||||
|
+ for (; *s && *s != DIRSEP_CHR; INCSTR(s))
|
||||||
|
+ if ((c = recmatch(p, s, cs)) != 0)
|
||||||
|
+ return c;
|
||||||
|
+ /* end of pattern: matched if at end of string, else continue */
|
||||||
|
if (*p == 0)
|
||||||
|
- return 1;
|
||||||
|
- if (isshexp((ZCONST char *)p) == NULL) {
|
||||||
|
- /* Optimization for rest of pattern being a literal string:
|
||||||
|
- * If there are no other shell expression chars in the rest
|
||||||
|
- * of the pattern behind the multi-char wildcard, then just
|
||||||
|
- * compare the literal string tail.
|
||||||
|
- */
|
||||||
|
- ZCONST uch *srest;
|
||||||
|
-
|
||||||
|
- srest = s + (strlen((ZCONST char *)s) - strlen((ZCONST char *)p));
|
||||||
|
- if (srest - s < 0)
|
||||||
|
- /* remaining literal string from pattern is longer than rest
|
||||||
|
- * of test string, there can't be a match
|
||||||
|
- */
|
||||||
|
- return 0;
|
||||||
|
- else
|
||||||
|
- /* compare the remaining literal pattern string with the last
|
||||||
|
- * bytes of the test string to check for a match
|
||||||
|
- */
|
||||||
|
+ return (*s == 0);
|
||||||
|
+ /* continue to match if at DIRSEP_CHR in pattern, else give up */
|
||||||
|
+ return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
|
||||||
|
+ ? recmatch(p, s, cs) : 2;
|
||||||
|
+ }
|
||||||
|
+ /* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
|
||||||
|
+ p++; /* move p past the second WILDCHR_MULTI */
|
||||||
|
+ /* continue with the normal non-WILD_STOP_AT_DIR code */
|
||||||
|
+ } /* wild_stop_at_dir */
|
||||||
|
+
|
||||||
|
+ /* Not wild_stop_at_dir */
|
||||||
|
+ if (*p == 0)
|
||||||
|
+ return 1;
|
||||||
|
+ if (!isshexp((char *)p))
|
||||||
|
+ {
|
||||||
|
+ /* optimization for rest of pattern being a literal string */
|
||||||
|
+
|
||||||
|
+ /* optimization to handle patterns like *.txt */
|
||||||
|
+ /* if the first char in the pattern is '*' and there */
|
||||||
|
+ /* are no other shell expression chars, i.e. a literal string */
|
||||||
|
+ /* then just compare the literal string at the end */
|
||||||
|
+
|
||||||
|
+ ZCONST char *srest;
|
||||||
|
+
|
||||||
|
+ srest = s + (strlen(s) - strlen(p));
|
||||||
|
+ if (srest - s < 0)
|
||||||
|
+ /* remaining literal string from pattern is longer than rest of
|
||||||
|
+ test string, there can't be a match
|
||||||
|
+ */
|
||||||
|
+ return 0;
|
||||||
|
+ else
|
||||||
|
+ /* compare the remaining literal pattern string with the last bytes
|
||||||
|
+ of the test string to check for a match */
|
||||||
|
#ifdef _MBCS
|
||||||
|
- {
|
||||||
|
- ZCONST uch *q = s;
|
||||||
|
+ {
|
||||||
|
+ ZCONST char *q = s;
|
||||||
|
|
||||||
|
- /* MBCS-aware code must not scan backwards into a string from
|
||||||
|
- * the end.
|
||||||
|
- * So, we have to move forward by character from our well-known
|
||||||
|
- * character position s in the test string until we have
|
||||||
|
- * advanced to the srest position.
|
||||||
|
- */
|
||||||
|
- while (q < srest)
|
||||||
|
- INCSTR(q);
|
||||||
|
- /* In case the byte *srest is a trailing byte of a multibyte
|
||||||
|
- * character in the test string s, we have actually advanced
|
||||||
|
- * past the position (srest).
|
||||||
|
- * For this case, the match has failed!
|
||||||
|
- */
|
||||||
|
- if (q != srest)
|
||||||
|
- return 0;
|
||||||
|
- return ((ic
|
||||||
|
- ? namecmp((ZCONST char *)p, (ZCONST char *)q)
|
||||||
|
- : strcmp((ZCONST char *)p, (ZCONST char *)q)
|
||||||
|
- ) == 0);
|
||||||
|
- }
|
||||||
|
+ /* MBCS-aware code must not scan backwards into a string from
|
||||||
|
+ * the end.
|
||||||
|
+ * So, we have to move forward by character from our well-known
|
||||||
|
+ * character position s in the test string until we have advanced
|
||||||
|
+ * to the srest position.
|
||||||
|
+ */
|
||||||
|
+ while (q < srest)
|
||||||
|
+ INCSTR(q);
|
||||||
|
+ /* In case the byte *srest is a trailing byte of a multibyte
|
||||||
|
+ * character, we have actually advanced past the position (srest).
|
||||||
|
+ * For this case, the match has failed!
|
||||||
|
+ */
|
||||||
|
+ if (q != srest)
|
||||||
|
+ return 0;
|
||||||
|
+ return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
|
||||||
|
+ }
|
||||||
|
#else /* !_MBCS */
|
||||||
|
- return ((ic
|
||||||
|
- ? namecmp((ZCONST char *)p, (ZCONST char *)srest)
|
||||||
|
- : strcmp((ZCONST char *)p, (ZCONST char *)srest)
|
||||||
|
- ) == 0);
|
||||||
|
+ return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
|
||||||
|
#endif /* ?_MBCS */
|
||||||
|
- } else {
|
||||||
|
- /* pattern contains more wildcards, continue with recursion... */
|
||||||
|
- for (; *s; INCSTR(s))
|
||||||
|
- if ((c = recmatch(p, s, ic __WDL)) != 0)
|
||||||
|
- return (int)c;
|
||||||
|
- return 2; /* 2 means give up--match will return false */
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- /* Parse and process the list of characters and ranges in brackets */
|
||||||
|
- if (c == BEG_RANGE) {
|
||||||
|
- int e; /* flag true if next char to be taken literally */
|
||||||
|
- ZCONST uch *q; /* pointer to end of [-] group */
|
||||||
|
- int r; /* flag true to match anything but the range */
|
||||||
|
-
|
||||||
|
- if (*s == 0) /* need a character to match */
|
||||||
|
- return 0;
|
||||||
|
- p += (r = (*p == '!' || *p == '^')); /* see if reverse */
|
||||||
|
- for (q = p, e = 0; *q; INCSTR(q)) /* find closing bracket */
|
||||||
|
- if (e)
|
||||||
|
- e = 0;
|
||||||
|
- else
|
||||||
|
- if (*q == '\\') /* GRR: change to ^ for MS-DOS, OS/2? */
|
||||||
|
- e = 1;
|
||||||
|
- else if (*q == END_RANGE)
|
||||||
|
- break;
|
||||||
|
- if (*q != END_RANGE) /* nothing matches if bad syntax */
|
||||||
|
- return 0;
|
||||||
|
- for (c = 0, e = (*p == '-'); p < q; INCSTR(p)) {
|
||||||
|
- /* go through the list */
|
||||||
|
- if (!e && *p == '\\') /* set escape flag if \ */
|
||||||
|
- e = 1;
|
||||||
|
- else if (!e && *p == '-') /* set start of range if - */
|
||||||
|
- c = *(p-1);
|
||||||
|
- else {
|
||||||
|
- unsigned int cc = Case(*s);
|
||||||
|
-
|
||||||
|
- if (*(p+1) != '-')
|
||||||
|
- for (c = c ? c : *p; c <= *p; c++) /* compare range */
|
||||||
|
- if ((unsigned)Case(c) == cc) /* typecast for MSC bug */
|
||||||
|
- return r ? 0 : recmatch(q + 1, s + 1, ic __WDL);
|
||||||
|
- c = e = 0; /* clear range, escape flags */
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- return r ? recmatch(q + CLEN(q), s + CLEN(s), ic __WDL) : 0;
|
||||||
|
- /* bracket match failed */
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* pattern contains more wildcards, continue with recursion... */
|
||||||
|
+ for (; *s; INCSTR(s))
|
||||||
|
+ if ((c = recmatch(p, s, cs)) != 0)
|
||||||
|
+ return c;
|
||||||
|
+ return 2; /* 2 means give up--shmatch will return false */
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- /* if escape ('\\'), just compare next character */
|
||||||
|
- if (c == '\\' && (c = *p++) == 0) /* if \ at end, then syntax error */
|
||||||
|
- return 0;
|
||||||
|
+#ifndef VMS /* No bracket matching in VMS */
|
||||||
|
+ /* Parse and process the list of characters and ranges in brackets */
|
||||||
|
+ if (!no_wild && allow_regex && c == '[')
|
||||||
|
+ {
|
||||||
|
+ int e; /* flag true if next char to be taken literally */
|
||||||
|
+ ZCONST char *q; /* pointer to end of [-] group */
|
||||||
|
+ int r; /* flag true to match anything but the range */
|
||||||
|
+
|
||||||
|
+ if (*s == 0) /* need a character to match */
|
||||||
|
+ return 0;
|
||||||
|
+ p += (r = (*p == '!' || *p == '^')); /* see if reverse */
|
||||||
|
+ for (q = p, e = 0; *q; q++) /* find closing bracket */
|
||||||
|
+ if (e)
|
||||||
|
+ e = 0;
|
||||||
|
+ else
|
||||||
|
+ if (*q == '\\')
|
||||||
|
+ e = 1;
|
||||||
|
+ else if (*q == ']')
|
||||||
|
+ break;
|
||||||
|
+ if (*q != ']') /* nothing matches if bad syntax */
|
||||||
|
+ return 0;
|
||||||
|
+ for (c = 0, e = *p == '-'; p < q; p++) /* go through the list */
|
||||||
|
+ {
|
||||||
|
+ if (e == 0 && *p == '\\') /* set escape flag if \ */
|
||||||
|
+ e = 1;
|
||||||
|
+ else if (e == 0 && *p == '-') /* set start of range if - */
|
||||||
|
+ c = *(p-1);
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ uch cc = (cs ? (uch)*s : case_map((uch)*s));
|
||||||
|
+ uch uc = (uch) c;
|
||||||
|
+ if (*(p+1) != '-')
|
||||||
|
+ for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
|
||||||
|
+ /* compare range */
|
||||||
|
+ if ((cs ? uc : case_map(uc)) == cc)
|
||||||
|
+ return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
|
||||||
|
+ c = e = 0; /* clear range, escape flags */
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
|
||||||
|
+ /* bracket match failed */
|
||||||
|
+ }
|
||||||
|
+#endif /* !VMS */
|
||||||
|
|
||||||
|
- /* just a character--compare it */
|
||||||
|
-#ifdef QDOS
|
||||||
|
- return QMatch(Case((uch)c), Case(*s)) ?
|
||||||
|
- recmatch(p, s + CLEN(s), ic __WDL) : 0;
|
||||||
|
-#else
|
||||||
|
- return Case((uch)c) == Case(*s) ?
|
||||||
|
- recmatch(p, s + CLEN(s), ic __WDL) : 0;
|
||||||
|
-#endif
|
||||||
|
+ /* If escape ('\'), just compare next character */
|
||||||
|
+ if (!no_wild && c == '\\')
|
||||||
|
+ if ((c = *p++) == '\0') /* if \ at end, then syntax error */
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+#ifdef VMS
|
||||||
|
+ /* 2005-11-06 SMS.
|
||||||
|
+ Handle "..." wildcard in p with "." or "]" in s.
|
||||||
|
+ */
|
||||||
|
+ if ((c == '.') && (*p == '.') && (*(p+ CLEN( p)) == '.') &&
|
||||||
|
+ ((*s == '.') || (*s == ']')))
|
||||||
|
+ {
|
||||||
|
+ /* Match "...]" with "]". Continue after "]" in both. */
|
||||||
|
+ if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||||
|
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||||
|
+
|
||||||
|
+ /* Else, look for a reduced match in s, until "]" in or end of s. */
|
||||||
|
+ for (; *s && (*s != ']'); INCSTR(s))
|
||||||
|
+ if (*s == '.')
|
||||||
|
+ /* If reduced match, then continue after "..." in p, "." in s. */
|
||||||
|
+ if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
|
||||||
|
+ return (int)c;
|
||||||
|
+
|
||||||
|
+ /* Match "...]" with "]". Continue after "]" in both. */
|
||||||
|
+ if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
|
||||||
|
+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
|
||||||
|
+
|
||||||
|
+ /* No reduced match. Quit. */
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#endif /* def VMS */
|
||||||
|
+
|
||||||
|
+ /* Just a character--compare it */
|
||||||
|
+ return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
|
||||||
|
+ recmatch(p, s + CLEN(s), cs) : 0;
|
||||||
|
+}
|
||||||
|
|
||||||
|
-} /* end function recmatch() */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+/*************************************************************************************************/
|
||||||
|
static char *isshexp(p)
|
||||||
|
ZCONST char *p;
|
||||||
|
/* If p is a sh expression, a pointer to the first special character is
|
||||||
90
unzip/unzip-6.0-format-secure.patch
Normal file
90
unzip/unzip-6.0-format-secure.patch
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
diff --git a/extract.c b/extract.c
|
||||||
|
index eeb2f57..a0a4929 100644
|
||||||
|
--- a/extract.c
|
||||||
|
+++ b/extract.c
|
||||||
|
@@ -472,8 +472,8 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||||
|
*/
|
||||||
|
Info(slide, 0x401, ((char *)slide,
|
||||||
|
LoadFarString(CentSigMsg), j + blknum*DIR_BLKSIZ + 1));
|
||||||
|
- Info(slide, 0x401, ((char *)slide,
|
||||||
|
- LoadFarString(ReportMsg)));
|
||||||
|
+ Info(slide, 0x401,
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(ReportMsg)));
|
||||||
|
error_in_archive = PK_BADERR;
|
||||||
|
}
|
||||||
|
reached_end = TRUE; /* ...so no more left to do */
|
||||||
|
@@ -752,8 +752,8 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||||
|
|
||||||
|
#ifndef SFX
|
||||||
|
if (no_endsig_found) { /* just to make sure */
|
||||||
|
- Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
|
||||||
|
- Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg)));
|
||||||
|
+ Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(EndSigMsg)));
|
||||||
|
+ Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(ReportMsg)));
|
||||||
|
if (!error_in_archive) /* don't overwrite stronger error */
|
||||||
|
error_in_archive = PK_WARN;
|
||||||
|
}
|
||||||
|
diff --git a/list.c b/list.c
|
||||||
|
index 15e0011..f7359c3 100644
|
||||||
|
--- a/list.c
|
||||||
|
+++ b/list.c
|
||||||
|
@@ -181,7 +181,7 @@ int list_files(__G) /* return PK-type error code */
|
||||||
|
Info(slide, 0x401,
|
||||||
|
((char *)slide, LoadFarString(CentSigMsg), j));
|
||||||
|
Info(slide, 0x401,
|
||||||
|
- ((char *)slide, LoadFarString(ReportMsg)));
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(ReportMsg)));
|
||||||
|
return PK_BADERR; /* sig not found */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -507,7 +507,8 @@ int list_files(__G) /* return PK-type error code */
|
||||||
|
&& (!G.ecrec.is_zip64_archive)
|
||||||
|
&& (memcmp(G.sig, end_central_sig, 4) != 0)
|
||||||
|
) { /* just to make sure again */
|
||||||
|
- Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
|
||||||
|
+ Info(slide, 0x401,
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(EndSigMsg)));
|
||||||
|
error_in_archive = PK_WARN; /* didn't find sig */
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -591,7 +592,7 @@ int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */
|
||||||
|
Info(slide, 0x401,
|
||||||
|
((char *)slide, LoadFarString(CentSigMsg), j));
|
||||||
|
Info(slide, 0x401,
|
||||||
|
- ((char *)slide, LoadFarString(ReportMsg)));
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(ReportMsg)));
|
||||||
|
return PK_BADERR; /* sig not found */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -674,7 +675,7 @@ int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */
|
||||||
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
if (memcmp(G.sig, end_central_sig, 4)) { /* just to make sure again */
|
||||||
|
- Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
|
||||||
|
+ Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(EndSigMsg)));
|
||||||
|
error_in_archive = PK_WARN;
|
||||||
|
}
|
||||||
|
if (*nmember == 0L && error_in_archive <= PK_WARN)
|
||||||
|
diff --git a/zipinfo.c b/zipinfo.c
|
||||||
|
index 6e22cc8..ac5c61b 100644
|
||||||
|
--- a/zipinfo.c
|
||||||
|
+++ b/zipinfo.c
|
||||||
|
@@ -771,7 +771,7 @@ int zipinfo(__G) /* return PK-type error code */
|
||||||
|
Info(slide, 0x401,
|
||||||
|
((char *)slide, LoadFarString(CentSigMsg), j));
|
||||||
|
Info(slide, 0x401,
|
||||||
|
- ((char *)slide, LoadFarString(ReportMsg)));
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(ReportMsg)));
|
||||||
|
error_in_archive = PK_BADERR; /* sig not found */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -960,7 +960,8 @@ int zipinfo(__G) /* return PK-type error code */
|
||||||
|
&& (!G.ecrec.is_zip64_archive)
|
||||||
|
&& (memcmp(G.sig, end_central_sig, 4) != 0)
|
||||||
|
) { /* just to make sure again */
|
||||||
|
- Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
|
||||||
|
+ Info(slide, 0x401,
|
||||||
|
+ ((char *)slide,"%s", LoadFarString(EndSigMsg)));
|
||||||
|
error_in_archive = PK_WARN; /* didn't find sig */
|
||||||
|
}
|
||||||
|
|
||||||
12
unzip/unzip-6.0-nostrip.patch
Normal file
12
unzip/unzip-6.0-nostrip.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -up unzip60/unix/configure.nostrip unzip60/unix/configure
|
||||||
|
--- unzip60/unix/configure.nostrip 2009-11-30 10:18:09.000000000 +0100
|
||||||
|
+++ unzip60/unix/configure 2009-11-30 10:21:08.354264213 +0100
|
||||||
|
@@ -17,7 +17,7 @@ CFLAGSR=${CFLAGS}
|
||||||
|
IZ_BZIP2=${3}
|
||||||
|
CFLAGS="${CFLAGS} -I. -DUNIX"
|
||||||
|
LFLAGS1=""
|
||||||
|
-LFLAGS2="-s"
|
||||||
|
+LFLAGS2=""
|
||||||
|
LN="ln -s"
|
||||||
|
|
||||||
|
CFLAGS_OPT=''
|
||||||
17
unzip/unzip-6.0-symlink.patch
Normal file
17
unzip/unzip-6.0-symlink.patch
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
diff --git a/process.c b/process.c
|
||||||
|
index 1e9a1e1..905732b 100644
|
||||||
|
--- a/process.c
|
||||||
|
+++ b/process.c
|
||||||
|
@@ -1751,6 +1751,12 @@ int process_cdir_file_hdr(__G) /* return PK-type error code */
|
||||||
|
= (G.crec.general_purpose_bit_flag & (1 << 11)) == (1 << 11);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifdef SYMLINKS
|
||||||
|
+ /* Initialize the symlink flag, may be set by the platform-specific
|
||||||
|
+ mapattr function. */
|
||||||
|
+ G.pInfo->symlink = 0;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
return PK_COOL;
|
||||||
|
|
||||||
|
} /* end function process_cdir_file_hdr() */
|
||||||
Loading…
x
Reference in New Issue
Block a user