public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2016-07-25 22:41 Matt Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Thode @ 2016-07-25 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     6793838e850e22d03a9c3cc33da21b919968f9e7
Author:     Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Sun Jul 24 16:57:03 2016 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 22:40:34 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6793838e

app-arch/p7zip: Drop kdelibs (R)DEPEND, sort DEPEND/IUSE, EAPI=6

kde-base/kdelibs:4 is not required here as p7zip only (manually) installs
a bunch of desktop files that may or may not be picked up by applications.
wxGTK[X] is already enforced by REQUIRED_USE, so there is no reason
to duplicate that.

Reversed symlink logic for ServiceMenu as kservices5 is here to stay and
kde4/services is deprecated.

Package-Manager: portage-2.2.28

Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 app-arch/p7zip/files/p7zip-16.02-darwin.patch      |  4 ++--
 .../{p7zip-16.02.ebuild => p7zip-16.02-r1.ebuild}  | 25 +++++++++++-----------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/app-arch/p7zip/files/p7zip-16.02-darwin.patch b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
index e7f40f5..1ee5d34 100644
--- a/app-arch/p7zip/files/p7zip-16.02-darwin.patch
+++ b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
@@ -1,5 +1,5 @@
---- p7zip_15.14.1/CPP/myWindows/StdAfx.h
-+++ p7zip_15.14.1/CPP/myWindows/StdAfx.h
+--- a/CPP/myWindows/StdAfx.h
++++ b/CPP/myWindows/StdAfx.h
 @@ -32,7 +32,7 @@
  #include <errno.h>
  #include <math.h>

diff --git a/app-arch/p7zip/p7zip-16.02.ebuild b/app-arch/p7zip/p7zip-16.02-r1.ebuild
similarity index 88%
rename from app-arch/p7zip/p7zip-16.02.ebuild
rename to app-arch/p7zip/p7zip-16.02-r1.ebuild
index c34eb86..dd37e65 100644
--- a/app-arch/p7zip/p7zip-16.02.ebuild
+++ b/app-arch/p7zip/p7zip-16.02-r1.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI=5
+EAPI=6
 
 WX_GTK_VER="3.0"
 
@@ -15,22 +15,24 @@ SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
 LICENSE="LGPL-2.1 rar? ( unRAR )"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
-IUSE="doc kde rar +pch static wxwidgets abi_x86_x32"
+IUSE="abi_x86_x32 doc kde +pch rar static wxwidgets"
 
 REQUIRED_USE="kde? ( wxwidgets )"
 
-RDEPEND="
-	kde? ( x11-libs/wxGTK:${WX_GTK_VER}[X] kde-base/kdelibs )
-	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+RDEPEND="wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
 DEPEND="${RDEPEND}
-	amd64? ( dev-lang/yasm )
 	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	amd64? ( dev-lang/yasm )
 	x86? ( dev-lang/nasm )"
 
 S=${WORKDIR}/${PN}_${PV}
 
+DOCS=( ChangeLog README TODO )
+
+PATCHES=( "${FILESDIR}"/${P}-darwin.patch )
+
 src_prepare() {
-	epatch "${FILESDIR}"/${P}-darwin.patch
+	default
 
 	if ! use pch; then
 		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
@@ -128,12 +130,12 @@ src_install() {
 
 		if use kde; then
 			rm GUI/kde4/p7zip_compress.desktop || die
-			insinto /usr/share/kde4/services/ServiceMenus
+			insinto /usr/share/kservices5/ServiceMenus
 			doins GUI/kde4/*.desktop
-			dodir /usr/share/kservices5/ServiceMenus
-			for item in "${D}"/usr/share/kde4/services/ServiceMenus/*.desktop; do
+			dodir /usr/share/kde4/services/ServiceMenus # drop these lines after konqueror:4/krusader:4 are gone
+			for item in "${ED}"usr/share/kservices5/ServiceMenus/*.desktop; do
 				item="$(basename ${item})"
-				dosym "/usr/share/kde4/services/ServiceMenus/${item}" "/usr/share/kservices5/ServiceMenus/${item}"
+				dosym "/usr/share/kservices5/ServiceMenus/${item}" "/usr/share/kde4/services/ServiceMenus/${item}"
 			done
 		fi
 	fi
@@ -150,7 +152,6 @@ src_install() {
 	fi
 
 	doman man1/7z.1 man1/7za.1 man1/7zr.1
-	dodoc ChangeLog README TODO
 
 	if use doc; then
 		dodoc DOC/*.txt


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2023-04-14 15:34 Matthew Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matthew Thode @ 2023-04-14 15:34 UTC (permalink / raw
  To: gentoo-commits

commit:     f30b488fc9b6821fe541da04652512331ee4012a
Author:     Joe Kappus <joe <AT> wt <DOT> gd>
AuthorDate: Fri Apr 14 11:52:25 2023 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Fri Apr 14 15:34:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f30b488f

app-arch/p7zip: add natspec support via useflag

Patch is from Arch:
https://aur.archlinux.org/cgit/aur.git/tree/natspec.patch?h=p7zip-natspec

Closes: https://bugs.gentoo.org/574900
Signed-off-by: Joe Kappus <joe <AT> wt.gd>
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 app-arch/p7zip/files/p7zip-17.05-natspec.patch | 130 +++++++++++++++++++++++++
 app-arch/p7zip/metadata.xml                    |   1 +
 app-arch/p7zip/p7zip-17.05-r1.ebuild           |   5 +-
 3 files changed, 135 insertions(+), 1 deletion(-)

diff --git a/app-arch/p7zip/files/p7zip-17.05-natspec.patch b/app-arch/p7zip/files/p7zip-17.05-natspec.patch
new file mode 100644
index 000000000000..45f24559a4c8
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip-17.05-natspec.patch
@@ -0,0 +1,130 @@
+commit f25f0b75bbeb485961dc139aed6b5b474552d043 (HEAD -> main)
+Author: Taiki Sugawara <buzz.taiki@gmail.com>
+Date:   Wed May 12 18:26:11 2021 +0900
+
+    natspec patch for p7zip 17.x
+
+diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp
+index 353e895..44071f3 100644
+--- a/CPP/7zip/Archive/Zip/ZipItem.cpp
++++ b/CPP/7zip/Archive/Zip/ZipItem.cpp
+@@ -1,9 +1,7 @@
+ // Archive/ZipItem.cpp
+ 
+-#if (!defined _WIN32) && (!defined __CYGWIN__) && (!defined __APPLE__)
+ #include <iconv.h>
+-#include <locale.h>
+-#endif
++#include <natspec.h>
+ 
+ #include "StdAfx.h"
+ 
+@@ -355,87 +353,15 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo
+     #endif
+   }
+   
+-  #if (!defined _WIN32) && (!defined __CYGWIN__) && (!defined __APPLE__)
+-  // Convert OEM char set to UTF-8 if needed
+-  // Use system locale to select code page
+-
+-  Byte hostOS = GetHostOS();
+-  if (!isUtf8 && ((hostOS == NFileHeader::NHostOS::kFAT) || (hostOS == NFileHeader::NHostOS::kNTFS))) {
+-
+-    const char *oemcp;
+-    oemcp = getenv("OEMCP");
+-    if (!oemcp) {
+-      oemcp = "CP437\0"; // CP name is 6 chars max
+-
+-      const char *lc_to_cp_table[] = {
+-      "af_ZA", "CP850", "ar_SA", "CP720", "ar_LB", "CP720", "ar_EG", "CP720",
+-      "ar_DZ", "CP720", "ar_BH", "CP720", "ar_IQ", "CP720", "ar_JO", "CP720",
+-      "ar_KW", "CP720", "ar_LY", "CP720", "ar_MA", "CP720", "ar_OM", "CP720",
+-      "ar_QA", "CP720", "ar_SY", "CP720", "ar_TN", "CP720", "ar_AE", "CP720",
+-      "ar_YE", "CP720","ast_ES", "CP850", "az_AZ", "CP866", "az_AZ", "CP857",
+-      "be_BY", "CP866", "bg_BG", "CP866", "br_FR", "CP850", "ca_ES", "CP850",
+-      "zh_CN", "CP936", "zh_TW", "CP950", "kw_GB", "CP850", "cs_CZ", "CP852",
+-      "cy_GB", "CP850", "da_DK", "CP850", "de_AT", "CP850", "de_LI", "CP850",
+-      "de_LU", "CP850", "de_CH", "CP850", "de_DE", "CP850", "el_GR", "CP737",
+-      "en_AU", "CP850", "en_CA", "CP850", "en_GB", "CP850", "en_IE", "CP850",
+-      "en_JM", "CP850", "en_BZ", "CP850", "en_PH", "CP437", "en_ZA", "CP437",
+-      "en_TT", "CP850", "en_US", "CP437", "en_ZW", "CP437", "en_NZ", "CP850",
+-      "es_PA", "CP850", "es_BO", "CP850", "es_CR", "CP850", "es_DO", "CP850",
+-      "es_SV", "CP850", "es_EC", "CP850", "es_GT", "CP850", "es_HN", "CP850",
+-      "es_NI", "CP850", "es_CL", "CP850", "es_MX", "CP850", "es_ES", "CP850",
+-      "es_CO", "CP850", "es_ES", "CP850", "es_PE", "CP850", "es_AR", "CP850",
+-      "es_PR", "CP850", "es_VE", "CP850", "es_UY", "CP850", "es_PY", "CP850",
+-      "et_EE", "CP775", "eu_ES", "CP850", "fa_IR", "CP720", "fi_FI", "CP850",
+-      "fo_FO", "CP850", "fr_FR", "CP850", "fr_BE", "CP850", "fr_CA", "CP850",
+-      "fr_LU", "CP850", "fr_MC", "CP850", "fr_CH", "CP850", "ga_IE", "CP437",
+-      "gd_GB", "CP850", "gv_IM", "CP850", "gl_ES", "CP850", "he_IL", "CP862",
+-      "hr_HR", "CP852", "hu_HU", "CP852", "id_ID", "CP850", "is_IS", "CP850",
+-      "it_IT", "CP850", "it_CH", "CP850", "iv_IV", "CP437", "ja_JP", "CP932",
+-      "kk_KZ", "CP866", "ko_KR", "CP949", "ky_KG", "CP866", "lt_LT", "CP775",
+-      "lv_LV", "CP775", "mk_MK", "CP866", "mn_MN", "CP866", "ms_BN", "CP850",
+-      "ms_MY", "CP850", "nl_BE", "CP850", "nl_NL", "CP850", "nl_SR", "CP850",
+-      "nn_NO", "CP850", "nb_NO", "CP850", "pl_PL", "CP852", "pt_BR", "CP850",
+-      "pt_PT", "CP850", "rm_CH", "CP850", "ro_RO", "CP852", "ru_RU", "CP866",
+-      "sk_SK", "CP852", "sl_SI", "CP852", "sq_AL", "CP852", "sr_RS", "CP855",
+-      "sr_RS", "CP852", "sv_SE", "CP850", "sv_FI", "CP850", "sw_KE", "CP437",
+-      "th_TH", "CP874", "tr_TR", "CP857", "tt_RU", "CP866", "uk_UA", "CP866",
+-      "ur_PK", "CP720", "uz_UZ", "CP866", "uz_UZ", "CP857", "vi_VN", "CP1258",
+-      "wa_BE", "CP850", "zh_HK", "CP950", "zh_SG", "CP936"};
+-      int table_len = sizeof(lc_to_cp_table) / sizeof(char *);
+-      int lc_len, i;
+-
+-      char *lc = setlocale(LC_CTYPE, "");
+-
+-      if (lc && lc[0]) {
+-          // Compare up to the dot, if it exists, e.g. en_US.UTF-8
+-          for (lc_len = 0; lc[lc_len] != '.' && lc[lc_len] != '\0'; ++lc_len)
+-              ;
+-          for (i = 0; i < table_len; i += 2)
+-              if (strncmp(lc, lc_to_cp_table[i], lc_len) == 0)
+-                  oemcp = lc_to_cp_table[i + 1];
+-      }
+-    }
+-
+-    iconv_t cd;
+-    if ((cd = iconv_open("UTF-8", oemcp)) != (iconv_t)-1) {
+-
+-      AString s_utf8;
+-      const char* src = s.Ptr();
+-      size_t slen = s.Len();
+-      size_t dlen = slen * 4;
+-      const char* dest = s_utf8.GetBuf_SetEnd(dlen + 1); // (source length * 4) + null termination
+-
+-      size_t done = iconv(cd, (char**)&src, &slen, (char**)&dest, &dlen);
+-      bzero((size_t*)dest + done, 1);
+-
+-      iconv_close(cd);
+-
+-      if (ConvertUTF8ToUnicode(s_utf8, res) || ignore_Utf8_Errors)
+-        return;
+-    }    
++  if (!isUtf8) {
++    const char *oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
++    char *p = natspec_convert(s.Ptr(), NULL, oem_charset, 0);
++    AString utf = p;
++    free(p);
++    if (ConvertUTF8ToUnicode(utf, res))
++      return;
+   }
+-  #endif
+-  
++
+   if (isUtf8)
+     if (ConvertUTF8ToUnicode(s, res) || ignore_Utf8_Errors)
+       return;
+diff --git a/makefile.machine b/makefile.machine
+index a89b568..3e12592 100644
+--- a/makefile.machine
++++ b/makefile.machine
+@@ -16,7 +16,7 @@ CC=gcc
+ CC_SHARED=-fPIC
+ LINK_SHARED=-fPIC -shared
+ 
+-LOCAL_LIBS=-lpthread
++LOCAL_LIBS=-lpthread -lnatspec
+ LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
+ 
+ OBJ_CRC32=$(OBJ_CRC32_C)

diff --git a/app-arch/p7zip/metadata.xml b/app-arch/p7zip/metadata.xml
index b936059d893c..6a21e35bb813 100644
--- a/app-arch/p7zip/metadata.xml
+++ b/app-arch/p7zip/metadata.xml
@@ -5,6 +5,7 @@
     <email>prometheanfire@gentoo.org</email>
   </maintainer>
   <use>
+    <flag name="natspec">Use <pkg>dev-libs/libnatspec</pkg> to correctly decode non-ascii file names archived in Windows.</flag>
     <flag name="rar">Enable support for non-free rar decoder</flag>
   </use>
   <upstream>

diff --git a/app-arch/p7zip/p7zip-17.05-r1.ebuild b/app-arch/p7zip/p7zip-17.05-r1.ebuild
index 8b320e470f1f..dbb6ca8a3567 100644
--- a/app-arch/p7zip/p7zip-17.05-r1.ebuild
+++ b/app-arch/p7zip/p7zip-17.05-r1.ebuild
@@ -13,8 +13,9 @@ SRC_URI="https://github.com/p7zip-project/p7zip/archive/v${PV}.tar.gz -> ${P}.ta
 LICENSE="LGPL-2.1 rar? ( unRAR )"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris"
-IUSE="abi_x86_x32 doc +pch rar static"
+IUSE="abi_x86_x32 doc natspec +pch rar static"
 
+RDEPEND="natspec? ( dev-libs/libnatspec )"
 DEPEND="${RDEPEND}"
 BDEPEND="
 	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
@@ -24,6 +25,8 @@ BDEPEND="
 src_prepare() {
 	default
 
+	use natspec && eapply "${FILESDIR}"/${P}-natspec.patch
+
 	if ! use pch; then
 		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
 	fi


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2020-01-23 17:18 Matthew Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matthew Thode @ 2020-01-23 17:18 UTC (permalink / raw
  To: gentoo-commits

commit:     011921ef714adf03acb30a5be54c3dd7b8b9e208
Author:     Denis Pronin <dannftk <AT> yandex <DOT> ru>
AuthorDate: Thu Jan 23 06:30:29 2020 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Thu Jan 23 17:09:29 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=011921ef

app-arch/p7zip: it is now possible to compile with clang and c++17

Signed-off-by: Denis Pronin <dannftk <AT> yandex.ru>
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 app-arch/p7zip/files/WimHandler.cpp.patch |  11 ++
 app-arch/p7zip/p7zip-16.02-r5.ebuild      | 167 ++++++++++++++++++++++++++++++
 2 files changed, 178 insertions(+)

diff --git a/app-arch/p7zip/files/WimHandler.cpp.patch b/app-arch/p7zip/files/WimHandler.cpp.patch
new file mode 100644
index 00000000000..db7d73a2b94
--- /dev/null
+++ b/app-arch/p7zip/files/WimHandler.cpp.patch
@@ -0,0 +1,11 @@
+--- ./CPP/7zip/Archive/Wim/WimHandler.cpp	2016-06-11 11:08:06.000000000 +0300
++++ ./CPP/7zip/Archive/Wim/WimHandler.cpp.new	2020-01-22 09:36:59.671803569 +0300
+@@ -298,7 +298,7 @@ STDMETHODIMP CHandler::GetArchivePropert
+ 
+       AString res;
+ 
+-      bool numMethods = 0;
++      int numMethods = 0;
+       for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++)
+       {
+         if (methodMask & ((UInt32)1 << i))

diff --git a/app-arch/p7zip/p7zip-16.02-r5.ebuild b/app-arch/p7zip/p7zip-16.02-r5.ebuild
new file mode 100644
index 00000000000..4c56f6b4da6
--- /dev/null
+++ b/app-arch/p7zip/p7zip-16.02-r5.ebuild
@@ -0,0 +1,167 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+WX_GTK_VER="3.0"
+
+inherit toolchain-funcs wxwidgets
+
+DESCRIPTION="Port of 7-Zip archiver for Unix"
+HOMEPAGE="http://p7zip.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
+
+LICENSE="LGPL-2.1 rar? ( unRAR )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="abi_x86_x32 doc kde +pch rar static wxwidgets"
+
+REQUIRED_USE="kde? ( wxwidgets )"
+
+RDEPEND="wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+DEPEND="${RDEPEND}
+	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	amd64? ( dev-lang/yasm )
+	x86? ( dev-lang/nasm )"
+
+S=${WORKDIR}/${PN}_${PV}
+
+DOCS=( ChangeLog README TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${P}-darwin.patch
+	"${FILESDIR}"/CVE-2016-9296.patch
+	"${FILESDIR}"/CVE-2017-17969.patch
+	"${FILESDIR}"/CVE-2018-5996.patch
+	"${FILESDIR}"/CVE-2018-10115.patch
+	"${FILESDIR}"/WimHandler.cpp.patch
+)
+
+src_prepare() {
+	default
+
+	if ! use pch; then
+		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
+	fi
+
+	sed \
+		-e 's|-m32 ||g' \
+		-e 's|-m64 ||g' \
+		-e 's|-pipe||g' \
+		-e "/[ALL|OPT]FLAGS/s|-s||;/OPTIMIZE/s|-s||" \
+		-e "/CFLAGS=/s|=|+=|" \
+		-e "/CXXFLAGS=/s|=|+=|" \
+		-i makefile* || die
+
+	# remove non-free RAR codec
+	if use rar; then
+		ewarn "Enabling nonfree RAR decompressor"
+	else
+		sed \
+			-e '/Rar/d' \
+			-e '/RAR/d' \
+			-i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
+		rm -rf CPP/7zip/Compress/Rar || die
+	fi
+
+	if use abi_x86_x32; then
+		sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use amd64; then
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use x86; then
+		cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
+	elif [[ ${CHOST} == *-darwin* ]] ; then
+		# Mac OS X needs this special makefile, because it has a non-GNU
+		# linker, it doesn't matter so much for bitwidth, for it doesn't
+		# do anything with it
+		cp -f makefile.macosx_llvm_64bits makefile.machine
+		# bundles have extension .bundle but don't die because USE=-rar
+		# removes the Rar directory
+		sed -i -e '/strcpy(name/s/\.so/.bundle/' \
+			CPP/Windows/DLL.cpp || die
+		sed -i -e '/^PROG=/s/\.so/.bundle/' \
+			CPP/7zip/Bundles/Format7zFree/makefile.list \
+			$(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
+	elif use x86-fbsd; then
+		# FreeBSD needs this special makefile, because it hasn't -ldl
+		sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
+	fi
+
+	if use static; then
+		sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
+	fi
+
+	if use kde || use wxwidgets; then
+		need-wxwidgets unicode
+		einfo "Preparing dependency list"
+		emake CC=$(tc-getCC) CXX=$(tc-getCXX) depend
+	fi
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
+	if use kde || use wxwidgets; then
+		emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
+#		emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zFM
+	fi
+}
+
+src_test() {
+	emake test test_7z test_7zr
+}
+
+src_install() {
+	# this wrappers can not be symlinks, p7zip should be called with full path
+	make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
+	make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
+	make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
+
+	if use kde || use wxwidgets; then
+		make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
+#		make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
+
+#		make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
+
+		dobin GUI/p7zipForFilemanager
+		exeinto /usr/$(get_libdir)/${PN}
+#		doexe bin/7z{G,FM}
+		doexe bin/7zG
+
+		insinto /usr/$(get_libdir)/${PN}
+		doins -r GUI/Lang
+		doins -r DOC/MANUAL
+
+		insinto /usr/share/icons/hicolor/16x16/apps/
+		newins GUI/p7zip_16_ok.png p7zip.png
+
+		if use kde; then
+			rm GUI/kde4/p7zip_compress.desktop || die
+			insinto /usr/share/kservices5/ServiceMenus
+			doins GUI/kde4/*.desktop
+			dodir /usr/share/kde4/services/ServiceMenus # drop these lines after konqueror:4/krusader:4 are gone
+			for item in "${ED}"usr/share/kservices5/ServiceMenus/*.desktop; do
+				item="$(basename ${item})"
+				dosym "/usr/share/kservices5/ServiceMenus/${item}" "/usr/share/kde4/services/ServiceMenus/${item}"
+			done
+		fi
+	fi
+
+	dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
+	doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
+
+	exeinto /usr/$(get_libdir)/${PN}
+	doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
+	doexe bin/*$(get_modname)
+	if use rar; then
+		exeinto /usr/$(get_libdir)/${PN}/Codecs/
+		doexe bin/Codecs/*$(get_modname)
+	fi
+
+	doman man1/7z.1 man1/7za.1 man1/7zr.1
+
+	if use doc; then
+		dodoc DOC/*.txt
+		dohtml -r DOC/MANUAL/*
+	fi
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2018-06-28 19:07 Matt Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Thode @ 2018-06-28 19:07 UTC (permalink / raw
  To: gentoo-commits

commit:     2b160b9fd86e68ee72f39ce96db2e0c7de72e5f7
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 28 19:06:34 2018 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Thu Jun 28 19:07:04 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b160b9f

app-arch/p7zip: add fix for CVE-2018-10115

Bug: https://bugs.gentoo.org/655270
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 app-arch/p7zip/files/CVE-2018-10115.patch | 311 ++++++++++++++++++++++++++++++
 app-arch/p7zip/p7zip-16.02-r4.ebuild      | 165 ++++++++++++++++
 2 files changed, 476 insertions(+)

diff --git a/app-arch/p7zip/files/CVE-2018-10115.patch b/app-arch/p7zip/files/CVE-2018-10115.patch
new file mode 100644
index 00000000000..7d9c4bf81f0
--- /dev/null
+++ b/app-arch/p7zip/files/CVE-2018-10115.patch
@@ -0,0 +1,311 @@
+From: Robert Luberda <robert@debian.org>
+Date: Tue, 29 May 2018 23:59:09 +0200
+Subject: Fix CVE-2018-10115
+
+Apply "patch" taken from https://landave.io/files/patch_7zip_CVE-2018-10115.txt
+
+
+Bugs-Debian: https://bugs.debian.org/897674
+---
+ CPP/7zip/Compress/Rar1Decoder.cpp | 16 +++++++++++-----
+ CPP/7zip/Compress/Rar1Decoder.h   |  3 ++-
+ CPP/7zip/Compress/Rar2Decoder.cpp | 17 +++++++++++++----
+ CPP/7zip/Compress/Rar2Decoder.h   |  3 ++-
+ CPP/7zip/Compress/Rar3Decoder.cpp | 19 +++++++++++++++----
+ CPP/7zip/Compress/Rar3Decoder.h   |  3 ++-
+ CPP/7zip/Compress/Rar5Decoder.cpp |  8 ++++++++
+ CPP/7zip/Compress/Rar5Decoder.h   |  1 +
+ 8 files changed, 54 insertions(+), 16 deletions(-)
+
+diff --git a/CPP/7zip/Compress/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar1Decoder.cpp
+index 68030c7..8c890c8 100644
+--- a/CPP/7zip/Compress/Rar1Decoder.cpp
++++ b/CPP/7zip/Compress/Rar1Decoder.cpp
+@@ -29,7 +29,7 @@ public:
+ };
+ */
+ 
+-CDecoder::CDecoder(): m_IsSolid(false), _errorMode(false) { }
++CDecoder::CDecoder(): _isSolid(false), _solidAllowed(false), _errorMode(false) { }
+ 
+ void CDecoder::InitStructures()
+ {
+@@ -345,7 +345,7 @@ void CDecoder::GetFlagsBuf()
+ 
+ void CDecoder::InitData()
+ {
+-  if (!m_IsSolid)
++  if (!_isSolid)
+   {
+     AvrPlcB = AvrLn1 = AvrLn2 = AvrLn3 = NumHuf = Buf60 = 0;
+     AvrPlc = 0x3500;
+@@ -391,6 +391,11 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+   if (inSize == NULL || outSize == NULL)
+     return E_INVALIDARG;
+ 
++  if (_isSolid && !_solidAllowed)
++    return S_FALSE;
++
++  _solidAllowed = false;
++
+   if (!m_OutWindowStream.Create(kHistorySize))
+     return E_OUTOFMEMORY;
+   if (!m_InBitStream.Create(1 << 20))
+@@ -398,13 +403,13 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+ 
+   m_UnpackSize = (Int64)*outSize;
+   m_OutWindowStream.SetStream(outStream);
+-  m_OutWindowStream.Init(m_IsSolid);
++  m_OutWindowStream.Init(_isSolid);
+   m_InBitStream.SetStream(inStream);
+   m_InBitStream.Init();
+ 
+   // CCoderReleaser coderReleaser(this);
+   InitData();
+-  if (!m_IsSolid)
++  if (!_isSolid)
+   {
+     _errorMode = false;
+     InitStructures();
+@@ -475,6 +480,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+   }
+   if (m_UnpackSize < 0)
+     return S_FALSE;
++  _solidAllowed = true;
+   return m_OutWindowStream.Flush();
+ }
+ 
+@@ -491,7 +497,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
+ {
+   if (size < 1)
+     return E_INVALIDARG;
+-  m_IsSolid = ((data[0] & 1) != 0);
++  _isSolid = ((data[0] & 1) != 0);
+   return S_OK;
+ }
+ 
+diff --git a/CPP/7zip/Compress/Rar1Decoder.h b/CPP/7zip/Compress/Rar1Decoder.h
+index 01b606b..8abb3a3 100644
+--- a/CPP/7zip/Compress/Rar1Decoder.h
++++ b/CPP/7zip/Compress/Rar1Decoder.h
+@@ -38,7 +38,8 @@ public:
+   UInt32 LastLength;
+ 
+   Int64 m_UnpackSize;
+-  bool m_IsSolid;
++  bool _isSolid;
++  bool _solidAllowed;
+   bool _errorMode;
+ 
+   UInt32 ReadBits(int numBits);
+diff --git a/CPP/7zip/Compress/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp
+index 0580c8d..be8d842 100644
+--- a/CPP/7zip/Compress/Rar2Decoder.cpp
++++ b/CPP/7zip/Compress/Rar2Decoder.cpp
+@@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20;
+ static const UInt32 kWindowReservSize = (1 << 22) + 256;
+ 
+ CDecoder::CDecoder():
+-  m_IsSolid(false),
++  _isSolid(false),
++  _solidAllowed(false),
+   m_TablesOK(false)
+ {
+ }
+@@ -320,6 +321,10 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+   if (inSize == NULL || outSize == NULL)
+     return E_INVALIDARG;
+ 
++  if (_isSolid && !_solidAllowed)
++    return S_FALSE;
++  _solidAllowed = false;
++
+   if (!m_OutWindowStream.Create(kHistorySize))
+     return E_OUTOFMEMORY;
+   if (!m_InBitStream.Create(1 << 20))
+@@ -330,12 +335,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+   UInt64 pos = 0, unPackSize = *outSize;
+   
+   m_OutWindowStream.SetStream(outStream);
+-  m_OutWindowStream.Init(m_IsSolid);
++  m_OutWindowStream.Init(_isSolid);
+   m_InBitStream.SetStream(inStream);
+   m_InBitStream.Init();
+ 
+   // CCoderReleaser coderReleaser(this);
+-  if (!m_IsSolid)
++  if (!_isSolid)
+   {
+     InitStructures();
+     if (unPackSize == 0)
+@@ -343,6 +348,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+       if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect;
+         if (!ReadTables())
+           return S_FALSE;
++      _solidAllowed = true;
+       return S_OK;
+     }
+     if (!ReadTables())
+@@ -386,6 +392,9 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+ 
+   if (!ReadLastTables())
+     return S_FALSE;
++
++  _solidAllowed = true;
++
+   return m_OutWindowStream.Flush();
+ }
+ 
+@@ -402,7 +411,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
+ {
+   if (size < 1)
+     return E_INVALIDARG;
+-  m_IsSolid = ((data[0] & 1) != 0);
++  _isSolid = ((data[0] & 1) != 0);
+   return S_OK;
+ }
+ 
+diff --git a/CPP/7zip/Compress/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h
+index 0e9005f..370bce2 100644
+--- a/CPP/7zip/Compress/Rar2Decoder.h
++++ b/CPP/7zip/Compress/Rar2Decoder.h
+@@ -138,7 +138,8 @@ class CDecoder :
+   Byte m_LastLevels[kMaxTableSize];
+ 
+   UInt64 m_PackSize;
+-  bool m_IsSolid;
++  bool _isSolid;
++  bool _solidAllowed;
+   bool m_TablesOK;
+ 
+   void InitStructures();
+diff --git a/CPP/7zip/Compress/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar3Decoder.cpp
+index 6cb8a6a..7b85833 100644
+--- a/CPP/7zip/Compress/Rar3Decoder.cpp
++++ b/CPP/7zip/Compress/Rar3Decoder.cpp
+@@ -92,7 +92,8 @@ CDecoder::CDecoder():
+   _writtenFileSize(0),
+   _vmData(0),
+   _vmCode(0),
+-  m_IsSolid(false),
++  _isSolid(false),
++  _solidAllowed(false),
+   _errorMode(false)
+ {
+   Ppmd7_Construct(&_ppmd);
+@@ -821,7 +822,7 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
+ {
+   _writtenFileSize = 0;
+   _unsupportedFilter = false;
+-  if (!m_IsSolid)
++  if (!_isSolid)
+   {
+     _lzSize = 0;
+     _winPos = 0;
+@@ -840,12 +841,15 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
+   if (_errorMode)
+     return S_FALSE;
+ 
+-  if (!m_IsSolid || !TablesRead)
++  if (!_isSolid || !TablesRead)
+   {
+     bool keepDecompressing;
+     RINOK(ReadTables(keepDecompressing));
+     if (!keepDecompressing)
++    {
++      _solidAllowed = true;
+       return S_OK;
++    }
+   }
+ 
+   for (;;)
+@@ -870,6 +874,9 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
+     if (!keepDecompressing)
+       break;
+   }
++
++  _solidAllowed = true;
++
+   RINOK(WriteBuf());
+   UInt64 packSize = m_InBitStream.BitDecoder.GetProcessedSize();
+   RINOK(progress->SetRatioInfo(&packSize, &_writtenFileSize));
+@@ -890,6 +897,10 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
+     if (!inSize)
+       return E_INVALIDARG;
+ 
++    if (_isSolid && !_solidAllowed)
++      return S_FALSE;
++    _solidAllowed = false;
++
+     if (!_vmData)
+     {
+       _vmData = (Byte *)::MidAlloc(kVmDataSizeMax + kVmCodeSizeMax);
+@@ -928,7 +939,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
+ {
+   if (size < 1)
+     return E_INVALIDARG;
+-  m_IsSolid = ((data[0] & 1) != 0);
++  _isSolid = ((data[0] & 1) != 0);
+   return S_OK;
+ }
+ 
+diff --git a/CPP/7zip/Compress/Rar3Decoder.h b/CPP/7zip/Compress/Rar3Decoder.h
+index 2f72d7d..32c8943 100644
+--- a/CPP/7zip/Compress/Rar3Decoder.h
++++ b/CPP/7zip/Compress/Rar3Decoder.h
+@@ -191,7 +191,8 @@ class CDecoder:
+   CRecordVector<CTempFilter *>  _tempFilters;
+   UInt32 _lastFilter;
+ 
+-  bool m_IsSolid;
++  bool _isSolid;
++  bool _solidAllowed;
+   bool _errorMode;
+ 
+   bool _lzMode;
+diff --git a/CPP/7zip/Compress/Rar5Decoder.cpp b/CPP/7zip/Compress/Rar5Decoder.cpp
+index dc8830f..a826d5a 100644
+--- a/CPP/7zip/Compress/Rar5Decoder.cpp
++++ b/CPP/7zip/Compress/Rar5Decoder.cpp
+@@ -72,6 +72,7 @@ CDecoder::CDecoder():
+     _writtenFileSize(0),
+     _dictSizeLog(0),
+     _isSolid(false),
++    _solidAllowed(false),
+     _wasInit(false),
+     _inputBuf(NULL)
+ {
+@@ -801,7 +802,10 @@ HRESULT CDecoder::CodeReal()
+   */
+ 
+   if (res == S_OK)
++  {
++    _solidAllowed = true;
+     res = res2;
++  }
+      
+   if (res == S_OK && _unpackSize_Defined && _writtenFileSize != _unpackSize)
+     return S_FALSE;
+@@ -821,6 +825,10 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
+ {
+   try
+   {
++    if (_isSolid && !_solidAllowed)
++      return S_FALSE;
++    _solidAllowed = false;
++
+     if (_dictSizeLog >= sizeof(size_t) * 8)
+       return E_NOTIMPL;
+ 
+diff --git a/CPP/7zip/Compress/Rar5Decoder.h b/CPP/7zip/Compress/Rar5Decoder.h
+index b0a4dd1..3db5018 100644
+--- a/CPP/7zip/Compress/Rar5Decoder.h
++++ b/CPP/7zip/Compress/Rar5Decoder.h
+@@ -271,6 +271,7 @@ class CDecoder:
+   Byte _dictSizeLog;
+   bool _tableWasFilled;
+   bool _isSolid;
++  bool _solidAllowed;
+   bool _wasInit;
+ 
+   UInt32 _reps[kNumReps];

diff --git a/app-arch/p7zip/p7zip-16.02-r4.ebuild b/app-arch/p7zip/p7zip-16.02-r4.ebuild
new file mode 100644
index 00000000000..57134020e70
--- /dev/null
+++ b/app-arch/p7zip/p7zip-16.02-r4.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+WX_GTK_VER="3.0"
+
+inherit toolchain-funcs wxwidgets
+
+DESCRIPTION="Port of 7-Zip archiver for Unix"
+HOMEPAGE="http://p7zip.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
+
+LICENSE="LGPL-2.1 rar? ( unRAR )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="abi_x86_x32 doc kde +pch rar static wxwidgets"
+
+REQUIRED_USE="kde? ( wxwidgets )"
+
+RDEPEND="wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+DEPEND="${RDEPEND}
+	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	amd64? ( dev-lang/yasm )
+	x86? ( dev-lang/nasm )"
+
+S=${WORKDIR}/${PN}_${PV}
+
+DOCS=( ChangeLog README TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${P}-darwin.patch
+	"${FILESDIR}"/CVE-2016-9296.patch
+	"${FILESDIR}"/CVE-2017-17969.patch
+	"${FILESDIR}"/CVE-2018-5996.patch
+	"${FILESDIR}"/CVE-2018-10115.patch
+)
+
+src_prepare() {
+	default
+
+	if ! use pch; then
+		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
+	fi
+
+	sed \
+		-e 's:-m32 ::g' \
+		-e 's:-m64 ::g' \
+		-e 's:-pipe::g' \
+		-e '/ALLFLAGS/s:-s ::' \
+		-e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
+		-i makefile* || die
+
+	# remove non-free RAR codec
+	if use rar; then
+		ewarn "Enabling nonfree RAR decompressor"
+	else
+		sed \
+			-e '/Rar/d' \
+			-e '/RAR/d' \
+			-i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
+		rm -rf CPP/7zip/Compress/Rar || die
+	fi
+
+	if use abi_x86_x32; then
+		sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use amd64; then
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use x86; then
+		cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
+	elif [[ ${CHOST} == *-darwin* ]] ; then
+		# Mac OS X needs this special makefile, because it has a non-GNU
+		# linker, it doesn't matter so much for bitwidth, for it doesn't
+		# do anything with it
+		cp -f makefile.macosx_llvm_64bits makefile.machine
+		# bundles have extension .bundle but don't die because USE=-rar
+		# removes the Rar directory
+		sed -i -e '/strcpy(name/s/\.so/.bundle/' \
+			CPP/Windows/DLL.cpp || die
+		sed -i -e '/^PROG=/s/\.so/.bundle/' \
+			CPP/7zip/Bundles/Format7zFree/makefile.list \
+			$(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
+	elif use x86-fbsd; then
+		# FreeBSD needs this special makefile, because it hasn't -ldl
+		sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
+	fi
+
+	if use static; then
+		sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
+	fi
+
+	if use kde || use wxwidgets; then
+		need-wxwidgets unicode
+		einfo "Preparing dependency list"
+		emake depend
+	fi
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
+	if use kde || use wxwidgets; then
+		emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
+#		emake -- 7zFM
+	fi
+}
+
+src_test() {
+	emake test test_7z test_7zr
+}
+
+src_install() {
+	# this wrappers can not be symlinks, p7zip should be called with full path
+	make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
+	make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
+	make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
+
+	if use kde || use wxwidgets; then
+		make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
+#		make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
+
+#		make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
+
+		dobin GUI/p7zipForFilemanager
+		exeinto /usr/$(get_libdir)/${PN}
+#		doexe bin/7z{G,FM}
+		doexe bin/7zG
+
+		insinto /usr/$(get_libdir)/${PN}
+		doins -r GUI/Lang
+		doins -r DOC/MANUAL
+
+		insinto /usr/share/icons/hicolor/16x16/apps/
+		newins GUI/p7zip_16_ok.png p7zip.png
+
+		if use kde; then
+			rm GUI/kde4/p7zip_compress.desktop || die
+			insinto /usr/share/kservices5/ServiceMenus
+			doins GUI/kde4/*.desktop
+			dodir /usr/share/kde4/services/ServiceMenus # drop these lines after konqueror:4/krusader:4 are gone
+			for item in "${ED}"usr/share/kservices5/ServiceMenus/*.desktop; do
+				item="$(basename ${item})"
+				dosym "/usr/share/kservices5/ServiceMenus/${item}" "/usr/share/kde4/services/ServiceMenus/${item}"
+			done
+		fi
+	fi
+
+	dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
+	doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
+
+	exeinto /usr/$(get_libdir)/${PN}
+	doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
+	doexe bin/*$(get_modname)
+	if use rar; then
+		exeinto /usr/$(get_libdir)/${PN}/Codecs/
+		doexe bin/Codecs/*$(get_modname)
+	fi
+
+	doman man1/7z.1 man1/7za.1 man1/7zr.1
+
+	if use doc; then
+		dodoc DOC/*.txt
+		dohtml -r DOC/MANUAL/*
+	fi
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2018-05-08 16:55 Matt Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Thode @ 2018-05-08 16:55 UTC (permalink / raw
  To: gentoo-commits

commit:     1ec1595e6328e5f68dd1ce669e2841e052360c55
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Tue May  8 16:54:37 2018 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Tue May  8 16:55:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ec1595e

app-arch/p7zip: adding 2016 cve

Package-Manager: Portage-2.3.27, Repoman-2.3.9

 app-arch/p7zip/files/CVE-2016-9296.patch |  12 +++
 app-arch/p7zip/p7zip-16.02-r3.ebuild     | 164 +++++++++++++++++++++++++++++++
 2 files changed, 176 insertions(+)

diff --git a/app-arch/p7zip/files/CVE-2016-9296.patch b/app-arch/p7zip/files/CVE-2016-9296.patch
new file mode 100644
index 00000000000..773f92a46e0
--- /dev/null
+++ b/app-arch/p7zip/files/CVE-2016-9296.patch
@@ -0,0 +1,12 @@
+--- ./CPP/7zip/Archive/7z/7zIn.cpp.orig	2016-11-21 01:42:29.460901230 +0000
++++ ./CPP/7zip/Archive/7z/7zIn.cpp	2016-11-21 01:42:57.481197725 +0000
+@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedS
+       if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
+         ThrowIncorrect();
+   }
+-  HeadersSize += folders.PackPositions[folders.NumPackStreams];
++  if (folders.PackPositions)
++      HeadersSize += folders.PackPositions[folders.NumPackStreams];
+   return S_OK;
+ }
+ 

diff --git a/app-arch/p7zip/p7zip-16.02-r3.ebuild b/app-arch/p7zip/p7zip-16.02-r3.ebuild
new file mode 100644
index 00000000000..394b319ac40
--- /dev/null
+++ b/app-arch/p7zip/p7zip-16.02-r3.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+WX_GTK_VER="3.0"
+
+inherit toolchain-funcs wxwidgets
+
+DESCRIPTION="Port of 7-Zip archiver for Unix"
+HOMEPAGE="http://p7zip.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
+
+LICENSE="LGPL-2.1 rar? ( unRAR )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="abi_x86_x32 doc kde +pch rar static wxwidgets"
+
+REQUIRED_USE="kde? ( wxwidgets )"
+
+RDEPEND="wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+DEPEND="${RDEPEND}
+	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	amd64? ( dev-lang/yasm )
+	x86? ( dev-lang/nasm )"
+
+S=${WORKDIR}/${PN}_${PV}
+
+DOCS=( ChangeLog README TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${P}-darwin.patch
+	"${FILESDIR}"/CVE-2016-9296.patch
+	"${FILESDIR}"/CVE-2017-17969.patch
+	"${FILESDIR}"/CVE-2018-5996.patch
+)
+
+src_prepare() {
+	default
+
+	if ! use pch; then
+		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
+	fi
+
+	sed \
+		-e 's:-m32 ::g' \
+		-e 's:-m64 ::g' \
+		-e 's:-pipe::g' \
+		-e '/ALLFLAGS/s:-s ::' \
+		-e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
+		-i makefile* || die
+
+	# remove non-free RAR codec
+	if use rar; then
+		ewarn "Enabling nonfree RAR decompressor"
+	else
+		sed \
+			-e '/Rar/d' \
+			-e '/RAR/d' \
+			-i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
+		rm -rf CPP/7zip/Compress/Rar || die
+	fi
+
+	if use abi_x86_x32; then
+		sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use amd64; then
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use x86; then
+		cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
+	elif [[ ${CHOST} == *-darwin* ]] ; then
+		# Mac OS X needs this special makefile, because it has a non-GNU
+		# linker, it doesn't matter so much for bitwidth, for it doesn't
+		# do anything with it
+		cp -f makefile.macosx_llvm_64bits makefile.machine
+		# bundles have extension .bundle but don't die because USE=-rar
+		# removes the Rar directory
+		sed -i -e '/strcpy(name/s/\.so/.bundle/' \
+			CPP/Windows/DLL.cpp || die
+		sed -i -e '/^PROG=/s/\.so/.bundle/' \
+			CPP/7zip/Bundles/Format7zFree/makefile.list \
+			$(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
+	elif use x86-fbsd; then
+		# FreeBSD needs this special makefile, because it hasn't -ldl
+		sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
+	fi
+
+	if use static; then
+		sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
+	fi
+
+	if use kde || use wxwidgets; then
+		need-wxwidgets unicode
+		einfo "Preparing dependency list"
+		emake depend
+	fi
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
+	if use kde || use wxwidgets; then
+		emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
+#		emake -- 7zFM
+	fi
+}
+
+src_test() {
+	emake test test_7z test_7zr
+}
+
+src_install() {
+	# this wrappers can not be symlinks, p7zip should be called with full path
+	make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
+	make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
+	make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
+
+	if use kde || use wxwidgets; then
+		make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
+#		make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
+
+#		make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
+
+		dobin GUI/p7zipForFilemanager
+		exeinto /usr/$(get_libdir)/${PN}
+#		doexe bin/7z{G,FM}
+		doexe bin/7zG
+
+		insinto /usr/$(get_libdir)/${PN}
+		doins -r GUI/Lang
+		doins -r DOC/MANUAL
+
+		insinto /usr/share/icons/hicolor/16x16/apps/
+		newins GUI/p7zip_16_ok.png p7zip.png
+
+		if use kde; then
+			rm GUI/kde4/p7zip_compress.desktop || die
+			insinto /usr/share/kservices5/ServiceMenus
+			doins GUI/kde4/*.desktop
+			dodir /usr/share/kde4/services/ServiceMenus # drop these lines after konqueror:4/krusader:4 are gone
+			for item in "${ED}"usr/share/kservices5/ServiceMenus/*.desktop; do
+				item="$(basename ${item})"
+				dosym "/usr/share/kservices5/ServiceMenus/${item}" "/usr/share/kde4/services/ServiceMenus/${item}"
+			done
+		fi
+	fi
+
+	dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
+	doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
+
+	exeinto /usr/$(get_libdir)/${PN}
+	doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
+	doexe bin/*$(get_modname)
+	if use rar; then
+		exeinto /usr/$(get_libdir)/${PN}/Codecs/
+		doexe bin/Codecs/*$(get_modname)
+	fi
+
+	doman man1/7z.1 man1/7za.1 man1/7zr.1
+
+	if use doc; then
+		dodoc DOC/*.txt
+		dohtml -r DOC/MANUAL/*
+	fi
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2016-07-15  2:32 Matt Thode
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Thode @ 2016-07-15  2:32 UTC (permalink / raw
  To: gentoo-commits

commit:     98be5eb1827845a1551e998392c603e692815ccc
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 02:32:05 2016 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 02:32:05 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98be5eb1

app-arch/p7zip: bup for bug 582832

Package-Manager: portage-2.2.28

 app-arch/p7zip/Manifest                       |   1 +
 app-arch/p7zip/files/p7zip-16.02-darwin.patch |  11 ++
 app-arch/p7zip/p7zip-16.02.ebuild             | 158 ++++++++++++++++++++++++++
 3 files changed, 170 insertions(+)

diff --git a/app-arch/p7zip/Manifest b/app-arch/p7zip/Manifest
index 7f85deb..fb57004 100644
--- a/app-arch/p7zip/Manifest
+++ b/app-arch/p7zip/Manifest
@@ -1,5 +1,6 @@
 DIST p7zip_15.09_src_all.tar.bz2 4048481 SHA256 8783acf747e210e00150f7311cc06c4cd8ecf7b0c27b4adf2194284cc49b4d6f SHA512 4f020b13632ef7a85aa8a98586b59bef2dde3c1cbebdbd17e01f1d09b2e13a56ecfe82546d7efc677c45df67456a71cfdb67826b53ebea4c0fb4878f20c2f6dd WHIRLPOOL 71d1cdb9b3b1208197b2c056670d057b00e9a5f80cf08b5914b5d25f2f6756d4cb53e5a000ec76b7b879f82302fca6d012a2cd397e8aa95ae4fc21fd620eb1ab
 DIST p7zip_15.14.1_src_all.tar.bz2 4147911 SHA256 699db4da3621904113e040703220abb1148dfef477b55305e2f14a4f1f8f25d4 SHA512 30d0ef47bd6938cdd5d9d80ec6e7aed972655686a43adb0ae34bb9856ec7cd5a68a05c580352021055cefd6eeceb134ff6402f93686ce46e57f9757798e76abd WHIRLPOOL ace6204d3ab08002b6d5657ae280e22b7e26cdfe0af8099024ad8562a68aa5097a8f09d9d49904a06b9a6942d30fbf3d7a3872661433dd4f76c33dea03ccfb6a
 DIST p7zip_15.14_src_all.tar.bz2 4147609 SHA256 b9b77450e98859454d39002f55ddc95a0705041ebc0a9bb49733ce2d9a7292d8 SHA512 3053647cbcb3b8efd7f41b6bc122e984b999d31720f9b22387c52ccfe8a71d73899b1fb3a269854fd43bc1ca656c7d53457aca1cb5e2c90a2d0fb8f084bdebc5 WHIRLPOOL 52a397e4ea15cdd4c68156a0c32d449be78469d5704e0d4bb644a813b583422b3d7b0741284974ca22d9ea99a303dfadeccc23d74a77cac0c9b51153bd61e24b
+DIST p7zip_16.02_src_all.tar.bz2 4239909 SHA256 5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f SHA512 d2c4d53817f96bb4c7683f42045198d4cd509cfc9c3e2cb85c8d9dc4ab6dfa7496449edeac4e300ecf986a9cbbc90bd8f8feef8156895d94617c04e507add55f WHIRLPOOL b22f4dce96505094ffdee0963fa7e5fd75e92f2c920f2e69e18eff60a2ad9d4757c3512c8d4e7c4848a36212f54637a963ff41fc5c00bb7381f43220662108b9
 DIST p7zip_9.20.1_src_all.tar.bz2 3835235 SHA256 49557e7ffca08100f9fc687f4dfc5aea703ca207640c76d9dee7b66f03cb4782 SHA512 7bb8a276aaefc4a83364e45633c48527de44c6b1205344f3356db570582f30f81d82a94938c99a7ad193587b584cc1c03219c28249de40018bdaee6c3b2a022a WHIRLPOOL cb20f37d3f796931a9b330728aa7148afe98bbf8a49bb91bfd80e4667c16416206b23bf34298e9ec37825e8b43f92a5710f0cea1f974296d5c17aa2c7b0931f3
 DIST p7zip_9.38.1_src_all.tar.bz2 3917925 SHA256 fd5019109c9a1bf34ad3257d37a6853eae8151ff50345f0a3ffba7d8c5fdb995 SHA512 f524ffae54e0d9563a509cc4b243e830d882a925e682eb2e15e2d19cb72c947fddecd72c8507d6c1538b997b240b0827046fc2fb4f5e3f7d49840257c92b9c04 WHIRLPOOL 6bad1cde056ab1e8db4079c0e649665fbc7e6b9a565261188bd0acaec6c583d8bd9425cb26d39315408d0180ba0be0069a77b704633cf05ec855220cb31f1c24

diff --git a/app-arch/p7zip/files/p7zip-16.02-darwin.patch b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
new file mode 100644
index 0000000..e7f40f5
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
@@ -0,0 +1,11 @@
+--- p7zip_15.14.1/CPP/myWindows/StdAfx.h
++++ p7zip_15.14.1/CPP/myWindows/StdAfx.h
+@@ -32,7 +32,7 @@
+ #include <errno.h>
+ #include <math.h>
+ 
+-#ifdef __NETWARE__
++#if defined(__NETWARE__) || defined(__MACH__)
+ #include <sys/types.h>
+ #endif
+ 

diff --git a/app-arch/p7zip/p7zip-16.02.ebuild b/app-arch/p7zip/p7zip-16.02.ebuild
new file mode 100644
index 0000000..a2efa29
--- /dev/null
+++ b/app-arch/p7zip/p7zip-16.02.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="3.0"
+
+inherit eutils multilib toolchain-funcs wxwidgets
+
+DESCRIPTION="Port of 7-Zip archiver for Unix"
+HOMEPAGE="http://p7zip.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
+
+LICENSE="LGPL-2.1 rar? ( unRAR )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="doc kde rar +pch static wxwidgets abi_x86_x32"
+
+REQUIRED_USE="kde? ( wxwidgets )"
+
+RDEPEND="
+	kde? ( x11-libs/wxGTK:${WX_GTK_VER}[X] kde-base/kdelibs )
+	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+DEPEND="${RDEPEND}
+	amd64? ( dev-lang/yasm )
+	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	x86? ( dev-lang/nasm )"
+
+S=${WORKDIR}/${PN}_${PV}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-darwin.patch
+
+	if ! use pch; then
+		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
+	fi
+
+	sed \
+		-e 's:-m32 ::g' \
+		-e 's:-m64 ::g' \
+		-e 's:-pipe::g' \
+		-e '/ALLFLAGS/s:-s ::' \
+		-e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
+		-i makefile* || die
+
+	# remove non-free RAR codec
+	if use rar; then
+		ewarn "Enabling nonfree RAR decompressor"
+	else
+		sed \
+			-e '/Rar/d' \
+			-e '/RAR/d' \
+			-i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
+		rm -rf CPP/7zip/Compress/Rar || die
+	fi
+
+	if use abi_x86_x32; then
+		sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use amd64; then
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use x86; then
+		cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
+	elif [[ ${CHOST} == *-darwin* ]] ; then
+		# Mac OS X needs this special makefile, because it has a non-GNU
+		# linker, it doesn't matter so much for bitwidth, for it doesn't
+		# do anything with it
+		cp -f makefile.macosx_llvm_64bits makefile.machine
+		# bundles have extension .bundle but don't die because USE=-rar
+		# removes the Rar directory
+		sed -i -e '/strcpy(name/s/\.so/.bundle/' \
+			CPP/Windows/DLL.cpp || die
+		sed -i -e '/^PROG=/s/\.so/.bundle/' \
+			CPP/7zip/Bundles/Format7zFree/makefile.list \
+			$(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
+	elif use x86-fbsd; then
+		# FreeBSD needs this special makefile, because it hasn't -ldl
+		sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
+	fi
+
+	if use static; then
+		sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
+	fi
+
+	if use kde || use wxwidgets; then
+		need-wxwidgets unicode
+		einfo "Preparing dependency list"
+		emake depend
+	fi
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
+	if use kde || use wxwidgets; then
+		emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
+#		emake -- 7zFM
+	fi
+}
+
+src_test() {
+	emake test test_7z test_7zr
+}
+
+src_install() {
+	# this wrappers can not be symlinks, p7zip should be called with full path
+	make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
+	make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
+	make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
+
+	if use kde || use wxwidgets; then
+		make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
+#		make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
+
+#		make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
+
+		dobin GUI/p7zipForFilemanager
+		exeinto /usr/$(get_libdir)/${PN}
+#		doexe bin/7z{G,FM}
+		doexe bin/7zG
+
+		insinto /usr/$(get_libdir)/${PN}
+		doins -r GUI/{Lang,help}
+
+		insinto /usr/share/icons/hicolor/16x16/apps/
+		newins GUI/p7zip_16_ok.png p7zip.png
+
+		if use kde; then
+			rm GUI/kde4/p7zip_compress.desktop || die
+			insinto /usr/share/kde4/services/ServiceMenus
+			doins GUI/kde4/*.desktop
+			dodir /usr/share/kservices5/ServiceMenus
+			for item in "${D}"/usr/share/kde4/services/ServiceMenus/*.desktop; do
+				item="$(basename ${item})"
+				dosym "/usr/share/kde4/services/ServiceMenus/${item}" "/usr/share/kservices5/ServiceMenus/${item}"
+			done
+		fi
+	fi
+
+	dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
+	doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
+
+	exeinto /usr/$(get_libdir)/${PN}
+	doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
+	doexe bin/*$(get_modname)
+	if use rar; then
+		exeinto /usr/$(get_libdir)/${PN}/Codecs/
+		doexe bin/Codecs/*$(get_modname)
+	fi
+
+	doman man1/7z.1 man1/7za.1 man1/7zr.1
+	dodoc ChangeLog README TODO
+
+	if use doc; then
+		dodoc DOC/*.txt
+		dohtml -r DOC/MANUAL/*
+	fi
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
@ 2015-10-28 13:44 Justin Lecher
  0 siblings, 0 replies; 7+ messages in thread
From: Justin Lecher @ 2015-10-28 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     2b72affac85585328eb48f5933ea13345aa733bf
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 28 13:44:09 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Wed Oct 28 13:44:09 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b72affa

app-arch/p7zip: Version Bump

Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=564266

Package-Manager: portage-2.2.23
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 app-arch/p7zip/Manifest                            |   1 +
 .../p7zip/files/p7zip-15.09-CVE-2015-1038.patch    | 284 +++++++++++++++++++++
 app-arch/p7zip/p7zip-15.09.ebuild                  | 158 ++++++++++++
 3 files changed, 443 insertions(+)

diff --git a/app-arch/p7zip/Manifest b/app-arch/p7zip/Manifest
index 44c4c61..9b0a188 100644
--- a/app-arch/p7zip/Manifest
+++ b/app-arch/p7zip/Manifest
@@ -1,2 +1,3 @@
+DIST p7zip_15.09_src_all.tar.bz2 4048481 SHA256 8783acf747e210e00150f7311cc06c4cd8ecf7b0c27b4adf2194284cc49b4d6f SHA512 4f020b13632ef7a85aa8a98586b59bef2dde3c1cbebdbd17e01f1d09b2e13a56ecfe82546d7efc677c45df67456a71cfdb67826b53ebea4c0fb4878f20c2f6dd WHIRLPOOL 71d1cdb9b3b1208197b2c056670d057b00e9a5f80cf08b5914b5d25f2f6756d4cb53e5a000ec76b7b879f82302fca6d012a2cd397e8aa95ae4fc21fd620eb1ab
 DIST p7zip_9.20.1_src_all.tar.bz2 3835235 SHA256 49557e7ffca08100f9fc687f4dfc5aea703ca207640c76d9dee7b66f03cb4782 SHA512 7bb8a276aaefc4a83364e45633c48527de44c6b1205344f3356db570582f30f81d82a94938c99a7ad193587b584cc1c03219c28249de40018bdaee6c3b2a022a WHIRLPOOL cb20f37d3f796931a9b330728aa7148afe98bbf8a49bb91bfd80e4667c16416206b23bf34298e9ec37825e8b43f92a5710f0cea1f974296d5c17aa2c7b0931f3
 DIST p7zip_9.38.1_src_all.tar.bz2 3917925 SHA256 fd5019109c9a1bf34ad3257d37a6853eae8151ff50345f0a3ffba7d8c5fdb995 SHA512 f524ffae54e0d9563a509cc4b243e830d882a925e682eb2e15e2d19cb72c947fddecd72c8507d6c1538b997b240b0827046fc2fb4f5e3f7d49840257c92b9c04 WHIRLPOOL 6bad1cde056ab1e8db4079c0e649665fbc7e6b9a565261188bd0acaec6c583d8bd9425cb26d39315408d0180ba0be0069a77b704633cf05ec855220cb31f1c24

diff --git a/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch b/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch
new file mode 100644
index 0000000..dc81317
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch
@@ -0,0 +1,284 @@
+ CPP/7zip/UI/Agent/Agent.cpp                   |  2 +-
+ CPP/7zip/UI/Client7z/Client7z.cpp             | 19 ++++++++++-
+ CPP/7zip/UI/Common/ArchiveExtractCallback.cpp | 14 +++++++--
+ CPP/7zip/UI/Common/ArchiveExtractCallback.h   |  6 +++-
+ CPP/7zip/UI/Common/Extract.cpp                |  2 +-
+ CPP/Windows/FileDir.cpp                       | 45 +++++++++++++++++++++++++--
+ CPP/Windows/FileDir.h                         | 31 +++++++++++++++++-
+ 7 files changed, 109 insertions(+), 10 deletions(-)
+
+diff --git a/CPP/7zip/UI/Agent/Agent.cpp b/CPP/7zip/UI/Agent/Agent.cpp
+index 201e82c..b0b8316 100644
+--- a/CPP/7zip/UI/Agent/Agent.cpp
++++ b/CPP/7zip/UI/Agent/Agent.cpp
+@@ -1515,7 +1515,7 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
+   HRESULT result = _agentSpec->GetArchive()->Extract(&realIndices.Front(),
+       realIndices.Size(), testMode, extractCallback);
+   if (result == S_OK)
+-    result = extractCallbackSpec->SetDirsTimes();
++    result = extractCallbackSpec->SetFinalAttribs();
+   return result;
+   COM_TRY_END
+ }
+diff --git a/CPP/7zip/UI/Client7z/Client7z.cpp b/CPP/7zip/UI/Client7z/Client7z.cpp
+index c6522fe..1919389 100644
+--- a/CPP/7zip/UI/Client7z/Client7z.cpp
++++ b/CPP/7zip/UI/Client7z/Client7z.cpp
+@@ -230,8 +230,11 @@ private:
+   COutFileStream *_outFileStreamSpec;
+   CMyComPtr<ISequentialOutStream> _outFileStream;
+ 
++  CObjectVector<NWindows::NFile::NDir::CDelayedSymLink> _delayedSymLinks;
++
+ public:
+   void Init(IInArchive *archiveHandler, const FString &directoryPath);
++  HRESULT SetFinalAttribs();
+ 
+   UInt64 NumErrors;
+   bool PasswordIsDefined;
+@@ -449,11 +452,23 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
+   }
+   _outFileStream.Release();
+   if (_extractMode && _processedFileInfo.AttribDefined)
+-    SetFileAttrib(_diskFilePath, _processedFileInfo.Attrib);
++    SetFileAttrib(_diskFilePath, _processedFileInfo.Attrib, &_delayedSymLinks);
+   PrintNewLine();
+   return S_OK;
+ }
+ 
++HRESULT CArchiveExtractCallback::SetFinalAttribs()
++{
++  HRESULT result = S_OK;
++
++  for (int i = 0; i != _delayedSymLinks.Size(); ++i)
++    if (!_delayedSymLinks[i].Create())
++      result = E_FAIL;
++
++  _delayedSymLinks.Clear();
++
++  return result;
++}
+ 
+ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
+ {
+@@ -914,6 +929,8 @@ int MY_CDECL main(int numArgs, const char *args[])
+       // extractCallbackSpec->PasswordIsDefined = true;
+       // extractCallbackSpec->Password = L"1";
+       HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
++      if (result == S_OK)
++	result = extractCallbackSpec->SetFinalAttribs();
+       if (result != S_OK)
+       {
+         PrintError("Extract Error");
+diff --git a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+index 877326b..05b13f3 100644
+--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
++++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+@@ -1502,7 +1502,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
+     NumFiles++;
+ 
+   if (!_stdOutMode && _extractMode && _fi.AttribDefined)
+-    SetFileAttrib(_diskFilePath, _fi.Attrib);
++    SetFileAttrib(_diskFilePath, _fi.Attrib, &_delayedSymLinks);
+   
+   RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));
+   
+@@ -1584,8 +1584,9 @@ static unsigned GetNumSlashes(const FChar *s)
+   }
+ }
+ 
+-HRESULT CArchiveExtractCallback::SetDirsTimes()
++HRESULT CArchiveExtractCallback::SetFinalAttribs()
+ {
++  HRESULT result = S_OK;
+   CRecordVector<CExtrRefSortPair> pairs;
+   pairs.ClearAndSetSize(_extractedFolderPaths.Size());
+   unsigned i;
+@@ -1622,5 +1623,12 @@ HRESULT CArchiveExtractCallback::SetDirsTimes()
+       (WriteATime && ATimeDefined) ? &ATime : NULL,
+       (WriteMTime && MTimeDefined) ? &MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL));
+   }
+-  return S_OK;
++
++  for (int i = 0; i != _delayedSymLinks.Size(); ++i)
++    if (!_delayedSymLinks[i].Create())
++      result = E_FAIL;
++
++  _delayedSymLinks.Clear();
++
++  return result;
+ }
+diff --git a/CPP/7zip/UI/Common/ArchiveExtractCallback.h b/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+index 1e9f0b6..b51d78f 100644
+--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.h
++++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+@@ -6,6 +6,8 @@
+ #include "../../../Common/MyCom.h"
+ #include "../../../Common/Wildcard.h"
+ 
++#include "../../../Windows/FileDir.h"
++
+ #include "../../IPassword.h"
+ 
+ #include "../../Common/FileStreams.h"
+@@ -237,6 +239,8 @@ class CArchiveExtractCallback:
+   bool _saclEnabled;
+   #endif
+ 
++  CObjectVector<NWindows::NFile::NDir::CDelayedSymLink> _delayedSymLinks;
++
+   void CreateComplexDirectory(const UStringVector &dirPathParts, FString &fullPath);
+   HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
+   HRESULT GetUnpackSize();
+@@ -330,7 +334,7 @@ public:
+   }
+   #endif
+ 
+-  HRESULT SetDirsTimes();
++  HRESULT SetFinalAttribs();
+ };
+ 
+ bool CensorNode_CheckPath(const NWildcard::CCensorNode &node, const CReadArcItem &item);
+diff --git a/CPP/7zip/UI/Common/Extract.cpp b/CPP/7zip/UI/Common/Extract.cpp
+index 5b96071..98192fa 100644
+--- a/CPP/7zip/UI/Common/Extract.cpp
++++ b/CPP/7zip/UI/Common/Extract.cpp
+@@ -207,7 +207,7 @@ static HRESULT DecompressArchive(
+   else
+     result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, ecs);
+   if (result == S_OK && !options.StdInMode)
+-    result = ecs->SetDirsTimes();
++    result = ecs->SetFinalAttribs();
+   return callback->ExtractResult(result);
+ }
+ 
+diff --git a/CPP/Windows/FileDir.cpp b/CPP/Windows/FileDir.cpp
+index 422edfc..baa6255 100644
+--- a/CPP/Windows/FileDir.cpp
++++ b/CPP/Windows/FileDir.cpp
+@@ -347,7 +347,8 @@ static int convert_to_symlink(const char * name) {
+   return -1;
+ }
+ 
+-bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes)
++bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes,
++		   CObjectVector<CDelayedSymLink> *delayedSymLinks)
+ {
+   if (!fileName) {
+     SetLastError(ERROR_PATH_NOT_FOUND);
+@@ -379,7 +380,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes)
+      stat_info.st_mode = fileAttributes >> 16;
+ #ifdef ENV_HAVE_LSTAT
+      if (S_ISLNK(stat_info.st_mode)) {
+-        if ( convert_to_symlink(name) != 0) {
++        if (delayedSymLinks)
++          delayedSymLinks->Add(CDelayedSymLink(name));
++        else if ( convert_to_symlink(name) != 0) {
+           TRACEN((printf("SetFileAttrib(%s,%d) : false-3\n",(const char *)name,fileAttributes)))
+           return false;
+         }
+@@ -814,6 +817,44 @@ bool CTempDir::Remove()
+   return !_mustBeDeleted;
+ }
+ 
++#ifdef ENV_UNIX
++
++CDelayedSymLink::CDelayedSymLink(const char * source)
++  : _source(source)
++{
++  struct stat st;
++
++  if (lstat(_source, &st) == 0) {
++    _dev = st.st_dev;
++    _ino = st.st_ino;
++  } else {
++    _dev = 0;
++  }
++}
++
++bool CDelayedSymLink::Create()
++{
++  struct stat st;
++
++  if (_dev == 0) {
++    errno = EPERM;
++    return false;
++  }
++  if (lstat(_source, &st) != 0)
++    return false;
++  if (_dev != st.st_dev || _ino != st.st_ino) {
++    // Placeholder file has been overwritten or moved by another
++    // symbolic link creation
++    errno = EPERM;
++    return false;
++  }
++
++  return convert_to_symlink(_source) == 0;
++}
++
++#endif // ENV_UNIX
++
++
+ }}}
+ 
+ #ifndef _SFX
+diff --git a/CPP/Windows/FileDir.h b/CPP/Windows/FileDir.h
+index b13d1cc..7429a81 100644
+--- a/CPP/Windows/FileDir.h
++++ b/CPP/Windows/FileDir.h
+@@ -4,6 +4,7 @@
+ #define __WINDOWS_FILE_DIR_H
+ 
+ #include "../Common/MyString.h"
++#include "../Common/MyVector.h"
+ 
+ #include "FileIO.h"
+ 
+@@ -11,11 +12,14 @@ namespace NWindows {
+ namespace NFile {
+ namespace NDir {
+ 
++class CDelayedSymLink;
++
+ bool GetWindowsDir(FString &path);
+ bool GetSystemDir(FString &path);
+ 
+ bool SetDirTime(CFSTR path, const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
+-bool SetFileAttrib(CFSTR path, DWORD attrib);
++bool SetFileAttrib(CFSTR path, DWORD attrib,
++		   CObjectVector<CDelayedSymLink> *delayedSymLinks = 0);
+ bool MyMoveFile(CFSTR existFileName, CFSTR newFileName);
+ 
+ #ifndef UNDER_CE
+@@ -76,6 +80,31 @@ public:
+   bool Remove();
+ };
+ 
++// Symbolic links must be created last so that they can't be used to
++// create or overwrite files above the extraction directory.
++class CDelayedSymLink
++{
++#ifdef ENV_UNIX
++  // Where the symlink should be created.  The target is specified in
++  // the placeholder file.
++  AString _source;
++
++  // Device and inode of the placeholder file.  Before creating the
++  // symlink, we must check that these haven't been changed by creation
++  // of another symlink.
++  dev_t _dev;
++  ino_t _ino;
++
++public:
++  explicit CDelayedSymLink(const char * source);
++  bool Create();
++#else // !ENV_UNIX
++public:
++  CDelayedSymLink(const char * source) {}
++  bool Create() { return true; }
++#endif // ENV_UNIX
++};
++
+ #if !defined(UNDER_CE)
+ class CCurrentDirRestorer
+ {

diff --git a/app-arch/p7zip/p7zip-15.09.ebuild b/app-arch/p7zip/p7zip-15.09.ebuild
new file mode 100644
index 0000000..048f4cc
--- /dev/null
+++ b/app-arch/p7zip/p7zip-15.09.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="3.0"
+
+inherit eutils multilib toolchain-funcs wxwidgets
+
+DESCRIPTION="Port of 7-Zip archiver for Unix"
+HOMEPAGE="http://p7zip.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
+
+LICENSE="LGPL-2.1 rar? ( unRAR )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="doc kde rar +pch static wxwidgets abi_x86_x32"
+
+REQUIRED_USE="kde? ( wxwidgets )"
+
+RDEPEND="
+	kde? ( x11-libs/wxGTK:${WX_GTK_VER}[X] kde-base/kdelibs )
+	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
+DEPEND="${RDEPEND}
+	amd64? ( dev-lang/yasm )
+	abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
+	x86? ( dev-lang/nasm )"
+
+S=${WORKDIR}/${PN}_${PV}
+
+src_prepare() {
+	epatch \
+		"${FILESDIR}"/${P}-CVE-2015-1038.patch
+
+	if ! use pch; then
+		sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
+	fi
+
+	sed \
+		-e 's:-m32 ::g' \
+		-e 's:-m64 ::g' \
+		-e 's:-O::g' \
+		-e 's: -s ::g' \
+		-e 's: -s$::g' \
+		-e 's:-pipe::g' \
+		-e "/^CXX=/s:g++:$(tc-getCXX):" \
+		-e "/^CC=/s:gcc:$(tc-getCC):" \
+		-e '/ALLFLAGS/s:-s ::' \
+		-e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
+		-i makefile* || die
+
+	# remove non-free RAR codec
+	if use rar; then
+		ewarn "Enabling nonfree RAR decompressor"
+	else
+		sed \
+			-e '/Rar/d' \
+			-e '/RAR/d' \
+			-i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
+		rm -rf CPP/7zip/Compress/Rar || die
+	fi
+
+	if use abi_x86_x32; then
+		sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use amd64; then
+		cp -f makefile.linux_amd64_asm makefile.machine || die
+	elif use x86; then
+		cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
+	elif [[ ${CHOST} == *-darwin* ]] ; then
+		# Mac OS X needs this special makefile, because it has a non-GNU linker
+		[[ ${CHOST} == *64-* ]] \
+			&& cp -f makefile.macosx_64bits makefile.machine \
+			|| cp -f makefile.macosx_32bits makefile.machine
+		# bundles have extension .bundle but don't die because USE=-rar
+		# removes the Rar directory
+		sed -i -e '/strcpy(name/s/\.so/.bundle/' \
+			CPP/Windows/DLL.cpp || die
+		sed -i -e '/^PROG=/s/\.so/.bundle/' \
+			CPP/7zip/Bundles/Format7zFree/makefile \
+			$(use rar && echo CPP/7zip/Compress/Rar/makefile) || die
+	elif use x86-fbsd; then
+		# FreeBSD needs this special makefile, because it hasn't -ldl
+		sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
+	fi
+
+	if use static; then
+		sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
+	fi
+
+	if use kde || use wxwidgets; then
+		need-wxwidgets unicode
+		einfo "Preparing dependency list"
+		emake depend
+	fi
+}
+
+src_compile() {
+	emake all3
+	if use kde || use wxwidgets; then
+		emake -- 7zG
+		emake -- 7zFM
+	fi
+}
+
+src_test() {
+	emake test test_7z test_7zr
+}
+
+src_install() {
+	# this wrappers can not be symlinks, p7zip should be called with full path
+	make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
+	make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
+	make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
+
+	if use kde || use wxwidgets; then
+		make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
+		make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
+
+		make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
+
+		dobin GUI/p7zipForFilemanager
+		exeinto /usr/$(get_libdir)/${PN}
+		doexe bin/7z{G,FM}
+
+		insinto /usr/$(get_libdir)/${PN}
+		doins -r GUI/{Lang,help}
+
+		insinto /usr/share/icons/hicolor/16x16/apps/
+		newins GUI/p7zip_16_ok.png p7zip.png
+
+		if use kde; then
+			rm GUI/kde4/p7zip_compress.desktop || die
+			insinto /usr/share/kde4/services/ServiceMenus
+			doins GUI/kde4/*.desktop
+		fi
+	fi
+
+	dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
+	doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
+
+	exeinto /usr/$(get_libdir)/${PN}
+	doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
+	doexe bin/*$(get_modname)
+	if use rar; then
+		exeinto /usr/$(get_libdir)/${PN}/Codecs/
+		doexe bin/Codecs/*$(get_modname)
+	fi
+
+	doman man1/7z.1 man1/7za.1 man1/7zr.1
+	dodoc ChangeLog README TODO
+
+	if use doc; then
+		dodoc DOC/*.txt
+		dohtml -r DOC/MANUAL/*
+	fi
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-04-14 15:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-25 22:41 [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/ Matt Thode
  -- strict thread matches above, loose matches on Subject: below --
2023-04-14 15:34 Matthew Thode
2020-01-23 17:18 Matthew Thode
2018-06-28 19:07 Matt Thode
2018-05-08 16:55 Matt Thode
2016-07-15  2:32 Matt Thode
2015-10-28 13:44 Justin Lecher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox