diff -Nru zip-3.0/debian/changelog zip-3.0/debian/changelog --- zip-3.0/debian/changelog 2011-09-21 03:18:31.000000000 +0000 +++ zip-3.0/debian/changelog 2013-02-15 03:58:08.000000000 +0000 @@ -1,11 +1,23 @@ -zip (3.0-4i18n2) oneiric; urgency=low +zip (3.0-6i18n2) oneiric; urgency=low * Apply natspec+asdos patch from http://www.opennet.ru/tips/info/2494.shtml to support automatically encoding file names from current locale to a Windows encoding and create archives with DOS-compatible file names by default. This is to complement changes to unzip utility. - -- Dmitry Frolov (Launchpad.net) Wed, 21 Sep 2011 10:09:57 +0700 + -- Dmitry Frolov (Launchpad.net) Fri, 15 Feb 2013 10:57:04 +0700 + +zip (3.0-6) unstable; urgency=low + + * Added Multi-Arch: foreign. + + -- Santiago Vila Sat, 30 Jun 2012 14:20:38 +0200 + +zip (3.0-5) unstable; urgency=low + + * Build with hardening flags. Closes: #673476. + + -- Santiago Vila Mon, 21 May 2012 19:17:26 +0200 zip (3.0-4) unstable; urgency=low diff -Nru zip-3.0/debian/control zip-3.0/debian/control --- zip-3.0/debian/control 2011-09-21 03:13:32.000000000 +0000 +++ zip-3.0/debian/control 2013-02-15 03:58:50.000000000 +0000 @@ -12,6 +12,7 @@ Recommends: unzip Conflicts: zip-crypt (<= 2.30-2) Replaces: zip-crypt (<= 2.30-2) +Multi-Arch: foreign Description: Archiver for .zip files This is InfoZIP's zip program. It produces files that are fully compatible with the popular PKZIP program; however, the command line diff -Nru zip-3.0/debian/patches/08-hardening-build-fix-1 zip-3.0/debian/patches/08-hardening-build-fix-1 --- zip-3.0/debian/patches/08-hardening-build-fix-1 1970-01-01 00:00:00.000000000 +0000 +++ zip-3.0/debian/patches/08-hardening-build-fix-1 2012-05-21 16:24:51.000000000 +0000 @@ -0,0 +1,25 @@ +From: Santiago Vila +Subject: Use format specifier %s to print strings, not the string itself +Bug-Debian: http://bugs.debian.org/673476 +X-Debian-version: 3.0-5 + +--- a/zip.c ++++ b/zip.c +@@ -1028,7 +1028,7 @@ + + for (i = 0; i < sizeof(text)/sizeof(char *); i++) + { +- printf(text[i]); ++ printf("%s", text[i]); + putchar('\n'); + } + #ifdef DOS +@@ -1225,7 +1225,7 @@ + CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE); + for (i = 0; i < sizeof(cryptnote)/sizeof(char *); i++) + { +- printf(cryptnote[i]); ++ printf("%s", cryptnote[i]); + putchar('\n'); + } + ++i; /* crypt support means there IS at least one compilation option */ diff -Nru zip-3.0/debian/patches/08-natspec+asdos zip-3.0/debian/patches/08-natspec+asdos --- zip-3.0/debian/patches/08-natspec+asdos 2011-01-06 07:24:01.000000000 +0000 +++ zip-3.0/debian/patches/08-natspec+asdos 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -diff -pur zip30orig/fileio.c zip30/fileio.c ---- zip30orig/fileio.c 2008-05-29 04:13:24.000000000 +0400 -+++ zip30/fileio.c 2010-11-29 10:39:54.000000000 +0300 -@@ -929,7 +929,7 @@ int newname(name, isdir, casesensitive) - } - if ((zname = in2ex(iname)) == NULL) - return ZE_MEM; --#ifdef UNICODE_SUPPORT -+#if defined(UNICODE_SUPPORT) && !defined(UNIX) - /* Convert name to display or OEM name */ - oname = local_to_display_string(iname); - #else -diff -pur zip30orig/globals.c zip30/globals.c ---- zip30orig/globals.c 2008-05-25 21:26:38.000000000 +0400 -+++ zip30/globals.c 2010-11-28 17:30:37.000000000 +0300 -@@ -32,7 +32,7 @@ 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 dosify = 0; /* 1=make new entries look like MSDOS */ -+int dosify = 1; /* 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 */ - int filesync = 0; /* 1=file sync, delete entries not on file system */ -diff -pur zip30orig/unix/Makefile zip30/unix/Makefile ---- zip30orig/unix/Makefile 2008-05-07 10:33:56.000000000 +0400 -+++ zip30/unix/Makefile 2010-11-27 18:09:40.000000000 +0300 -@@ -61,6 +61,7 @@ CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP) - CFLAGS = -O2 $(CFLAGS_NOOPT) - LFLAGS1 = - LFLAGS2 = -s -+LDADD = -lnatspec - - # object file lists - OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \ -@@ -125,7 +126,7 @@ zips: $(ZIPS) - zipsman: $(ZIPS) $(ZIPMANUALs) - - zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ) -- $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) -+ $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) $(LDADD) - zipnote$E: $(OBJN) - $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2) - zipcloak$E: $(OBJC) $(OCRCTB) -diff -pur zip30orig/unix/osdep.h zip30/unix/osdep.h ---- zip30orig/unix/osdep.h 2005-07-12 10:41:08.000000000 +0400 -+++ zip30/unix/osdep.h 2010-11-27 18:03:39.000000000 +0300 -@@ -78,3 +78,6 @@ - #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME) - # define USE_EF_UT_TIME - #endif -+ -+/* Set Windows code as archive type */ -+# define OS_CODE 0xb00 -diff -pur zip30orig/unix/unix.c zip30/unix/unix.c ---- zip30orig/unix/unix.c 2008-06-19 08:26:18.000000000 +0400 -+++ zip30/unix/unix.c 2010-11-27 18:03:39.000000000 +0300 -@@ -14,6 +14,11 @@ - - #include - -+#ifdef UNIX -+# include -+# include -+#endif -+ - #if defined(MINIX) || defined(__mpexl) - # ifdef S_IWRITE - # undef S_IWRITE -@@ -60,6 +65,7 @@ local time_t label_utim = 0; - - /* Local functions */ - local char *readd OF((DIR *)); -+local const char *oem_charset = NULL; - - - #ifdef NO_DIR /* for AT&T 3B1 */ -@@ -262,6 +268,16 @@ int *pdosflag; /* output: force - if (!pathput) - t = last(t, PATH_END); - -+#ifdef UNIX -+ if (!oem_charset) { -+ setlocale(LC_CTYPE, ""); -+ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); -+ } -+ /* Convert to internal encoding */ -+ if ((n = natspec_convert(t, oem_charset, 0, 0)) == NULL) -+ return NULL; -+ return n; -+#else - /* Malloc space for internal name and copy it */ - if ((n = malloc(strlen(t) + 1)) == NULL) - return NULL; -@@ -269,6 +285,7 @@ int *pdosflag; /* output: force - - if (dosify) - msname(n); -+#endif - - #ifdef EBCDIC - strtoasc(n, n); /* here because msname() needs native coding */ -@@ -289,8 +306,19 @@ char *n; /* internal file - { - char *x; /* external file name */ - -+#ifdef UNIX -+ if (!oem_charset) { -+ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); -+ setlocale(LC_CTYPE, ""); -+ } -+ /* Convert to internal encoding */ -+ if ((x = natspec_convert(n, 0, oem_charset, 0)) == NULL) -+ return NULL; -+ return x; -+#else - if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) - return NULL; -+#endif - #ifdef EBCDIC - strtoebc(x, n); - #else -diff -pur zip30orig/zip.c zip30/zip.c ---- zip30orig/zip.c 2008-07-05 20:34:06.000000000 +0400 -+++ zip30/zip.c 2010-11-29 09:29:57.000000000 +0300 -@@ -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", "no DOS-names",o_NO_VALUE, o_NOT_NEGATABLE, 'K', "no use 8.3 DOS names"}, - {"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)"}, -@@ -2289,7 +2290,7 @@ 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) */ -- dosify = 0; /* 1=make new entries look like MSDOS */ -+ dosify = 1; /* 1=make new entries look like MSDOS */ - verbose = 0; /* 1=report oddities in zip file structure */ - fix = 0; /* 1=fix the zip file */ - adjust = 0; /* 1=adjust offsets for sfx'd file (keep preamble) */ -@@ -2859,6 +2860,8 @@ char **argv; /* command line - junk_sfx = 1; break; - case 'k': /* Make entries using DOS names (k for Katz) */ - dosify = 1; break; -+ case 'K': /* Make entries using DOS names (K for Kompat) */ -+ dosify = 0; break; - case 'l': /* Translate end-of-line */ - translate_eol = 1; break; - case o_ll: diff -Nru zip-3.0/debian/patches/09-hardening-build-fix-2 zip-3.0/debian/patches/09-hardening-build-fix-2 --- zip-3.0/debian/patches/09-hardening-build-fix-2 1970-01-01 00:00:00.000000000 +0000 +++ zip-3.0/debian/patches/09-hardening-build-fix-2 2012-05-21 17:05:35.000000000 +0000 @@ -0,0 +1,16 @@ +From: Santiago Vila +Subject: unix/configure: Take linking flags from the environment +Bug-Debian: http://bugs.debian.org/673476 +X-Debian-version: 3.0-5 + +--- a/unix/configure ++++ b/unix/configure +@@ -18,7 +18,7 @@ + + CC=${1-cc} + CFLAGS=${2-"-I. -DUNIX"} +-LFLAGS1='' ++LFLAGS1=${LDFLAGS} + LFLAGS2='' + LN="ln -s" + diff -Nru zip-3.0/debian/patches/10-natspec+asdos zip-3.0/debian/patches/10-natspec+asdos --- zip-3.0/debian/patches/10-natspec+asdos 1970-01-01 00:00:00.000000000 +0000 +++ zip-3.0/debian/patches/10-natspec+asdos 2011-01-06 07:24:01.000000000 +0000 @@ -0,0 +1,151 @@ +diff -pur zip30orig/fileio.c zip30/fileio.c +--- zip30orig/fileio.c 2008-05-29 04:13:24.000000000 +0400 ++++ zip30/fileio.c 2010-11-29 10:39:54.000000000 +0300 +@@ -929,7 +929,7 @@ int newname(name, isdir, casesensitive) + } + if ((zname = in2ex(iname)) == NULL) + return ZE_MEM; +-#ifdef UNICODE_SUPPORT ++#if defined(UNICODE_SUPPORT) && !defined(UNIX) + /* Convert name to display or OEM name */ + oname = local_to_display_string(iname); + #else +diff -pur zip30orig/globals.c zip30/globals.c +--- zip30orig/globals.c 2008-05-25 21:26:38.000000000 +0400 ++++ zip30/globals.c 2010-11-28 17:30:37.000000000 +0300 +@@ -32,7 +32,7 @@ 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 dosify = 0; /* 1=make new entries look like MSDOS */ ++int dosify = 1; /* 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 */ + int filesync = 0; /* 1=file sync, delete entries not on file system */ +diff -pur zip30orig/unix/Makefile zip30/unix/Makefile +--- zip30orig/unix/Makefile 2008-05-07 10:33:56.000000000 +0400 ++++ zip30/unix/Makefile 2010-11-27 18:09:40.000000000 +0300 +@@ -61,6 +61,7 @@ CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP) + CFLAGS = -O2 $(CFLAGS_NOOPT) + LFLAGS1 = + LFLAGS2 = -s ++LDADD = -lnatspec + + # object file lists + OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \ +@@ -125,7 +126,7 @@ zips: $(ZIPS) + zipsman: $(ZIPS) $(ZIPMANUALs) + + zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ) +- $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) ++ $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) $(LDADD) + zipnote$E: $(OBJN) + $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2) + zipcloak$E: $(OBJC) $(OCRCTB) +diff -pur zip30orig/unix/osdep.h zip30/unix/osdep.h +--- zip30orig/unix/osdep.h 2005-07-12 10:41:08.000000000 +0400 ++++ zip30/unix/osdep.h 2010-11-27 18:03:39.000000000 +0300 +@@ -78,3 +78,6 @@ + #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME) + # define USE_EF_UT_TIME + #endif ++ ++/* Set Windows code as archive type */ ++# define OS_CODE 0xb00 +diff -pur zip30orig/unix/unix.c zip30/unix/unix.c +--- zip30orig/unix/unix.c 2008-06-19 08:26:18.000000000 +0400 ++++ zip30/unix/unix.c 2010-11-27 18:03:39.000000000 +0300 +@@ -14,6 +14,11 @@ + + #include + ++#ifdef UNIX ++# include ++# include ++#endif ++ + #if defined(MINIX) || defined(__mpexl) + # ifdef S_IWRITE + # undef S_IWRITE +@@ -60,6 +65,7 @@ local time_t label_utim = 0; + + /* Local functions */ + local char *readd OF((DIR *)); ++local const char *oem_charset = NULL; + + + #ifdef NO_DIR /* for AT&T 3B1 */ +@@ -262,6 +268,16 @@ int *pdosflag; /* output: force + if (!pathput) + t = last(t, PATH_END); + ++#ifdef UNIX ++ if (!oem_charset) { ++ setlocale(LC_CTYPE, ""); ++ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); ++ } ++ /* Convert to internal encoding */ ++ if ((n = natspec_convert(t, oem_charset, 0, 0)) == NULL) ++ return NULL; ++ return n; ++#else + /* Malloc space for internal name and copy it */ + if ((n = malloc(strlen(t) + 1)) == NULL) + return NULL; +@@ -269,6 +285,7 @@ int *pdosflag; /* output: force + + if (dosify) + msname(n); ++#endif + + #ifdef EBCDIC + strtoasc(n, n); /* here because msname() needs native coding */ +@@ -289,8 +306,19 @@ char *n; /* internal file + { + char *x; /* external file name */ + ++#ifdef UNIX ++ if (!oem_charset) { ++ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); ++ setlocale(LC_CTYPE, ""); ++ } ++ /* Convert to internal encoding */ ++ if ((x = natspec_convert(n, 0, oem_charset, 0)) == NULL) ++ return NULL; ++ return x; ++#else + if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) + return NULL; ++#endif + #ifdef EBCDIC + strtoebc(x, n); + #else +diff -pur zip30orig/zip.c zip30/zip.c +--- zip30orig/zip.c 2008-07-05 20:34:06.000000000 +0400 ++++ zip30/zip.c 2010-11-29 09:29:57.000000000 +0300 +@@ -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", "no DOS-names",o_NO_VALUE, o_NOT_NEGATABLE, 'K', "no use 8.3 DOS names"}, + {"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)"}, +@@ -2289,7 +2290,7 @@ 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) */ +- dosify = 0; /* 1=make new entries look like MSDOS */ ++ dosify = 1; /* 1=make new entries look like MSDOS */ + verbose = 0; /* 1=report oddities in zip file structure */ + fix = 0; /* 1=fix the zip file */ + adjust = 0; /* 1=adjust offsets for sfx'd file (keep preamble) */ +@@ -2859,6 +2860,8 @@ char **argv; /* command line + junk_sfx = 1; break; + case 'k': /* Make entries using DOS names (k for Katz) */ + dosify = 1; break; ++ case 'K': /* Make entries using DOS names (K for Kompat) */ ++ dosify = 0; break; + case 'l': /* Translate end-of-line */ + translate_eol = 1; break; + case o_ll: diff -Nru zip-3.0/debian/patches/series zip-3.0/debian/patches/series --- zip-3.0/debian/patches/series 2011-09-21 03:14:24.000000000 +0000 +++ zip-3.0/debian/patches/series 2013-02-15 04:01:34.000000000 +0000 @@ -5,4 +5,6 @@ 05-typo-it-is-preceding-not-preceeding 06-stack-markings-to-avoid-executable-stack 07-fclose-in-file-not-fclose-x -08-natspec+asdos +08-hardening-build-fix-1 +09-hardening-build-fix-2 +10-natspec+asdos diff -Nru zip-3.0/debian/rules zip-3.0/debian/rules --- zip-3.0/debian/rules 2011-06-09 13:30:54.000000000 +0000 +++ zip-3.0/debian/rules 2012-05-21 17:08:02.000000000 +0000 @@ -4,7 +4,9 @@ docdir = debian/tmp/usr/share/doc/$(package) CC = gcc -CFLAGS = -g -Wall -I. -DUNIX +CFLAGS := `dpkg-buildflags --get CFLAGS` -Wall -I. -DUNIX +LDFLAGS := `dpkg-buildflags --get LDFLAGS` +CPPFLAGS := `dpkg-buildflags --get CPPFLAGS` STRIP = true DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) @@ -14,15 +16,12 @@ CC=$(DEB_HOST_GNU_TYPE)-gcc endif -ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O2 -endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) STRIP = strip --remove-section=.comment --remove-section=.note endif build: - sh unix/configure "$(CC)" "$(CFLAGS)" + LDFLAGS="$(LDFLAGS)" sh unix/configure "$(CC)" "$(CFLAGS) $(CPPFLAGS)" $(MAKE) -f unix/Makefile generic touch build