From 021cad1521782b7753f20a48bab8448b3527f8a9 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 13 Oct 2020 02:47:25 -0500 Subject: zip: add patches (#18994) * zip: add patches * Add .patch suffix * Simplify build targets --- ...1-typo-it-is-transferring-not-transfering.patch | 27 +++++++++++++ .../02-typo-it-is-privileges-not-priviliges.patch | 27 +++++++++++++ ...3-manpages-in-section-1-not-in-section-1l.patch | 47 ++++++++++++++++++++++ .../zip/04-do-not-set-unwanted-cflags.patch | 15 +++++++ .../05-typo-it-is-preceding-not-preceeding.patch | 26 ++++++++++++ ...-stack-markings-to-avoid-executable-stack.patch | 21 ++++++++++ .../zip/07-fclose-in-file-not-fclose-x.patch | 16 ++++++++ .../packages/zip/08-hardening-build-fix-1.patch | 25 ++++++++++++ .../packages/zip/09-hardening-build-fix-2.patch | 16 ++++++++ .../packages/zip/10-remove-build-date.patch | 15 +++++++ var/spack/repos/builtin/packages/zip/package.py | 28 ++++++++----- 11 files changed, 254 insertions(+), 9 deletions(-) create mode 100644 var/spack/repos/builtin/packages/zip/01-typo-it-is-transferring-not-transfering.patch create mode 100644 var/spack/repos/builtin/packages/zip/02-typo-it-is-privileges-not-priviliges.patch create mode 100644 var/spack/repos/builtin/packages/zip/03-manpages-in-section-1-not-in-section-1l.patch create mode 100644 var/spack/repos/builtin/packages/zip/04-do-not-set-unwanted-cflags.patch create mode 100644 var/spack/repos/builtin/packages/zip/05-typo-it-is-preceding-not-preceeding.patch create mode 100644 var/spack/repos/builtin/packages/zip/06-stack-markings-to-avoid-executable-stack.patch create mode 100644 var/spack/repos/builtin/packages/zip/07-fclose-in-file-not-fclose-x.patch create mode 100644 var/spack/repos/builtin/packages/zip/08-hardening-build-fix-1.patch create mode 100644 var/spack/repos/builtin/packages/zip/09-hardening-build-fix-2.patch create mode 100644 var/spack/repos/builtin/packages/zip/10-remove-build-date.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/zip/01-typo-it-is-transferring-not-transfering.patch b/var/spack/repos/builtin/packages/zip/01-typo-it-is-transferring-not-transfering.patch new file mode 100644 index 0000000000..3d1b9cb39e --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/01-typo-it-is-transferring-not-transfering.patch @@ -0,0 +1,27 @@ +From: A Costa +Subject: manpage typo: transfering -> transferring +Bug-Debian: http://bugs.debian.org/301914 +X-Debian-version: 2.31-2 + +--- a/man/zip.1 ++++ b/man/zip.1 +@@ -2756,7 +2756,7 @@ + .I zip + handles some of the conversion internally. + When using Kermit to transfer zip files from VMS to MSDOS, type "set +-file type block" on VMS. When transfering from MSDOS to VMS, type ++file type block" on VMS. When transferring from MSDOS to VMS, type + "set file type fixed" on VMS. In both cases, type "set file type + binary" on MSDOS. + .LP +--- a/zip.txt ++++ b/zip.txt +@@ -1957,7 +1957,7 @@ + be converted using Rahul Dhesi's BILF program. This version of zip + handles some of the conversion internally. When using Kermit to trans- + fer zip files from VMS to MSDOS, type "set file type block" on VMS. +- When transfering from MSDOS to VMS, type "set file type fixed" on VMS. ++ When transferring from MSDOS to VMS, type "set file type fixed" on VMS. + In both cases, type "set file type binary" on MSDOS. + + Under some older VMS versions, zip may hang for file specifications diff --git a/var/spack/repos/builtin/packages/zip/02-typo-it-is-privileges-not-priviliges.patch b/var/spack/repos/builtin/packages/zip/02-typo-it-is-privileges-not-priviliges.patch new file mode 100644 index 0000000000..70a3ffae11 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/02-typo-it-is-privileges-not-priviliges.patch @@ -0,0 +1,27 @@ +From: A Costa +Subject: manpage typo: priviliges -> privileges +Bug-Debian: http://bugs.debian.org/309877 +X-Debian-version: 2.31-3 + +--- a/man/zip.1 ++++ b/man/zip.1 +@@ -2403,7 +2403,7 @@ + .TP + .PD + .B \-\-use\-privileges +-[WIN32] Use priviliges (if granted) to obtain all aspects of WinNT security. ++[WIN32] Use privileges (if granted) to obtain all aspects of WinNT security. + .TP + .PD 0 + .B \-@ +--- a/zip.txt ++++ b/zip.txt +@@ -1696,7 +1696,7 @@ + + -! + --use-privileges +- [WIN32] Use priviliges (if granted) to obtain all aspects of ++ [WIN32] Use privileges (if granted) to obtain all aspects of + WinNT security. + + -@ diff --git a/var/spack/repos/builtin/packages/zip/03-manpages-in-section-1-not-in-section-1l.patch b/var/spack/repos/builtin/packages/zip/03-manpages-in-section-1-not-in-section-1l.patch new file mode 100644 index 0000000000..23ea767592 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/03-manpages-in-section-1-not-in-section-1l.patch @@ -0,0 +1,47 @@ +From: Lior Kaplan +Subject: put manpages in section 1, not in section 1L +Bug-Debian: http://bugs.debian.org/308045 +X-Debian-version: 2.31-3 + +--- a/man/zip.1 ++++ b/man/zip.1 +@@ -13,7 +13,7 @@ + .\" 30 August 2007, 27 April 2008, 25 May 2008, 27 May 2008 by EG, + .\" 7 June 2008 by SMS and EG; 12 June 2008 by EG) + .\" +-.TH ZIP 1L "16 June 2008 (v3.0)" Info-ZIP ++.TH ZIP 1 "16 June 2008 (v3.0)" Info-ZIP + .SH NAME + zip \- package and compress (archive) files + .SH SYNOPSIS +@@ -53,14 +53,14 @@ + and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems). + .LP + A companion program +-.RI ( unzip (1L)) ++.RI ( unzip (1)) + unpacks + .I zip + archives. + The + .I zip + and +-.IR unzip (1L) ++.IR unzip (1) + programs can work with archives produced by PKZIP (supporting + most PKZIP features up to PKZIP version 4.6), + and PKZIP and PKUNZIP can work with archives produced by +@@ -2661,10 +2661,10 @@ + [VMS] see ZIPOPT + .SH "SEE ALSO" + compress(1), +-shar(1L), ++shar(1), + tar(1), +-unzip(1L), +-gzip(1L) ++unzip(1), ++gzip(1) + .SH DIAGNOSTICS + The exit status (or error level) approximates the exit codes defined by PKWARE + and takes on the following values, except under VMS: diff --git a/var/spack/repos/builtin/packages/zip/04-do-not-set-unwanted-cflags.patch b/var/spack/repos/builtin/packages/zip/04-do-not-set-unwanted-cflags.patch new file mode 100644 index 0000000000..35c42387b1 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/04-do-not-set-unwanted-cflags.patch @@ -0,0 +1,15 @@ +From: Santiago Vila +Subject: Do not set unwanted CFLAGS, as it breaks DEB_BUILD_OPTIONS +X-Debian-version: 2.32-1 + +--- a/unix/configure ++++ b/unix/configure +@@ -98,7 +98,7 @@ + _EOF_ + $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null + if test $? -eq 0; then +- CFLAGS_OPT='-O3' ++ # CFLAGS_OPT='-O3' + echo " GNU C ($CFLAGS_OPT)" + # Special Mac OS X shared library "ld" option? + if test ` uname -s 2> /dev/null ` = 'Darwin'; then diff --git a/var/spack/repos/builtin/packages/zip/05-typo-it-is-preceding-not-preceeding.patch b/var/spack/repos/builtin/packages/zip/05-typo-it-is-preceding-not-preceeding.patch new file mode 100644 index 0000000000..5f54b12970 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/05-typo-it-is-preceding-not-preceeding.patch @@ -0,0 +1,26 @@ +From: Santiago Vila +Subject: manpage typo: preceeding -> preceding +X-Debian-version: 3.0-2 + +--- a/man/zip.1 ++++ b/man/zip.1 +@@ -502,7 +502,7 @@ + where the option starts with --, has a multicharacter name, can + include a trailing dash to negate the option (if the option + supports it), and can have a value (option argument) specified by +-preceeding it with = (no spaces). Values can also follow the ++preceding it with = (no spaces). Values can also follow the + argument. So + .IP + \fC--before-date=mmddyyyy\fP +--- a/zip.txt ++++ b/zip.txt +@@ -376,7 +376,7 @@ + + where the option starts with --, has a multicharacter name, can include + a trailing dash to negate the option (if the option supports it), and +- can have a value (option argument) specified by preceeding it with = ++ can have a value (option argument) specified by preceding it with = + (no spaces). Values can also follow the argument. So + + --before-date=mmddyyyy diff --git a/var/spack/repos/builtin/packages/zip/06-stack-markings-to-avoid-executable-stack.patch b/var/spack/repos/builtin/packages/zip/06-stack-markings-to-avoid-executable-stack.patch new file mode 100644 index 0000000000..9d8a8ff340 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/06-stack-markings-to-avoid-executable-stack.patch @@ -0,0 +1,21 @@ +From: Kees Cook +Subject: put stack markings in i386 assembly to avoid executable stack +Bug-Debian: http://bugs.debian.org/528280 +X-Debian-version: 3.0-2 + +--- a/crc_i386.S ++++ b/crc_i386.S +@@ -302,3 +302,5 @@ + #endif /* i386 || _i386 || _I386 || __i386 */ + + #endif /* !USE_ZLIB && !CRC_TABLE_ONLY */ ++.section .note.GNU-stack, "", @progbits ++.previous +--- a/match.S ++++ b/match.S +@@ -405,3 +405,5 @@ + #endif /* i386 || _I386 || _i386 || __i386 */ + + #endif /* !USE_ZLIB */ ++.section .note.GNU-stack, "", @progbits ++.previous diff --git a/var/spack/repos/builtin/packages/zip/07-fclose-in-file-not-fclose-x.patch b/var/spack/repos/builtin/packages/zip/07-fclose-in-file-not-fclose-x.patch new file mode 100644 index 0000000000..757527993a --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/07-fclose-in-file-not-fclose-x.patch @@ -0,0 +1,16 @@ +From: Christian Spieler +Subject: zipnote.c: Close in_file instead of undefined file x +Bug-Debian: http://bugs.debian.org/628594 +X-Debian-version: 3.0-4 + +--- a/zipnote.c ++++ b/zipnote.c +@@ -661,7 +661,7 @@ + if ((r = zipcopy(z)) != ZE_OK) + ziperr(r, "was copying an entry"); + } +- fclose(x); ++ fclose(in_file); + + /* Write central directory and end of central directory with new comments */ + if ((c = zftello(y)) == (zoff_t)-1) /* get start of central */ diff --git a/var/spack/repos/builtin/packages/zip/08-hardening-build-fix-1.patch b/var/spack/repos/builtin/packages/zip/08-hardening-build-fix-1.patch new file mode 100644 index 0000000000..94ddb71b21 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/08-hardening-build-fix-1.patch @@ -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 --git a/var/spack/repos/builtin/packages/zip/09-hardening-build-fix-2.patch b/var/spack/repos/builtin/packages/zip/09-hardening-build-fix-2.patch new file mode 100644 index 0000000000..52ecd91ba6 --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/09-hardening-build-fix-2.patch @@ -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 --git a/var/spack/repos/builtin/packages/zip/10-remove-build-date.patch b/var/spack/repos/builtin/packages/zip/10-remove-build-date.patch new file mode 100644 index 0000000000..d7165cd01f --- /dev/null +++ b/var/spack/repos/builtin/packages/zip/10-remove-build-date.patch @@ -0,0 +1,15 @@ +From: Santiago Vila +Subject: Remove (optional) build date to make the build reproducible +Bug-Debian: http://bugs.debian.org/779042 + +--- a/unix/unix.c ++++ b/unix/unix.c +@@ -1020,7 +1020,7 @@ + + + /* Define the compile date string */ +-#ifdef __DATE__ ++#if 0 + # define COMPILE_DATE " on " __DATE__ + #else + # define COMPILE_DATE "" diff --git a/var/spack/repos/builtin/packages/zip/package.py b/var/spack/repos/builtin/packages/zip/package.py index 51cc012f43..a7ae19af67 100644 --- a/var/spack/repos/builtin/packages/zip/package.py +++ b/var/spack/repos/builtin/packages/zip/package.py @@ -3,25 +3,35 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * - class Zip(MakefilePackage): """Zip is a compression and file packaging/archive utility.""" - homepage = 'http://www.info-zip.org/Zip.html' - url = 'http://downloads.sourceforge.net/infozip/zip30.tar.gz' + homepage = 'https://www.info-zip.org/Zip.html' + url = 'https://downloads.sourceforge.net/infozip/zip30.tar.gz' version('3.0', sha256='f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369') depends_on('bzip2') + # Upstream is unmaintained, get patches from: + # https://deb.debian.org/debian/pool/main/z/zip/zip_3.0-11.debian.tar.xz + patch('01-typo-it-is-transferring-not-transfering.patch') + patch('02-typo-it-is-privileges-not-priviliges.patch') + patch('03-manpages-in-section-1-not-in-section-1l.patch') + patch('04-do-not-set-unwanted-cflags.patch') + patch('05-typo-it-is-preceding-not-preceeding.patch') + patch('06-stack-markings-to-avoid-executable-stack.patch') + patch('07-fclose-in-file-not-fclose-x.patch') + patch('08-hardening-build-fix-1.patch') + patch('09-hardening-build-fix-2.patch') + patch('10-remove-build-date.patch') + def url_for_version(self, version): return 'http://downloads.sourceforge.net/infozip/zip{0}.tar.gz'.format(version.joined) - make_args = ['-f', 'unix/Makefile'] - build_targets = make_args + ['generic'] + def build(self, spec, prefix): + make('-f', 'unix/Makefile', 'CC=' + spack_cc, 'generic') - @property - def install_targets(self): - return self.make_args + ['prefix={0}'.format(self.prefix), 'install'] + def install(self, spec, prefix): + make('-f', 'unix/Makefile', 'prefix=' + prefix, 'install') -- cgit v1.2.3-70-g09d2