From 4953bc46d42dc3c978c00dee670599ca86385a35 Mon Sep 17 00:00:00 2001 From: Ivana Varekova Date: Thu, 10 Nov 2005 13:08:08 +0000 Subject: [PATCH] - update to 2.31 --- .cvsignore | 2 +- sources | 2 +- zip-2.31-configure.patch | 213 ++++++++++++++++++++++++++++ zip-2.31-install.patch | 11 ++ zip-2.31-near-4GB.patch | 293 +++++++++++++++++++++++++++++++++++++++ zip.spec | 19 ++- 6 files changed, 531 insertions(+), 9 deletions(-) create mode 100644 zip-2.31-configure.patch create mode 100644 zip-2.31-install.patch create mode 100644 zip-2.31-near-4GB.patch diff --git a/.cvsignore b/.cvsignore index 7f02a8b..3c76570 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,2 @@ zcrypt29.tar.gz -zip23.tar.gz +zip231.tar.gz diff --git a/sources b/sources index 24069e1..6d5a622 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 922f7f38f8e50ec353fd5b3102e4d4d6 zcrypt29.tar.gz -5206a99541f3b0ab90f1baa167392c4f zip23.tar.gz +6bfc076664416251d7624ab3538d1cb9 zip231.tar.gz diff --git a/zip-2.31-configure.patch b/zip-2.31-configure.patch new file mode 100644 index 0000000..00b09d1 --- /dev/null +++ b/zip-2.31-configure.patch @@ -0,0 +1,213 @@ +--- zip-2.31/unix/configure.lhh 2005-11-10 13:25:26.000000000 +0100 ++++ zip-2.31/unix/configure 2005-11-10 13:40:44.311641648 +0100 +@@ -76,14 +76,20 @@ + done + fi + +-echo Check for prototypes ++echo -n Check for prototypes... + echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c + $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_PROTO" ++else ++ echo yes ++fi ++ + + # const check currently handles mips cc and non ANSI compilers. + # does it need more ? +-echo Check the handling of const ++echo -n Check the handling of const... + cat > conftest.c << _EOF_ + typedef int charset[2]; + int main() +@@ -94,9 +100,15 @@ + } + _EOF_ + $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_CONST" ++else ++ echo yes ++fi ++ + +-echo Check for time_t ++echo -n Check for time_t... + cat > conftest.c << _EOF_ + #include + #include +@@ -107,9 +119,15 @@ + } + _EOF_ + $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_TIME_T" ++else ++ echo yes ++fi ++ + +-echo Check for size_t ++echo -n Check for size_t... + cat > conftest.c << _EOF_ + #include + int main() +@@ -119,7 +137,13 @@ + } + _EOF_ + $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_SIZE_T" ++else ++ echo yes ++fi ++ + + echo Check for gcc no-builtin flag + # -fno-builtin since version 2 +@@ -140,18 +164,29 @@ + # add NO_'function_name' to flags if missing + for func in rmdir strchr strrchr rename mktemp mktime mkstemp + do +- echo Check for $func +- echo "int main(){ $func(); return 0; }" > conftest.c ++ echo -n Check for $func... ++ echo "char $func(void); int main(){ $func(); return 0; }" > conftest.c + $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null +- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`" ++ if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`" ++ else ++ echo yes ++ fi + done + +-echo Check for memset ++echo -n Check for memset... + echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c + $CC -o conftest conftest.c >/dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DZMEM" ++else ++ echo yes ++fi ++ + +-echo Check for errno declaration ++echo -n Check for errno declaration... + cat > conftest.c << _EOF_ + #include + main() +@@ -161,9 +196,14 @@ + } + _EOF_ + $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_ERRNO" ++else ++ echo yes ++fi + +-echo Check for directory libraries ++echo -n Check for directory libraries... + cat > conftest.c << _EOF_ + int main() { return closedir(opendir(".")); } + _EOF_ +@@ -178,21 +218,30 @@ + done + if [ ${OPT} ]; then + LFLAGS2="${LFLAGS2} ${OPT}" ++ echo yes, ${OPT} + else + CFLAGS="${CFLAGS} -DNO_DIR" ++ echo no + fi + fi + + # Dynix/ptx 1.3 needed this +-echo Check for readlink ++echo -n Check for readlink... + echo "int main(){ return readlink(); }" > conftest.c + $CC -o conftest conftest.c >/dev/null 2>/dev/null + if [ $? -ne 0 ]; then + $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null +- [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq" ++ if [ $? -eq 0 ]; then ++ LFLAGS2="${LFLAGS2} -lseq" ++ echo yes, -lseq ++ else ++ echo no ++ fi ++else ++ echo yes + fi + +-echo Check for directory include file ++echo -n Check for directory include file... + OPT="" + for inc in dirent.h sys/ndir.h ndir.h sys/dir.h + do +@@ -200,17 +249,19 @@ + $CPP conftest.c > /dev/null 2>/dev/null + [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break + done ++echo "${OPT}" + CFLAGS="${CFLAGS} ${OPT}" + +-echo Check for non existent include files ++echo -n Check for non existent include files... + for inc in stdlib.h stddef.h unistd.h fcntl.h string.h + do + echo "#include <$inc>" > conftest.c + $CPP conftest.c >/dev/null 2>/dev/null + [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`" + done ++echo ok + +-echo Check for terminal I/O include file ++echo -n Check for terminal I/O include file... + OPT="" + for inc in termios.h termio.h sgtty.h + do +@@ -219,9 +270,10 @@ + [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break + done + CFLAGS="${CFLAGS} ${OPT}" ++echo $OPT + + # needed for AIX (and others ?) when mmap is used +-echo Check for valloc ++echo -n Check for valloc... + cat > conftest.c << _EOF_ + main() + { +@@ -231,7 +283,13 @@ + } + _EOF_ + $CC ${CFLAGS} conftest.c > /dev/null 2>/dev/null +-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC" ++if [ $? -ne 0 ]; then ++ echo no ++ CFLAGS="${CFLAGS} -DNO_VALLOC" ++else ++ echo yes ++fi ++ + + echo Check for 64bit fseek + for func in fseeko fseek64 diff --git a/zip-2.31-install.patch b/zip-2.31-install.patch new file mode 100644 index 0000000..7a1f69f --- /dev/null +++ b/zip-2.31-install.patch @@ -0,0 +1,11 @@ +--- zip-2.31/unix/Makefile.install 2005-02-28 08:33:50.000000000 +0100 ++++ zip-2.31/unix/Makefile 2005-11-10 12:58:33.221425848 +0100 +@@ -129,7 +129,7 @@ + $(INSTALL_PROGRAM) $(ZIPS) $(BINDIR) + -cd $(BINDIR); $(CHMOD) $(BINFLAGS) $(ZIPS) + -$(INSTALL_D) $(MANDIR) +- $(INSTALL) man/zip.1 $(MANDIR)/zip.$(manext) ++ $(INSTALL_PROGRAM) man/zip.1 $(MANDIR)/zip.$(manext) + $(CHMOD) $(MANFLAGS) $(MANDIR)/zip.$(manext) + + uninstall: diff --git a/zip-2.31-near-4GB.patch b/zip-2.31-near-4GB.patch new file mode 100644 index 0000000..210b183 --- /dev/null +++ b/zip-2.31-near-4GB.patch @@ -0,0 +1,293 @@ +--- zip-2.31/unix/zipup.h.4GB 2005-01-29 07:47:58.000000000 +0100 ++++ zip-2.31/unix/zipup.h 2005-11-10 13:18:02.990593904 +0100 +@@ -6,13 +6,19 @@ + 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 + */ ++#include ++#include + #ifndef O_RDONLY + # define O_RDONLY 0 + #endif + #ifndef O_BINARY + # define O_BINARY 0 + #endif +-#define fhow (O_RDONLY|O_BINARY) ++#ifdef _LARGEFILE64_SOURCE ++#define fhow (O_RDONLY | O_LARGEFILE) ++#else ++#define fhow O_RDONLY ++#endif + #define fbad (-1) + typedef int ftype; + #define zopen(n,p) open(n,p) +--- zip-2.31/unix/unix.c.4GB 2005-02-11 03:35:02.000000000 +0100 ++++ zip-2.31/unix/unix.c 2005-11-10 13:24:19.573344624 +0100 +@@ -113,7 +113,11 @@ + char *e; /* pointer to name from readd() */ + int m; /* matched flag */ + char *p; /* path for recursion */ ++#ifdef _LARGEFILE64_SOURCE ++ struct stat64 s; /* result of stat() */ ++#else + struct stat s; /* result of stat() */ ++#endif + struct zlist far *z; /* steps through zfiles list */ + + if (strcmp(n, "-") == 0) /* if compressing stdin */ +@@ -202,6 +206,15 @@ + } /* (s.st_mode & S_IFDIR) */ + else + zipwarn("ignoring special file: ", n); ++ ++ /* Zip uses negative error codes (IIRC, to -3). Make sure file size ++ doesn't collide with error values. 2^32 - 8193 should be plenty until ++ info-zip supports zip64. */ ++ if (s.st_size > MAX_ZIP_SIZE) { ++ zipwarn("file too large: ", a); ++ return ZE_MISS; ++ } ++ + return ZE_OK; + } + +@@ -321,7 +334,12 @@ + If f is "-", use standard input as the file. If f is a device, return + a file size of -1 */ + { +- struct stat s; /* results of stat() */ ++#ifdef _LARGEFILE64_SOURCE ++ struct stat64 s; /* results of stat() */ ++#else ++ struct stat s; ++#endif ++ + /* converted to pointer from using FNMAX - 11/8/04 EG */ + char *name; + int len = strlen(f); +@@ -343,7 +361,11 @@ + name[len - 1] = '\0'; + /* not all systems allow stat'ing a file with / appended */ + if (strcmp(f, "-") == 0) { ++#ifdef _LARGEFILE64_SOURCE ++ if (fstat64(fileno(stdin), &s) != 0) { ++#else + if (fstat(fileno(stdin), &s) != 0) { ++#endif + free(name); + error("fstat(stdin)"); + } +@@ -422,7 +444,11 @@ + /* store full data in local header but just modification time stamp info + in central header */ + { ++#ifdef _LARGEFILE64_SOURCE ++ struct stat64 s; ++#else + struct stat s; ++#endif + char *name; + int len = strlen(z->name); + +--- zip-2.31/unix/configure.4GB 2004-12-05 09:51:18.000000000 +0100 ++++ zip-2.31/unix/configure 2005-11-10 13:12:47.010630160 +0100 +@@ -12,7 +12,7 @@ + trap "rm -f conftest* core a.out; exit 1" 1 2 3 15 + + CC=${1-cc} +-CFLAGS=${2-"-O2 -I. -DUNIX"} ++CFLAGS=${2-"-O2 -I. -DUNIX -g -D_LARGEFILE64_SOURCE"} + LFLAGS1="" + LN="ln -s" + +--- zip-2.31/fileio.c.4GB 2005-11-10 12:59:43.000000000 +0100 ++++ zip-2.31/fileio.c 2005-11-10 13:07:13.190378552 +0100 +@@ -599,7 +599,11 @@ + this will be done by setfileattr() later. + */ + { ++#ifdef _LARGEFILE64_SOURCE ++ struct stat64 t; /* results of stat64() */ ++#else + struct stat t; /* results of stat() */ ++#endif + #if defined(CMS_MVS) + /* cmsmvs.h defines FOPW_TEMP as memory(hiperspace). Since memory is + * lost at end of run, always do copy instead of rename. +@@ -698,8 +702,11 @@ + + return _dos_files(&buf, f, 0xff) < 0 ? 0x20 : buf.atr; + #else ++#ifdef _LARGEFILE64_SOURCE ++ struct stat64 s; ++#else + struct stat s; +- ++#endif + return SSTAT(f, &s) == 0 ? (int) s.st_mode : 0; + #endif + } +@@ -920,3 +927,108 @@ + } + + #endif /* NO_RENAME */ ++ ++/* ++ Wrapper functions for fopen/fseek/ftell for >2GB files. ++ ++ So, what we do here is add support for 4GB seeks. More appropriately, ++ 2^32 - 8193 bytes. This is tailored to the way zip uses fseek; it never ++ seeks backwards more than 8192 bytes. ++ */ ++#ifdef _LARGEFILE64_SOURCE ++FILE * ++lfopen(const char *path, const char *mode) ++{ ++ int fd; ++ FILE *f; ++ int flags; ++ int x; ++ char prev; ++ ++ if (!path || !mode | !strlen(mode)) ++ return NULL; ++ ++ for (x = 0; x < strlen(mode); x++) { ++ switch (mode[x]) { ++ case 'r': ++ flags = O_RDONLY | O_LARGEFILE; ++ break; ++ case 'w': ++ flags = O_WRONLY | O_LARGEFILE | O_CREAT | O_TRUNC; ++ break; ++ case 'a': ++ flags = O_RDWR | O_LARGEFILE; ++ break; ++ case 'b': /* b has no effect */ ++ continue; ++ case '+': ++ if (prev == 'r') { ++ flags = O_RDWR | O_LARGEFILE; ++ } else if (prev == 'w') { ++ flags = O_RDWR | O_LARGEFILE | O_CREAT | ++ O_TRUNC; ++ } else if (prev == 'a') { ++ flags = O_RDWR | O_LARGEFILE | O_CREAT; ++ } else ++ return NULL; ++ break; ++ } ++ prev = mode[x]; ++ } ++ ++ fd = open(path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++ if (fd == -1) ++ return NULL; ++ ++ f = fdopen(fd, mode); ++ return f; ++} ++ ++int ++lfseek(FILE *f, ulg pos, int whence) ++{ ++ struct stat64 sb; ++ ulg o, delta; ++ int ret; ++ ++ /* Hurts performance */ ++ fflush(f); ++ ++ if (pos <= MAX_ZIP_SIZE) { ++ return (lseek64(fileno(f), pos, whence) == (off64_t)-1); ++ } ++ ++ delta = ~((off64_t)pos - 1); ++ if (whence == SEEK_CUR) { ++ o = lseek64(fileno(f), 0, SEEK_CUR); ++ if (o < delta) ++ return -1; ++ ++ o -= delta; ++ return (lseek64(fileno(f), o, SEEK_SET) == (off64_t)-1); ++ } ++ ++ if (whence == SEEK_END) { ++ fstat64(fileno(f), &sb); ++ ++ if ((ulg)sb.st_size < delta) ++ return -1; ++ ++ o = (off64_t)((sb.st_size) - delta); ++ return (lseek64(fileno(f), o, SEEK_SET) == (off64_t)-1); ++ } ++ ++ return -1; ++} ++ ++ ++ulg ++lftell(FILE *f) ++{ ++ /* Hurts performance */ ++ fflush(f); ++ return (ulg)lseek64(fileno(f), 0, SEEK_CUR); ++} ++ ++#endif /* _LARGEFILE64_SOURCE */ ++ +--- zip-2.31/zip.h.4GB 2005-11-10 12:59:43.000000000 +0100 ++++ zip-2.31/zip.h 2005-11-10 13:18:57.653283912 +0100 +@@ -236,6 +236,7 @@ + #define DOSTIME_MINIMUM ((ulg)0x00210000L) + #define DOSTIME_2038_01_18 ((ulg)0x74320000L) + ++#define MAX_ZIP_SIZE 0xffffdffe /* Max archive / archive member size */ + + /* Public globals */ + extern uch upper[256]; /* Country dependent case map table */ +@@ -411,6 +412,11 @@ + int putcentral OF((struct zlist far *, FILE *)); + int putend OF((int, ulg, ulg, extent, char *, FILE *)); + int zipcopy OF((struct zlist far *, FILE *, FILE *)); ++#ifdef _LARGEFILE64_SOURCE ++int lfseek OF((FILE *, ulg, int)); ++ulg lftell OF((FILE *)); ++FILE *lfopen OF((const char *, const char *)); ++#endif /* LF64 */ + + /* in fileio.c */ + #ifndef UTIL +--- zip-2.31/tailor.h.4GB 2005-03-04 08:45:26.000000000 +0100 ++++ zip-2.31/tailor.h 2005-11-10 13:11:18.909023640 +0100 +@@ -368,12 +368,27 @@ + # define DYN_ALLOC + #endif + ++#ifdef _LARGEFILE64_SOURCE ++#define fopen lfopen ++#define fseek lfseek ++#define ftell lftell ++#endif /* LF64 */ ++ + #ifndef SSTAT +-# define SSTAT stat ++# ifdef _LARGEFILE64_SOURCE ++# define SSTAT stat64 ++# else ++# define SSTAT stat ++# endif /* LF64 */ + #endif + #ifdef S_IFLNK +-# define LSTAT lstat +-# define LSSTAT(n, s) (linkput ? lstat((n), (s)) : SSTAT((n), (s))) ++# ifdef _LARGEFILE64_SOURCE ++# define LSTAT lstat64 ++# define LSSTAT(n, s) (linkput ? lstat64((n), (s)) : SSTAT((n), (s))) ++# else ++# define LSTAT lstat64 ++# define LSSTAT(n, s) (linkput ? lstat64((n), (s)) : SSTAT((n), (s))) ++# endif /* LF64 */ + #else + # define LSTAT SSTAT + # define LSSTAT SSTAT diff --git a/zip.spec b/zip.spec index b7124a2..1d7a312 100644 --- a/zip.spec +++ b/zip.spec @@ -1,18 +1,19 @@ Summary: A file compression and packaging utility compatible with PKZIP. Name: zip -Version: 2.3 -Release: 30 +Version: 2.31 +Release: 1 License: distributable Group: Applications/Archiving -Source: ftp.uu.net:/pub/archiving/zip/src/zip23.tar.gz +Source: http://ftp.info-zip.org/pub/infozip/src/zip231.tar.gz Source1: ftp://ftp.freesoftware.com/pub/infozip/src/zcrypt29.tar.gz URL: http://www.info-zip.org/pub/infozip/Zip.html Patch0: zip23.patch Patch1: exec-shield.patch Patch2: zip23-umask.patch -Patch3: zip-2.3-near-4GB.patch -Patch4: zip-2.3-configure.patch Patch5: zip-2.3-currdir.patch +Patch6: zip-2.31-install.patch +Patch7: zip-2.31-near-4GB.patch +Patch8: zip-2.31-configure.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root %description @@ -29,9 +30,10 @@ program. %patch0 -p1 -b .zip %patch1 -p1 -b .zip %patch2 -p1 -b .umask -%patch3 -p1 -b .4gb -%patch4 -p1 -b .cfg %patch5 -p1 -b .currdir +%patch6 -p1 -b .install +%patch7 -p1 -b .4gb +%patch8 -p1 -b .lhh %build make -f unix/Makefile prefix=/usr "CFLAGS=$RPM_OPT_FLAGS -I. -DUNIX -D_LARGEFILE64_SOURCE" generic_gcc @@ -64,6 +66,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/zip.1* %changelog +* Thu Nov 10 2005 Ivana Varekova 2.31-1 +- update to 2.31 + * Mon Mar 7 2005 Ivana Varekova 2.3-30 - rebuilt