From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-musl+bounces-54-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 881BE138206 for <garchives@archives.gentoo.org>; Sun, 24 Apr 2016 03:45:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7CB7AE07F1; Sun, 24 Apr 2016 03:45:56 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D5E58E07F1 for <gentoo-musl@lists.gentoo.org>; Sun, 24 Apr 2016 03:45:55 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id n1so54694865pfn.2 for <gentoo-musl@lists.gentoo.org>; Sat, 23 Apr 2016 20:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=AQxFHkoIS5RRKDxxuXkj5n7hrImOloF7orMtZ/cs6MI=; b=TIPKamwSU1ELhg5sz8rJUyrKoLP6bRopb4fbrbbYDgw9wRJcn3DZ+wVTh+7yuSaAdG BUjHh+guipFjgOcq90W1pC8Xqy7nQbjW/4AyKB/0+ZZBkkw5ykWsT9JEVQ5wkiwNmCku uV5fYhGoXibzTDy8gwCuJ6m/MLLz3JoOwWljFwVjrWJMXcRiZiPTZBKpz7BEDF0zTq+x 3nb/A0UB38zakAyiK8u+9bc1toyBS4/gGuV741tjY0daKT/912LOrORPPEa9Xo6Z3sKT qEoIekqi8ZWN6lCXWe5UDjQ1/7+b7LGxSgh03riBun9Kvf0Z5EuTgk7JhrJXeuAMKPDY fdVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=AQxFHkoIS5RRKDxxuXkj5n7hrImOloF7orMtZ/cs6MI=; b=TGe5g3KRAGMsUFfaP5nZue8m6ESGiJTzoMt7BTrFdhLy4yRunrm+b/lfGKvEL2ZtYZ Q05zqh22wTJkJ/72/nVbEZpSRmYC2nf+bgvU4nOyML9xxmbMYNknDJqHppVESdlrKZBL R51Ad37avPRqvqCKfiNQrJQaZY2JQihd2l5zG+v0vc1FqcQl61L2/u1LKjx8olGu6d52 PK0eGZ+rO7u7ucxWFlSDyrN5kOn0lZP2DaunEW2Jm30kxMJPaEnjeob7FNkMZc22Zk9j nuJbv1McSm2TflY3d6Dp/DbZnGYZbR3x828udPnTCzDYzajpywM2Pns7ilRgWXzQid0+ 9+WA== X-Gm-Message-State: AOPr4FXCLvLMJsUQfABJkJhsef/Aq5BcLjYKyZoTOqN+pX/ZlGNtF3lTDEAs2GHwLyV1gA== X-Received: by 10.98.72.16 with SMTP id v16mr10796663pfa.12.1461469554648; Sat, 23 Apr 2016 20:45:54 -0700 (PDT) Received: from gmail.com (router.cloyne.net. [64.62.133.42]) by smtp.gmail.com with ESMTPSA id n10sm19535786pax.18.2016.04.23.20.45.53 for <gentoo-musl@lists.gentoo.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Apr 2016 20:45:54 -0700 (PDT) Date: Sat, 23 Apr 2016 20:45:52 -0700 From: Aric Belsito <lluixhi@gmail.com> To: gentoo-musl@lists.gentoo.org Subject: [gentoo-musl] [PATCH] Add p7zip because the CVE-2015-1038 patch breaks builds on musl Message-ID: <20160424034552.GA20572@gmail.com> Precedence: bulk List-Post: <mailto:gentoo-musl@lists.gentoo.org> List-Help: <mailto:gentoo-musl+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-musl+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-musl+subscribe@lists.gentoo.org> List-Id: Gentoo musl list <gentoo-musl.gentoo.org> X-BeenThere: gentoo-musl@gentoo.org X-BeenThere: gentoo-musl@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.6.0 (2016-04-01) X-Archives-Salt: 9beb736d-dbea-4e02-94a4-49b44eff33a4 X-Archives-Hash: f567a759540cc3dc5a821cf8a27bff3c >From 706d73ef3dae4c63db8351990387140d308b243e Mon Sep 17 00:00:00 2001 From: Aric Belsito <lluixhi@gmail.com> Date: Sat, 23 Apr 2016 20:26:39 -0700 Subject: [PATCH] Add p7zip. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch used to fix CVE-2015-1038 breaks compilation on musl: ../../include_windows ../../UI/Console/ExtractCallbackConsole.cpp In file included from ../../UI/Console/../Common/ArchiveExtractCallback.h:9:0, from ../../UI/Console/ExtractCallbackConsole.h:11, from ../../UI/Console/ExtractCallbackConsole.cpp:5: ../../../Windows/FileDir.h:100:3: error: ‘dev_t’ does not name a type dev_t _dev; ^ ../../../Windows/FileDir.h:101:3: error: ‘ino_t’ does not name a type ino_t _ino; ^ ../../../../makefile.rules:22: recipe for target 'ExtractCallbackConsole.o' failed --- app-arch/p7zip/Manifest | 2 + app-arch/p7zip/files/9.04-makefile.patch | 19 ++ app-arch/p7zip/files/p7zip-15.14.1-darwin.patch | 11 + .../p7zip/files/p7zip-9.20.1-CVE-2015-1038.patch | 315 +++++++++++++++++++++ app-arch/p7zip/files/p7zip-9.20.1-QA.patch | 17 ++ app-arch/p7zip/files/p7zip-9.20.1-execstack.patch | 24 ++ .../p7zip/files/p7zip-CVE-2015-1038-musl.patch | 14 + app-arch/p7zip/metadata.xml | 14 + app-arch/p7zip/p7zip-15.14.1.ebuild | 160 +++++++++++ app-arch/p7zip/p7zip-9.20.1-r5.ebuild | 156 ++++++++++ 10 files changed, 732 insertions(+) create mode 100644 app-arch/p7zip/Manifest create mode 100644 app-arch/p7zip/files/9.04-makefile.patch create mode 100644 app-arch/p7zip/files/p7zip-15.14.1-darwin.patch create mode 100644 app-arch/p7zip/files/p7zip-9.20.1-CVE-2015-1038.patch create mode 100644 app-arch/p7zip/files/p7zip-9.20.1-QA.patch create mode 100644 app-arch/p7zip/files/p7zip-9.20.1-execstack.patch create mode 100644 app-arch/p7zip/files/p7zip-CVE-2015-1038-musl.patch create mode 100644 app-arch/p7zip/metadata.xml create mode 100644 app-arch/p7zip/p7zip-15.14.1.ebuild create mode 100644 app-arch/p7zip/p7zip-9.20.1-r5.ebuild diff --git a/app-arch/p7zip/Manifest b/app-arch/p7zip/Manifest new file mode 100644 index 0000000..c55f590 --- /dev/null +++ b/app-arch/p7zip/Manifest @@ -0,0 +1,2 @@ +DIST p7zip_15.14.1_src_all.tar.bz2 4147911 SHA256 699db4da3621904113e040703220abb1148dfef477b55305e2f14a4f1f8f25d4 SHA512 30d0ef47bd6938cdd5d9d80ec6e7aed972655686a43adb0ae34bb9856ec7cd5a68a05c580352021055cefd6eeceb134ff6402f93686ce46e57f9757798e76abd WHIRLPOOL ace6204d3ab08002b6d5657ae280e22b7e26cdfe0af8099024ad8562a68aa5097a8f09d9d49904a06b9a6942d30fbf3d7a3872661433dd4f76c33dea03ccfb6a +DIST p7zip_9.20.1_src_all.tar.bz2 3835235 SHA256 49557e7ffca08100f9fc687f4dfc5aea703ca207640c76d9dee7b66f03cb4782 SHA512 7bb8a276aaefc4a83364e45633c48527de44c6b1205344f3356db570582f30f81d82a94938c99a7ad193587b584cc1c03219c28249de40018bdaee6c3b2a022a WHIRLPOOL cb20f37d3f796931a9b330728aa7148afe98bbf8a49bb91bfd80e4667c16416206b23bf34298e9ec37825e8b43f92a5710f0cea1f974296d5c17aa2c7b0931f3 diff --git a/app-arch/p7zip/files/9.04-makefile.patch b/app-arch/p7zip/files/9.04-makefile.patch new file mode 100644 index 0000000..93a99cc --- /dev/null +++ b/app-arch/p7zip/files/9.04-makefile.patch @@ -0,0 +1,19 @@ +--- p7zip_9.04/CPP/7zip/Bundles/Format7zFree/makefile.orig 2010-01-04 13:58:54.527887746 +0100 ++++ p7zip_9.04/CPP/7zip/Bundles/Format7zFree/makefile 2010-01-04 13:59:10.290868343 +0100 +@@ -247,8 +247,6 @@ + MyAes.o \ + Pbkdf2HmacSha1.o \ + RandGen.o \ +- Rar20Crypto.o \ +- RarAes.o \ + Sha1.o \ + WzAes.o \ + ZipCrypto.o \ +@@ -298,7 +296,6 @@ + $(HFS_OBJS) \ + $(ISO_OBJS) \ + $(NSIS_OBJS) \ +- $(RAR_OBJS) \ + $(TAR_OBJS) \ + $(UDF_OBJS) \ + $(WIM_OBJS) \ diff --git a/app-arch/p7zip/files/p7zip-15.14.1-darwin.patch b/app-arch/p7zip/files/p7zip-15.14.1-darwin.patch new file mode 100644 index 0000000..e7f40f5 --- /dev/null +++ b/app-arch/p7zip/files/p7zip-15.14.1-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/files/p7zip-9.20.1-CVE-2015-1038.patch b/app-arch/p7zip/files/p7zip-9.20.1-CVE-2015-1038.patch new file mode 100644 index 0000000..09dd0f2 --- /dev/null +++ b/app-arch/p7zip/files/p7zip-9.20.1-CVE-2015-1038.patch @@ -0,0 +1,315 @@ +Author: Ben Hutchings <ben@decadent.org.uk> +Date: Tue, 19 May 2015 02:38:40 +0100 +Description: Delay creation of symlinks to prevent arbitrary file writes (CVE-2015-1038) +Bug: http://sourceforge.net/p/p7zip/bugs/147/ +Bug-Debian: https://bugs.debian.org/774660 + +Alexander Cherepanov discovered that 7zip is susceptible to a +directory traversal vulnerability. While extracting an archive, it +will extract symlinks and then follow them if they are referenced in +further entries. This can be exploited by a rogue archive to write +files outside the current directory. + +We have to create placeholder files (which we already do) and delay +creating symlinks until the end of extraction. + +Due to the possibility of anti-items (deletions) in the archive, it is +possible for placeholders to be deleted and replaced before we create +the symlinks. It's not clear that this can be used for mischief, but +GNU tar guards against similar problems by checking that the placeholder +still exists and is the same inode. XXX It also checks 'birth time' but +this isn't portable. We can probably get away with comparing ctime +since we don't support hard links. + +--- a/CPP/7zip/UI/Agent/Agent.cpp ++++ b/CPP/7zip/UI/Agent/Agent.cpp +@@ -424,6 +424,8 @@ STDMETHODIMP CAgentFolder::Extract(const + CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec; + UStringVector pathParts; + CProxyFolder *currentProxyFolder = _proxyFolderItem; ++ HRESULT res; ++ + while (currentProxyFolder->Parent) + { + pathParts.Insert(0, currentProxyFolder->Name); +@@ -445,8 +447,11 @@ STDMETHODIMP CAgentFolder::Extract(const + (UInt64)(Int64)-1); + CUIntVector realIndices; + GetRealIndices(indices, numItems, realIndices); +- return _agentSpec->GetArchive()->Extract(&realIndices.Front(), ++ res = _agentSpec->GetArchive()->Extract(&realIndices.Front(), + realIndices.Size(), testMode, extractCallback); ++ if (res == S_OK && !extractCallbackSpec->CreateSymLinks()) ++ res = E_FAIL; ++ return res; + COM_TRY_END + } + +--- a/CPP/7zip/UI/Agent/ArchiveFolder.cpp ++++ b/CPP/7zip/UI/Agent/ArchiveFolder.cpp +@@ -20,6 +20,8 @@ STDMETHODIMP CAgentFolder::CopyTo(const + CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec; + UStringVector pathParts; + CProxyFolder *currentProxyFolder = _proxyFolderItem; ++ HRESULT res; ++ + while (currentProxyFolder->Parent) + { + pathParts.Insert(0, currentProxyFolder->Name); +@@ -46,8 +48,11 @@ STDMETHODIMP CAgentFolder::CopyTo(const + (UInt64)(Int64)-1); + CUIntVector realIndices; + GetRealIndices(indices, numItems, realIndices); +- return _agentSpec->GetArchive()->Extract(&realIndices.Front(), ++ res = _agentSpec->GetArchive()->Extract(&realIndices.Front(), + realIndices.Size(), BoolToInt(false), extractCallback); ++ if (res == S_OK && !extractCallbackSpec->CreateSymLinks()) ++ res = E_FAIL; ++ return res; + COM_TRY_END + } + +--- a/CPP/7zip/UI/Client7z/Client7z.cpp ++++ b/CPP/7zip/UI/Client7z/Client7z.cpp +@@ -197,8 +197,11 @@ private: + COutFileStream *_outFileStreamSpec; + CMyComPtr<ISequentialOutStream> _outFileStream; + ++ CObjectVector<NWindows::NFile::NDirectory::CDelayedSymLink> _delayedSymLinks; ++ + public: + void Init(IInArchive *archiveHandler, const UString &directoryPath); ++ bool CreateSymLinks(); + + UInt64 NumErrors; + bool PasswordIsDefined; +@@ -392,11 +395,22 @@ STDMETHODIMP CArchiveExtractCallback::Se + } + _outFileStream.Release(); + if (_extractMode && _processedFileInfo.AttribDefined) +- NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib); ++ NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib, &_delayedSymLinks); + PrintNewLine(); + return S_OK; + } + ++bool CArchiveExtractCallback::CreateSymLinks() ++{ ++ bool success = true; ++ ++ for (int i = 0; i != _delayedSymLinks.Size(); ++i) ++ success &= _delayedSymLinks[i].Create(); ++ ++ _delayedSymLinks.Clear(); ++ ++ return success; ++} + + STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password) + { +--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp ++++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +@@ -453,12 +453,24 @@ STDMETHODIMP CArchiveExtractCallback::Se + NumFiles++; + + if (_extractMode && _fi.AttribDefined) +- NFile::NDirectory::MySetFileAttributes(_diskFilePath, _fi.Attrib); ++ NFile::NDirectory::MySetFileAttributes(_diskFilePath, _fi.Attrib, &_delayedSymLinks); + RINOK(_extractCallback2->SetOperationResult(operationResult, _encrypted)); + return S_OK; + COM_TRY_END + } + ++bool CArchiveExtractCallback::CreateSymLinks() ++{ ++ bool success = true; ++ ++ for (int i = 0; i != _delayedSymLinks.Size(); ++i) ++ success &= _delayedSymLinks[i].Create(); ++ ++ _delayedSymLinks.Clear(); ++ ++ return success; ++} ++ + /* + STDMETHODIMP CArchiveExtractCallback::GetInStream( + const wchar_t *name, ISequentialInStream **inStream) +--- 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" +@@ -83,6 +85,8 @@ class CArchiveExtractCallback: + UInt64 _packTotal; + UInt64 _unpTotal; + ++ CObjectVector<NWindows::NFile::NDirectory::CDelayedSymLink> _delayedSymLinks; ++ + void CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath); + HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined); + HRESULT GetUnpackSize(); +@@ -138,6 +142,7 @@ public: + const UStringVector &removePathParts, + UInt64 packSize); + ++ bool CreateSymLinks(); + }; + + #endif +--- a/CPP/7zip/UI/Common/Extract.cpp ++++ b/CPP/7zip/UI/Common/Extract.cpp +@@ -96,6 +96,9 @@ static HRESULT DecompressArchive( + else + result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, extractCallbackSpec); + ++ if (result == S_OK && !extractCallbackSpec->CreateSymLinks()) ++ result = E_FAIL; ++ + return callback->ExtractResult(result); + } + +--- a/CPP/Windows/FileDir.cpp ++++ b/CPP/Windows/FileDir.cpp +@@ -453,9 +453,10 @@ bool SetDirTime(LPCWSTR fileName, const + } + + #ifndef _UNICODE +-bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes) ++bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes, ++ CObjectVector<CDelayedSymLink> *delayedSymLinks) + { +- return MySetFileAttributes(UnicodeStringToMultiByte(fileName, CP_ACP), fileAttributes); ++ return MySetFileAttributes(UnicodeStringToMultiByte(fileName, CP_ACP), fileAttributes, delayedSymLinks); + } + + bool MyRemoveDirectory(LPCWSTR pathName) +@@ -488,7 +489,8 @@ static int convert_to_symlink(const char + return -1; + } + +-bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes) ++bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes, ++ CObjectVector<CDelayedSymLink> *delayedSymLinks) + { + if (!fileName) { + SetLastError(ERROR_PATH_NOT_FOUND); +@@ -520,7 +522,9 @@ bool MySetFileAttributes(LPCTSTR fileNam + 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("MySetFileAttributes(%s,%d) : false-3\n",name,fileAttributes))) + return false; + } +@@ -924,4 +928,41 @@ bool CTempDirectory::Create(LPCTSTR pref + } + + ++#ifdef ENV_UNIX ++ ++CDelayedSymLink::CDelayedSymLink(LPCSTR 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 ++ + }}} +--- a/CPP/Windows/FileDir.h ++++ b/CPP/Windows/FileDir.h +@@ -4,6 +4,7 @@ + #define __WINDOWS_FILEDIR_H + + #include "../Common/MyString.h" ++#include "../Common/MyVector.h" + #include "Defs.h" + + /* GetFullPathName for 7zAES.cpp */ +@@ -13,11 +14,15 @@ namespace NWindows { + namespace NFile { + namespace NDirectory { + ++class CDelayedSymLink; ++ + bool SetDirTime(LPCWSTR fileName, const FILETIME *creationTime, const FILETIME *lastAccessTime, const FILETIME *lastWriteTime); + +-bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes); ++bool MySetFileAttributes(LPCTSTR fileName, DWORD fileAttributes, ++ CObjectVector<CDelayedSymLink> *delayedSymLinks = 0); + #ifndef _UNICODE +-bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes); ++bool MySetFileAttributes(LPCWSTR fileName, DWORD fileAttributes, ++ CObjectVector<CDelayedSymLink> *delayedSymLinks = 0); + #endif + + bool MyMoveFile(LPCTSTR existFileName, LPCTSTR newFileName); +@@ -80,6 +85,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(LPCSTR source); ++ bool Create(); ++#else // !ENV_UNIX ++public: ++ CDelayedSymLink(LPCSTR source) {} ++ bool Create() { return true; } ++#endif // ENV_UNIX ++}; ++ + #ifdef _UNICODE + typedef CTempFile CTempFileW; + #endif diff --git a/app-arch/p7zip/files/p7zip-9.20.1-QA.patch b/app-arch/p7zip/files/p7zip-9.20.1-QA.patch new file mode 100644 index 0000000..8845aca --- /dev/null +++ b/app-arch/p7zip/files/p7zip-9.20.1-QA.patch @@ -0,0 +1,17 @@ +From: Julian Ospald <hasufell@gentoo.org> +Date: Thu Jun 7 14:31:12 UTC 2012 +Subject: fix QA warnings + +https://sourceforge.net/tracker/?func=detail&atid=660493&aid=3532590&group_id=111810 + +--- CPP/7zip/Archive/NtfsHandler.cpp ++++ CPP/7zip/Archive/NtfsHandler.cpp +@@ -1280,7 +1280,7 @@ + if (recSizeLog < Header.SectorSizeLog) + return false; + numSectorsInRec = 1 << (recSizeLog - Header.SectorSizeLog); +- if (!mftRec.Parse(ByteBuf, Header.SectorSizeLog, numSectorsInRec, NULL, 0)) ++ if (!mftRec.Parse(ByteBuf, Header.SectorSizeLog, numSectorsInRec, 0, NULL)) + return S_FALSE; + if (!mftRec.IsFILE()) + return S_FALSE; diff --git a/app-arch/p7zip/files/p7zip-9.20.1-execstack.patch b/app-arch/p7zip/files/p7zip-9.20.1-execstack.patch new file mode 100644 index 0000000..1fdff48 --- /dev/null +++ b/app-arch/p7zip/files/p7zip-9.20.1-execstack.patch @@ -0,0 +1,24 @@ +diff -Naupr p7zip_9.20.1.orig/Asm/x64/7zCrcT8U.asm p7zip_9.20.1/Asm/x64/7zCrcT8U.asm +--- p7zip_9.20.1.orig/Asm/x64/7zCrcT8U.asm 2008-08-14 11:18:07.000000000 +0200 ++++ p7zip_9.20.1/Asm/x64/7zCrcT8U.asm 2011-07-26 17:43:57.727910278 +0200 +@@ -101,3 +101,8 @@ _CrcUpdateT8: + ret + + end ++ ++%ifidn __OUTPUT_FORMAT__,elf ++section .note.GNU-stack noalloc noexec nowrite progbits ++%endif ++ +diff -Naupr p7zip_9.20.1.orig/Asm/x86/7zCrcT8U.asm p7zip_9.20.1/Asm/x86/7zCrcT8U.asm +--- p7zip_9.20.1.orig/Asm/x86/7zCrcT8U.asm 2009-07-14 12:44:15.000000000 +0200 ++++ p7zip_9.20.1/Asm/x86/7zCrcT8U.asm 2011-07-26 17:44:23.938864508 +0200 +@@ -99,3 +99,8 @@ _CrcUpdateT8: + + + ; end ++ ++%ifidn __OUTPUT_FORMAT__,elf ++section .note.GNU-stack noalloc noexec nowrite progbits ++%endif ++ diff --git a/app-arch/p7zip/files/p7zip-CVE-2015-1038-musl.patch b/app-arch/p7zip/files/p7zip-CVE-2015-1038-musl.patch new file mode 100644 index 0000000..9837758 --- /dev/null +++ b/app-arch/p7zip/files/p7zip-CVE-2015-1038-musl.patch @@ -0,0 +1,14 @@ +diff -Naurw p7zip_15.09.orig/CPP/Windows/FileDir.h p7zip_15.09/CPP/Windows/FileDir.h +--- p7zip_15.09.orig/CPP/Windows/FileDir.h 2015-10-28 12:10:52.776688264 -0700 ++++ p7zip_15.09/CPP/Windows/FileDir.h 2015-10-28 12:11:27.813355975 -0700 +@@ -3,6 +3,10 @@ + #ifndef __WINDOWS_FILE_DIR_H + #define __WINDOWS_FILE_DIR_H + ++#ifdef ENV_UNIX ++#include <sys/types.h> ++#endif ++ + #include "../Common/MyString.h" + #include "../Common/MyVector.h" + diff --git a/app-arch/p7zip/metadata.xml b/app-arch/p7zip/metadata.xml new file mode 100644 index 0000000..686e063 --- /dev/null +++ b/app-arch/p7zip/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>prometheanfire@gentoo.org</email> + <description>maintainer</description> + </maintainer> + <use> + <flag name="rar">Enable support for non-free rar decoder</flag> + </use> + <upstream> + <remote-id type="sourceforge">p7zip</remote-id> + </upstream> +</pkgmetadata> diff --git a/app-arch/p7zip/p7zip-15.14.1.ebuild b/app-arch/p7zip/p7zip-15.14.1.ebuild new file mode 100644 index 0000000..4c3a0d2 --- /dev/null +++ b/app-arch/p7zip/p7zip-15.14.1.ebuild @@ -0,0 +1,160 @@ +# 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 \ + "${FILESDIR}"/${PN}-CVE-2015-1038-musl.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 +} diff --git a/app-arch/p7zip/p7zip-9.20.1-r5.ebuild b/app-arch/p7zip/p7zip-9.20.1-r5.ebuild new file mode 100644 index 0000000..c399922 --- /dev/null +++ b/app-arch/p7zip/p7zip-9.20.1-r5.ebuild @@ -0,0 +1,156 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=4 + +WX_GTK_VER="2.8" + +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" + +REQUIRED_USE="kde? ( wxwidgets )" + +RDEPEND=" + kde? ( x11-libs/wxGTK:2.8[X,-odbc] kde-base/kdelibs ) + wxwidgets? ( x11-libs/wxGTK:2.8[X,-odbc] )" +DEPEND="${RDEPEND} + amd64? ( dev-lang/yasm ) + x86? ( dev-lang/nasm )" + +S=${WORKDIR}/${PN}_${PV} + +src_prepare() { + epatch \ + "${FILESDIR}"/${P}-execstack.patch \ + "${FILESDIR}"/${P}-QA.patch \ + "${FILESDIR}"/${P}-CVE-2015-1038.patch \ + "${FILESDIR}"/${PN}-CVE-2015-1038-musl.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:-pipe::g' \ + -e "/^CC/s:\$(ALLFLAGS):${CFLAGS} \$(ALLFLAGS):g" \ + -e "/^CXX/s:\$(ALLFLAGS):${CXXFLAGS} \$(ALLFLAGS):g" \ + -i makefile* || die + + # remove non-free RAR codec + if use rar; then + ewarn "Enabling nonfree RAR decompressor" + else + sed -e '/Rar/d' -i makefile* || die + rm -rf CPP/7zip/Compress/Rar || die + epatch "${FILESDIR}"/9.04-makefile.patch + fi + + sed -i \ + -e "/^CXX=/s:g++:$(tc-getCXX):" \ + -e "/^CC=/s:gcc:$(tc-getCC):" \ + -e '/ALLFLAGS/s:-s ::' \ + makefile* || die "changing makefiles" + + if 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 + 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 DOCS/*.txt + dohtml -r DOCS/MANUAL/* + fi +} -- 2.8.1