public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2015-12-03 10:44 Justin Lecher
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Lecher @ 2015-12-03 10:44 UTC (permalink / raw
  To: gentoo-commits

commit:     63d6e0fccc6f26ec4b0ba5cd6046b6a3fd4ca073
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  3 10:43:00 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Thu Dec  3 10:44:38 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63d6e0fc

app-arch/p7zip: Add upstream version of CVE patch

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

 .../p7zip/files/p7zip-15.09-CVE-2015-1038.patch    | 98 ++++++++++++----------
 1 file changed, 52 insertions(+), 46 deletions(-)

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
index dc81317..5da28c5 100644
--- a/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch
+++ b/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch
@@ -1,17 +1,30 @@
- 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(-)
+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
 
-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,
+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.
+
+diff -rup p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp
+--- p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp	2015-09-17 20:02:35.000000000 +0100
++++ p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp	2015-12-03 02:22:47.073724194 +0000
+@@ -1515,7 +1515,7 @@ STDMETHODIMP CAgentFolder::Extract(const
    HRESULT result = _agentSpec->GetArchive()->Extract(&realIndices.Front(),
        realIndices.Size(), testMode, extractCallback);
    if (result == S_OK)
@@ -20,10 +33,9 @@ index 201e82c..b0b8316 100644
    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
+diff -rup p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp
+--- p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp	2015-10-17 15:52:30.000000000 +0100
++++ p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp	2015-12-03 02:22:47.073724194 +0000
 @@ -230,8 +230,11 @@ private:
    COutFileStream *_outFileStreamSpec;
    CMyComPtr<ISequentialOutStream> _outFileStream;
@@ -36,7 +48,7 @@ index c6522fe..1919389 100644
  
    UInt64 NumErrors;
    bool PasswordIsDefined;
-@@ -449,11 +452,23 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
+@@ -449,11 +452,23 @@ STDMETHODIMP CArchiveExtractCallback::Se
    }
    _outFileStream.Release();
    if (_extractMode && _processedFileInfo.AttribDefined)
@@ -61,7 +73,7 @@ index c6522fe..1919389 100644
  
  STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
  {
-@@ -914,6 +929,8 @@ int MY_CDECL main(int numArgs, const char *args[])
+@@ -914,6 +929,8 @@ int MY_CDECL main(int numArgs, const cha
        // extractCallbackSpec->PasswordIsDefined = true;
        // extractCallbackSpec->Password = L"1";
        HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
@@ -70,11 +82,10 @@ index c6522fe..1919389 100644
        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)
+diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+--- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp	2015-10-03 09:49:15.000000000 +0100
++++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp	2015-12-03 02:24:40.444963545 +0000
+@@ -1502,7 +1502,7 @@ STDMETHODIMP CArchiveExtractCallback::Se
      NumFiles++;
  
    if (!_stdOutMode && _extractMode && _fi.AttribDefined)
@@ -83,7 +94,7 @@ index 877326b..05b13f3 100644
    
    RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));
    
-@@ -1584,8 +1584,9 @@ static unsigned GetNumSlashes(const FChar *s)
+@@ -1584,8 +1584,9 @@ static unsigned GetNumSlashes(const FCha
    }
  }
  
@@ -94,7 +105,7 @@ index 877326b..05b13f3 100644
    CRecordVector<CExtrRefSortPair> pairs;
    pairs.ClearAndSetSize(_extractedFolderPaths.Size());
    unsigned i;
-@@ -1622,5 +1623,12 @@ HRESULT CArchiveExtractCallback::SetDirsTimes()
+@@ -1622,5 +1623,12 @@ HRESULT CArchiveExtractCallback::SetDirs
        (WriteATime && ATimeDefined) ? &ATime : NULL,
        (WriteMTime && MTimeDefined) ? &MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL));
    }
@@ -108,10 +119,9 @@ index 877326b..05b13f3 100644
 +
 +  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
+diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+--- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h	2015-10-03 11:29:09.000000000 +0100
++++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h	2015-12-03 02:22:47.074724204 +0000
 @@ -6,6 +6,8 @@
  #include "../../../Common/MyCom.h"
  #include "../../../Common/Wildcard.h"
@@ -139,10 +149,9 @@ index 1e9f0b6..b51d78f 100644
  };
  
  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
+diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp
+--- p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp	2015-09-07 20:47:32.000000000 +0100
++++ p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp	2015-12-03 02:22:47.075724215 +0000
 @@ -207,7 +207,7 @@ static HRESULT DecompressArchive(
    else
      result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, ecs);
@@ -152,11 +161,10 @@ index 5b96071..98192fa 100644
    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) {
+diff -rup p7zip_15.09.orig/CPP/Windows/FileDir.cpp p7zip_15.09/CPP/Windows/FileDir.cpp
+--- p7zip_15.09.orig/CPP/Windows/FileDir.cpp	2015-10-10 13:37:41.000000000 +0100
++++ p7zip_15.09/CPP/Windows/FileDir.cpp	2015-12-03 02:22:47.075724215 +0000
+@@ -347,7 +347,8 @@ static int convert_to_symlink(const char
    return -1;
  }
  
@@ -166,7 +174,7 @@ index 422edfc..baa6255 100644
  {
    if (!fileName) {
      SetLastError(ERROR_PATH_NOT_FOUND);
-@@ -379,7 +380,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes)
+@@ -379,7 +380,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD
       stat_info.st_mode = fileAttributes >> 16;
  #ifdef ENV_HAVE_LSTAT
       if (S_ISLNK(stat_info.st_mode)) {
@@ -177,7 +185,7 @@ index 422edfc..baa6255 100644
            TRACEN((printf("SetFileAttrib(%s,%d) : false-3\n",(const char *)name,fileAttributes)))
            return false;
          }
-@@ -814,6 +817,44 @@ bool CTempDir::Remove()
+@@ -814,6 +817,43 @@ bool CTempDir::Remove()
    return !_mustBeDeleted;
  }
  
@@ -218,14 +226,12 @@ index 422edfc..baa6255 100644
 +
 +#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
+diff -rup p7zip_15.09.orig/CPP/Windows/FileDir.h p7zip_15.09/CPP/Windows/FileDir.h
+--- p7zip_15.09.orig/CPP/Windows/FileDir.h	2015-06-19 11:52:06.000000000 +0100
++++ p7zip_15.09/CPP/Windows/FileDir.h	2015-12-03 02:22:47.075724215 +0000
 @@ -4,6 +4,7 @@
  #define __WINDOWS_FILE_DIR_H
  


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

* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2016-03-28  7:26 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2016-03-28  7:26 UTC (permalink / raw
  To: gentoo-commits

commit:     8c427497e8b041bb0908964e10b71ea21dcb7216
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 07:24:53 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 07:25:41 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c427497

app-arch/p7zip: fix compilation on OSX El Capitan also, bug #577344

Package-Manager: portage-2.2.28-prefix

 app-arch/p7zip/files/p7zip-15.14-darwin.patch | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/app-arch/p7zip/files/p7zip-15.14-darwin.patch b/app-arch/p7zip/files/p7zip-15.14-darwin.patch
index 2db6de9..412b838 100644
--- a/app-arch/p7zip/files/p7zip-15.14-darwin.patch
+++ b/app-arch/p7zip/files/p7zip-15.14-darwin.patch
@@ -1,4 +1,5 @@
 Darwin has wchar_h and wctypes_h.
+El Capitan needs <sys/types.h> for ino_t.
 
 --- CPP/myWindows/config.h
 +++ CPP/myWindows/config.h
@@ -11,3 +12,14 @@ Darwin has wchar_h and wctypes_h.
  
      /* <wchar.h> */
      /* ENV_HAVE_WCHAR__H and not ENV_HAVE_WCHAR_H to avoid warning with wxWidgets */
+--- CPP/myWindows/StdAfx.h
++++ 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
+ 


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

* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2016-04-10  9:49 Lars Wendler
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Wendler @ 2016-04-10  9:49 UTC (permalink / raw
  To: gentoo-commits

commit:     08e65ecd1abfafd2acdb6fbc44f5d2807d86d11e
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 10 09:48:44 2016 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sun Apr 10 09:48:59 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08e65ecd

app-arch/p7zip: Added missing darwin patch (bug #579482).

Package-Manager: portage-2.2.28
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 app-arch/p7zip/files/p7zip-15.14.1-darwin.patch | 11 +++++++++++
 1 file changed, 11 insertions(+)

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
+ 


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

* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2016-07-03 11:57 Patrice Clement
  0 siblings, 0 replies; 6+ messages in thread
From: Patrice Clement @ 2016-07-03 11:57 UTC (permalink / raw
  To: gentoo-commits

commit:     ac6036efa7017066f002def3205048eec2f8c066
Author:     Michael Mair-Keimberger (asterix) <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Fri Jul  1 19:55:35 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 11:28:37 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac6036ef

app-arch/p7zip: remove unused patch

Closes: https://github.com/gentoo/gentoo/pull/1812

Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>

 app-arch/p7zip/files/p7zip-9.20.1-long_rar_pwd.patch | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/app-arch/p7zip/files/p7zip-9.20.1-long_rar_pwd.patch b/app-arch/p7zip/files/p7zip-9.20.1-long_rar_pwd.patch
deleted file mode 100644
index ea7a90b..0000000
--- a/app-arch/p7zip/files/p7zip-9.20.1-long_rar_pwd.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- ./CPP/7zip/Crypto/Sha1.cpp	2010-10-20 06:56:08.000000000 +0200
-+++ CPP/7zip/Crypto/Sha1.cpp.new	2013-09-15 09:19:51.000000000 +0200
-@@ -148,10 +148,10 @@
-         for (int i = 0; i < kBlockSizeInWords; i++)
-         {
-           UInt32 d = _buffer[i];
--          data[i * 4 + 0 - kBlockSize] = (Byte)(d);
--          data[i * 4 + 1 - kBlockSize] = (Byte)(d >>  8);
--          data[i * 4 + 2 - kBlockSize] = (Byte)(d >> 16);
--          data[i * 4 + 3 - kBlockSize] = (Byte)(d >> 24);
-+          data[(int)i * 4 + 0 - (int)kBlockSize] = (Byte)(d);
-+          data[(int)i * 4 + 1 - (int)kBlockSize] = (Byte)(d >>  8);
-+          data[(int)i * 4 + 2 - (int)kBlockSize] = (Byte)(d >> 16);
-+          data[(int)i * 4 + 3 - (int)kBlockSize] = (Byte)(d >> 24);
-         }
-       returnRes = rar350Mode;
-     }


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

* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2017-08-08 22:43 Matt Thode
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Thode @ 2017-08-08 22:43 UTC (permalink / raw
  To: gentoo-commits

commit:     aa7064408e7631603897acfee9e6ba869896e553
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  8 22:43:27 2017 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Tue Aug  8 22:43:27 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa706440

app-arch/p7zip: cleanup, from mm1ke's PR, manually done

https://github.com/gentoo/gentoo/pull/5360

Package-Manager: Portage-2.3.6, Repoman-2.3.3

 app-arch/p7zip/files/9.04-makefile.patch           |  19 --
 app-arch/p7zip/files/p7zip                         |  73 -----
 .../p7zip/files/p7zip-15.09-CVE-2015-1038.patch    | 290 -------------------
 app-arch/p7zip/files/p7zip-15.14-darwin.patch      |  25 --
 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-9.38.1-CVE-2015-1038.patch   | 283 ------------------
 app-arch/p7zip/files/p7zip-9.38.1-osversion.patch  |  28 --
 10 files changed, 1085 deletions(-)

diff --git a/app-arch/p7zip/files/9.04-makefile.patch b/app-arch/p7zip/files/9.04-makefile.patch
deleted file mode 100644
index 93a99cc9014..00000000000
--- a/app-arch/p7zip/files/9.04-makefile.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- 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 b/app-arch/p7zip/files/p7zip
deleted file mode 100644
index 9aaf078cbe0..00000000000
--- a/app-arch/p7zip/files/p7zip
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-# gzip-like CLI wrapper for p7zip
-set -e
-
-compress=true
-file=
-
-usage ()
-  {
-    echo "Usage: $0 [-d] [-h|--help] [file]"
-    exit 1
-  }
-
-while [ "$#" != "0" ] ; do
-  case "$1" in
-    -d) compress=false ;;
-    -c) echo "$0: ignoring $1 option (not yet implemented)" ;;
-    -h|--help) usage ;;
-    *)
-      if [ "${file}" = "" ] ; then
-        file="$1"
-      else
-        usage
-      fi
-    ;;
-  esac
-  shift
-done
-
-# make sure they're present, before we screw up
-for i in mktemp 7z rm cat tty ; do
-  if ! which $i > /dev/null ; then
-    echo "$0: $i: command not found"
-    exit 1
-  fi
-done
-
-if [ "${file}" != "" ] ; then
-  if ${compress} ; then
-    7z a ${file}.7z ${file}
-    rm ${file}
-  else
-    case ${file} in
-      *.7z)
-        7z x ${file}
-        rm ${file}
-      ;;
-      *)
-        echo "$0: ${file}: unknown suffix -- ignored"
-      ;;
-    esac
-  fi
-  exit 0
-fi
-
-tmp=`mktemp`
-trap "rm -f ${tmp}" 0
-
-if ${compress} ; then
-  if tty > /dev/null ; then
-    echo "$0: compressed data not written to a terminal."
-    echo "For help, type: $0 -h"
-    exit 1
-  fi
-  rm -f ${tmp}
-  7z a ${tmp} -si >/dev/null
-  cat ${tmp}
-else
-  cat > ${tmp}
-  7z x ${tmp} -so 2>/dev/null | cat
-fi
-
-rm -f ${tmp}

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
deleted file mode 100644
index 491ad13523f..00000000000
--- a/app-arch/p7zip/files/p7zip-15.09-CVE-2015-1038.patch
+++ /dev/null
@@ -1,290 +0,0 @@
-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: https://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.
-
-diff -rup p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp
---- p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp	2015-09-17 20:02:35.000000000 +0100
-+++ p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp	2015-12-03 02:22:47.073724194 +0000
-@@ -1515,7 +1515,7 @@ STDMETHODIMP CAgentFolder::Extract(const
-   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 -rup p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp
---- p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp	2015-10-17 15:52:30.000000000 +0100
-+++ p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp	2015-12-03 02:22:47.073724194 +0000
-@@ -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::Se
-   }
-   _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 cha
-       // 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 -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
---- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp	2015-10-03 09:49:15.000000000 +0100
-+++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp	2015-12-03 02:24:40.444963545 +0000
-@@ -1502,7 +1502,7 @@ STDMETHODIMP CArchiveExtractCallback::Se
-     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 FCha
-   }
- }
- 
--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::SetDirs
-       (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 -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h
---- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h	2015-10-03 11:29:09.000000000 +0100
-+++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h	2015-12-03 02:22:47.074724204 +0000
-@@ -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 -rup p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp
---- p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp	2015-09-07 20:47:32.000000000 +0100
-+++ p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp	2015-12-03 02:22:47.075724215 +0000
-@@ -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 -rup p7zip_15.09.orig/CPP/Windows/FileDir.cpp p7zip_15.09/CPP/Windows/FileDir.cpp
---- p7zip_15.09.orig/CPP/Windows/FileDir.cpp	2015-10-10 13:37:41.000000000 +0100
-+++ p7zip_15.09/CPP/Windows/FileDir.cpp	2015-12-03 02:22:47.075724215 +0000
-@@ -347,7 +347,8 @@ static int convert_to_symlink(const char
-   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
-      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,43 @@ 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 -rup p7zip_15.09.orig/CPP/Windows/FileDir.h p7zip_15.09/CPP/Windows/FileDir.h
---- p7zip_15.09.orig/CPP/Windows/FileDir.h	2015-06-19 11:52:06.000000000 +0100
-+++ p7zip_15.09/CPP/Windows/FileDir.h	2015-12-03 02:22:47.075724215 +0000
-@@ -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/files/p7zip-15.14-darwin.patch b/app-arch/p7zip/files/p7zip-15.14-darwin.patch
deleted file mode 100644
index 412b838cedd..00000000000
--- a/app-arch/p7zip/files/p7zip-15.14-darwin.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Darwin has wchar_h and wctypes_h.
-El Capitan needs <sys/types.h> for ino_t.
-
---- CPP/myWindows/config.h
-+++ CPP/myWindows/config.h
-@@ -5,7 +5,7 @@
-   #define FILESYSTEM_IS_CASE_SENSITIVE 1
- #endif
- 
--  #if !defined(ENV_MACOSX) && !defined(ENV_BEOS)
-+  #if !defined(ENV_BEOS)
- 
-     /* <wchar.h> */
-     /* ENV_HAVE_WCHAR__H and not ENV_HAVE_WCHAR_H to avoid warning with wxWidgets */
---- CPP/myWindows/StdAfx.h
-+++ 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-15.14.1-darwin.patch b/app-arch/p7zip/files/p7zip-15.14.1-darwin.patch
deleted file mode 100644
index e7f40f50528..00000000000
--- a/app-arch/p7zip/files/p7zip-15.14.1-darwin.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- 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
deleted file mode 100644
index 619ff2dda83..00000000000
--- a/app-arch/p7zip/files/p7zip-9.20.1-CVE-2015-1038.patch
+++ /dev/null
@@ -1,315 +0,0 @@
-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: https://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
deleted file mode 100644
index 8845aca2070..00000000000
--- a/app-arch/p7zip/files/p7zip-9.20.1-QA.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index 1fdff481cf3..00000000000
--- a/app-arch/p7zip/files/p7zip-9.20.1-execstack.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-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-9.38.1-CVE-2015-1038.patch b/app-arch/p7zip/files/p7zip-9.38.1-CVE-2015-1038.patch
deleted file mode 100644
index 290ebbdbe68..00000000000
--- a/app-arch/p7zip/files/p7zip-9.38.1-CVE-2015-1038.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-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: https://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
-@@ -1215,7 +1215,7 @@ STDMETHODIMP CAgentFolder::Extract(const
-   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
- }
---- a/CPP/7zip/UI/Client7z/Client7z.cpp
-+++ b/CPP/7zip/UI/Client7z/Client7z.cpp
-@@ -222,8 +222,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;
-@@ -441,11 +444,23 @@ STDMETHODIMP CArchiveExtractCallback::Se
-   }
-   _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)
- {
-@@ -912,6 +927,8 @@ int MY_CDECL main(int numArgs, const cha
-       // 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");
---- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
-+++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
-@@ -1083,7 +1083,7 @@ STDMETHODIMP CArchiveExtractCallback::Se
-     NumFiles++;
- 
-   if (_extractMode && _fi.AttribDefined)
--    SetFileAttrib(_diskFilePath, _fi.Attrib);
-+    SetFileAttrib(_diskFilePath, _fi.Attrib, &_delayedSymLinks);
-   RINOK(_extractCallback2->SetOperationResult(operationResult, _encrypted));
-   return S_OK;
-   COM_TRY_END
-@@ -1149,8 +1149,9 @@ static int GetNumSlashes(const FChar *s)
-   }
- }
- 
--HRESULT CArchiveExtractCallback::SetDirsTimes()
-+HRESULT CArchiveExtractCallback::SetFinalAttribs()
- {
-+  HRESULT result = S_OK;
-   CRecordVector<CExtrRefSortPair> pairs;
-   pairs.ClearAndSetSize(_extractedFolderPaths.Size());
-   unsigned i;
-@@ -1187,5 +1188,12 @@ HRESULT CArchiveExtractCallback::SetDirs
-       (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;
- }
---- 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"
-@@ -213,6 +215,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();
-@@ -293,7 +297,7 @@ public:
-     _baseParentFolder = indexInArc;
-   }
- 
--  HRESULT SetDirsTimes();
-+  HRESULT SetFinalAttribs();
- };
- 
- #endif
---- a/CPP/7zip/UI/Common/Extract.cpp
-+++ b/CPP/7zip/UI/Common/Extract.cpp
-@@ -170,7 +170,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);
- }
- 
---- a/CPP/Windows/FileDir.cpp
-+++ b/CPP/Windows/FileDir.cpp
-@@ -343,7 +343,8 @@ static int convert_to_symlink(const char
-   return -1;
- }
- 
--bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes)
-+bool SetFileAttrib(CFSTR fileName, DWORD fileAttributes,
-+		   CObjectVector<CDelayedSymLink> *delayedSymLinks)
- {
-   if (!fileName) {
-     SetLastError(ERROR_PATH_NOT_FOUND);
-@@ -375,7 +376,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD
-      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;
-         }
-@@ -885,6 +888,43 @@ 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
-+
- }}}
- 
- 
---- 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
-@@ -69,6 +73,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/files/p7zip-9.38.1-osversion.patch b/app-arch/p7zip/files/p7zip-9.38.1-osversion.patch
deleted file mode 100644
index 49e0653e43e..00000000000
--- a/app-arch/p7zip/files/p7zip-9.38.1-osversion.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur old/CPP/7zip/UI/FileManager/FM.cpp new/CPP/7zip/UI/FileManager/FM.cpp
---- old/CPP/7zip/UI/FileManager/FM.cpp	2015-01-18 08:59:09.000000000 -1000
-+++ new/CPP/7zip/UI/FileManager/FM.cpp	2015-02-09 11:39:55.575712452 -1000
-@@ -348,24 +348,7 @@
- 
- bool IsLargePageSupported()
- {
--  #ifdef _WIN64
-   return true;
--  #else
--  OSVERSIONINFO versionInfo;
--  versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
--  if (!::GetVersionEx(&versionInfo))
--    return false;
--  if (versionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || versionInfo.dwMajorVersion < 5)
--    return false;
--  if (versionInfo.dwMajorVersion > 5)
--    return true;
--  if (versionInfo.dwMinorVersion < 1)
--    return false;
--  if (versionInfo.dwMinorVersion > 1)
--    return true;
--  // return IsWow64();
--  return false;
--  #endif
- }
- 
- #if 0 //#ifndef UNDER_CE


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

* [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/
@ 2018-05-31 12:14 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2018-05-31 12:14 UTC (permalink / raw
  To: gentoo-commits

commit:     caffb5623f45dfeb423db72bbdbee32b537757e2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May 31 12:13:46 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May 31 12:13:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=caffb562

app-arch/p7zip: include patch for >=clang-6, bug #655386

Closes: https://bugs.gentoo.org/655386
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 app-arch/p7zip/files/p7zip-16.02-darwin.patch | 35 +++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app-arch/p7zip/files/p7zip-16.02-darwin.patch b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
index 1ee5d3434b9..1c3899f30a5 100644
--- a/app-arch/p7zip/files/p7zip-16.02-darwin.patch
+++ b/app-arch/p7zip/files/p7zip-16.02-darwin.patch
@@ -9,3 +9,38 @@
  #include <sys/types.h>
  #endif
  
+
+https://svnweb.freebsd.org/ports/head/archivers/p7zip/files/patch-CPP_Windows_ErrorMsg.cpp?view=markup&pathrev=458172
+This fixes the build with Clang 6.0:
+
+ ../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka  'unsigned int') [-Wc++11-narrowing]
+     case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
+          ^
+ ../../../../CPP/Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
+ #define E_INVALIDARG ((HRESULT)0x80070057L)
+                      ^
+
+The HRESULT cast in the macro causes the value to be read as signed int.
+--- a/CPP/Windows/ErrorMsg.cpp
++++ b/CPP/Windows/ErrorMsg.cpp
+@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
+ 
+   switch(errorCode) {
+     case ERROR_NO_MORE_FILES   : txt = "No more files"; break ;
+-    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
+-    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
+-    case E_ABORT               : txt = "E_ABORT"; break ;
+-    case E_FAIL                : txt = "E_FAIL"; break ;
+-    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
+-    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
+-    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
++    case (DWORD)(E_NOTIMPL)             : txt = "E_NOTIMPL"; break ;
++    case (DWORD)(E_NOINTERFACE)         : txt = "E_NOINTERFACE"; break ;
++    case (DWORD)(E_ABORT)               : txt = "E_ABORT"; break ;
++    case (DWORD)(E_FAIL)                : txt = "E_FAIL"; break ;
++    case (DWORD)(STG_E_INVALIDFUNCTION) : txt = "STG_E_INVALIDFUNCTION"; break ;
++    case (DWORD)(E_OUTOFMEMORY)         : txt = "E_OUTOFMEMORY"; break ;
++    case (DWORD)(E_INVALIDARG)          : txt = "E_INVALIDARG"; break ;
+     case ERROR_DIRECTORY          : txt = "Error Directory"; break ;
+     default:
+       txt = strerror(errorCode);


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

end of thread, other threads:[~2018-05-31 12:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-03 11:57 [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/files/ Patrice Clement
  -- strict thread matches above, loose matches on Subject: below --
2018-05-31 12:14 Fabian Groffen
2017-08-08 22:43 Matt Thode
2016-04-10  9:49 Lars Wendler
2016-03-28  7:26 Fabian Groffen
2015-12-03 10: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