From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Nov 10 21:40:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C9B3A8B0 for ; Sun, 10 Nov 2013 21:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A8A4123CC for ; Sun, 10 Nov 2013 21:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rAALe0qE055045 for ; Sun, 10 Nov 2013 21:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rAALe0qE055044; Sun, 10 Nov 2013 21:40:00 GMT (envelope-from gnats) Resent-Date: Sun, 10 Nov 2013 21:40:00 GMT Resent-Message-Id: <201311102140.rAALe0qE055044@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Senno Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 504EB888 for ; Sun, 10 Nov 2013 21:39:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3D74F23BD for ; Sun, 10 Nov 2013 21:39:26 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rAALdQDs069603 for ; Sun, 10 Nov 2013 21:39:26 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rAALdQ6g069602; Sun, 10 Nov 2013 21:39:26 GMT (envelope-from nobody) Message-Id: <201311102139.rAALdQ6g069602@oldred.freebsd.org> Date: Sun, 10 Nov 2013 21:39:26 GMT From: Senno To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/183849: [patch] security/py-pycryptopp: unbreak clang build X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2013 21:40:00 -0000 >Number: 183849 >Category: ports >Synopsis: [patch] security/py-pycryptopp: unbreak clang build >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 10 21:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Senno >Release: >Organization: >Environment: To use ASM optimizations with Clang disable its integrated assembler and rebuild python port as well as py-pycryptopp e.g., $ echo CFLAGS+=-no-integrated-as >>/etc/make.conf $ cd lang/python27; make reinstall # to pick up new CFLAGS $ cd security/py-pycryptopp; make install >Description: setup.py assumes as(1) is used during build which isn't true. It's only used if $CXX actually calls it and clang by default doesn't. Equivalent issue existed in security/cryptopp and fixed in ports/154325. >How-To-Repeat: # patch-setup.py fixes the following error $ make [...] clang -DNDEBUG -O2 -pipe -fPIC -I. -I/usr/local/include/python2.7 -c embeddedcryptopp/sosemanuk.cpp -o temp.freebsd-10-amd64-2.7/embeddedcryptopp/sosemanuk.o -w embeddedcryptopp/sosemanuk.cpp:356:3: error: Unexpected token! ".intel_syntax noprefix;" ^ :1:40: note: instantiated into assembly here .intel_syntax noprefix;mov QWORD PTR [%r11+1*8], rdi;mov QWORD PTR [... ^ embeddedcryptopp/sosemanuk.cpp:356:3: error: unexpected token in argument list ".intel_syntax noprefix;" ^ [...] # patch-299a99e fixes the following error $ make [...] clang -DNDEBUG -O2 -pipe -fPIC -DCRYPTOPP_DISABLE_ASM=1 -I. -I/usr/local/include/python2.7 -c embeddedcryptopp/cryptlib.cpp -o temp.freebsd-10-amd64-2.7/embeddedcryptopp/cryptlib.o -w embeddedcryptopp/cryptlib.cpp:33:26: error: default initialization of an object of const type 'const CryptoPP::NullNameValuePairs' requires a user-provided default constructor const NullNameValuePairs g_nullNameValuePairs; ^ 1 error generated. error: command 'cc' failed with exit status 1 *** Error code 1 >Fix: --- patch.txt begins here --- Index: security/py-pycryptopp/Makefile =================================================================== --- security/py-pycryptopp/Makefile (revision 333423) +++ security/py-pycryptopp/Makefile (working copy) @@ -15,15 +15,8 @@ BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}darcsver>0:$ RUN_DEPENDS:= ${BUILD_DEPENDS} USE_PYTHON= yes -USE_GCC= yes USE_PYDISTUTILS=easy_install PYEASYINSTALL_ARCHDEP= yes NO_STAGE= yes -post-extract: - @${REINPLACE_CMD} -e 's###g' \ - ${WRKSRC}/embeddedcryptopp/rijndael.cpp \ - ${WRKSRC}/embeddedcryptopp/config.h \ - ${WRKSRC}/embeddedcryptopp/secblock.h - .include Index: security/py-pycryptopp/files/patch-299a99e =================================================================== --- security/py-pycryptopp/files/patch-299a99e (revision 0) +++ security/py-pycryptopp/files/patch-299a99e (working copy) @@ -0,0 +1,229 @@ +From 299a99ed04d93d811fe3039fc669253644fba848 Mon Sep 17 00:00:00 2001 +From: Zooko O'Whielacronx +Date: Wed, 25 Jan 2012 05:27:37 -0700 +Subject: apply http://bazaar.launchpad.net/~zooko/cryptopp/trunk/revision/466 + , which I believe is Wei Dai's attempt to fix + https://tahoe-lafs.org/trac/pycryptopp/ticket/44 + +--- + embeddedcryptopp/cryptlib.cpp | 9 ++++++++- + embeddedcryptopp/cryptlib.h | 9 +-------- + embeddedcryptopp/misc.h | 43 +++++++++++++++++-------------------------- + embeddedcryptopp/rijndael.cpp | 8 -------- + embeddedcryptopp/secblock.h | 9 +++++---- + embeddedcryptopp/smartptr.h | 4 ++-- + embeddedcryptopp/stdcpp.h | 18 +++++++++++------- + 7 files changed, 44 insertions(+), 56 deletions(-) + +diff --git embeddedcryptopp/cryptlib.cpp embeddedcryptopp/cryptlib.cpp +index 0e5bd24..dadd9ce 100644 +--- embeddedcryptopp/cryptlib.cpp ++++ embeddedcryptopp/cryptlib.cpp +@@ -30,7 +30,14 @@ const std::string DEFAULT_CHANNEL; + const std::string AAD_CHANNEL = "AAD"; + const std::string &BufferedTransformation::NULL_CHANNEL = DEFAULT_CHANNEL; + +-const NullNameValuePairs g_nullNameValuePairs; ++class NullNameValuePairs : public NameValuePairs ++{ ++public: ++ bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const {return false;} ++}; ++ ++simple_ptr s_pNullNameValuePairs(new NullNameValuePairs); ++const NameValuePairs &g_nullNameValuePairs = *s_pNullNameValuePairs.m_p; + + BufferedTransformation & TheBitBucket() + { +diff --git embeddedcryptopp/cryptlib.h embeddedcryptopp/cryptlib.h +index 15cd6da..b5faa58 100644 +--- embeddedcryptopp/cryptlib.h ++++ embeddedcryptopp/cryptlib.h +@@ -318,14 +318,7 @@ DOCUMENTED_NAMESPACE_BEGIN(Name) + DOCUMENTED_NAMESPACE_END + + //! empty set of name-value pairs +-class CRYPTOPP_DLL NullNameValuePairs : public NameValuePairs +-{ +-public: +- bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const {return false;} +-}; +- +-//! _ +-extern CRYPTOPP_DLL const NullNameValuePairs g_nullNameValuePairs; ++extern CRYPTOPP_DLL const NameValuePairs &g_nullNameValuePairs; + + // ******************************************************** + +diff --git embeddedcryptopp/misc.h embeddedcryptopp/misc.h +index de8037b..b7317e9 100644 +--- embeddedcryptopp/misc.h ++++ embeddedcryptopp/misc.h +@@ -6,7 +6,6 @@ + #include // for memcpy and memmove + + #ifdef _MSC_VER +- #include + #if _MSC_VER >= 1400 + // VC2005 workaround: disable declarations that conflict with winnt.h + #define _interlockedbittestandset CRYPTOPP_DISABLED_INTRINSIC_1 +@@ -101,9 +100,9 @@ struct NewObject + T* operator()() const {return new T;} + }; + +-/*! This function safely initializes a static object in a multithreaded environment without using locks. +- It may leak memory when two threads try to initialize the static object at the same time +- but this should be acceptable since each static object is only initialized once per session. ++/*! This function safely initializes a static object in a multithreaded environment without using locks (for portability). ++ Note that if two threads call Ref() at the same time, they may get back different references, and one object ++ may end up being memory leaked. This is by design. + */ + template , int instance=0> + class Singleton +@@ -121,31 +120,23 @@ private: + template + const T & Singleton::Ref(CRYPTOPP_NOINLINE_DOTDOTDOT) const + { +- static simple_ptr s_pObject; +- static char s_objectState = 0; ++ static volatile simple_ptr s_pObject; ++ T *p = s_pObject.m_p; + +-retry: +- switch (s_objectState) ++ if (p) ++ return *p; ++ ++ T *newObject = m_objectFactory(); ++ p = s_pObject.m_p; ++ ++ if (p) + { +- case 0: +- s_objectState = 1; +- try +- { +- s_pObject.m_p = m_objectFactory(); +- } +- catch(...) +- { +- s_objectState = 0; +- throw; +- } +- s_objectState = 2; +- break; +- case 1: +- goto retry; +- default: +- break; ++ delete newObject; ++ return *p; + } +- return *s_pObject.m_p; ++ ++ s_pObject.m_p = newObject; ++ return *newObject; + } + + // ************** misc functions *************** +diff --git embeddedcryptopp/rijndael.cpp embeddedcryptopp/rijndael.cpp +index 1699e1f..ba9bcc8 100644 +--- embeddedcryptopp/rijndael.cpp ++++ embeddedcryptopp/rijndael.cpp +@@ -69,14 +69,6 @@ being unloaded from L1 cache, until that round is finished. + #include "misc.h" + #include "cpu.h" + +-#ifdef __sun +-#include +-#endif +- +-#ifdef __MINGW32__ +-#include +-#endif +- + NAMESPACE_BEGIN(CryptoPP) + + #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS +diff --git embeddedcryptopp/secblock.h embeddedcryptopp/secblock.h +index fb55014..6300e27 100644 +--- embeddedcryptopp/secblock.h ++++ embeddedcryptopp/secblock.h +@@ -9,8 +9,6 @@ + + #if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX) + #include +-#else +- #include + #endif + + NAMESPACE_BEGIN(CryptoPP) +@@ -352,8 +350,11 @@ public: + //! copy contents and size from another SecBlock + void Assign(const SecBlock &t) + { +- New(t.m_size); +- memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T)); ++ if (this != &t) ++ { ++ New(t.m_size); ++ memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T)); ++ } + } + + SecBlock& operator=(const SecBlock &t) +diff --git embeddedcryptopp/smartptr.h embeddedcryptopp/smartptr.h +index 6b4040e..a0a727e 100644 +--- embeddedcryptopp/smartptr.h ++++ embeddedcryptopp/smartptr.h +@@ -9,8 +9,8 @@ NAMESPACE_BEGIN(CryptoPP) + template class simple_ptr + { + public: +- simple_ptr() : m_p(NULL) {} +- ~simple_ptr() {delete m_p;} ++ simple_ptr(T *p = NULL) : m_p(p) {} ++ ~simple_ptr() {delete m_p; m_p = NULL;} // set m_p to NULL so double destruction (which might occur in Singleton) will be harmless + T *m_p; + }; + +diff --git embeddedcryptopp/stdcpp.h embeddedcryptopp/stdcpp.h +index 9a468ab..234bf54 100644 +--- embeddedcryptopp/stdcpp.h ++++ embeddedcryptopp/stdcpp.h +@@ -4,24 +4,28 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include + #include +- +- +-#ifdef _MSC_VER +-#include // CodeWarrior doesn't have memory.h + #include + #include + #include + +-// re-disable this +-#pragma warning(disable: 4231) ++// for alloca ++#ifdef __sun ++#include ++#elif defined(__MINGW32__) ++#include + #endif + +-#if defined(_MSC_VER) && defined(_CRTAPI1) ++#ifdef _MSC_VER ++#pragma warning(disable: 4231) // re-disable this ++#ifdef _CRTAPI1 + #define CRYPTOPP_MSVCRT6 + #endif ++#endif + + #endif Property changes on: security/py-pycryptopp/files/patch-299a99e ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: security/py-pycryptopp/files/patch-embeddedcryptopp_secblock.h =================================================================== --- security/py-pycryptopp/files/patch-embeddedcryptopp_secblock.h (revision 333423) +++ security/py-pycryptopp/files/patch-embeddedcryptopp_secblock.h (working copy) @@ -1,5 +1,14 @@ --- embeddedcryptopp/secblock.h.orig 2013-11-02 21:05:08.220199000 +0000 +++ embeddedcryptopp/secblock.h +@@ -8,7 +8,7 @@ + #include + + #if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX) +- #include ++ #include + #endif + + NAMESPACE_BEGIN(CryptoPP) @@ -94,7 +94,7 @@ public: pointer allocate(size_type n, const void * = NULL) Index: security/py-pycryptopp/files/patch-setup.py =================================================================== --- security/py-pycryptopp/files/patch-setup.py (revision 0) +++ security/py-pycryptopp/files/patch-setup.py (working copy) @@ -0,0 +1,18 @@ +--- setup.py~ ++++ setup.py +@@ -138,12 +138,13 @@ + # Mac OS-X 10.6 is too old. + + try: +- sp = subprocess.Popen(['as', '-v'], stdin=subprocess.PIPE, ++ sp = subprocess.Popen((os.getenv('CXX') or 'c++').split(' ') + (os.getenv('CXXFLAGS') or '').split(' ') + ['-xc', '-c', '-', '-o', '/dev/null', '-Wa,-v'], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True) + sp.stdin.close() + sp.wait() ++ as_version=sp.stderr.read() +- if re.search("GNU assembler version (0|1|2.0)", sp.stderr.read()): ++ if not re.search("GNU assembler", as_version) or re.search("version (0|1|2.0)", as_version): + define_macros.append(('CRYPTOPP_DISABLE_ASM', 1)) + except EnvironmentError: + # Okay, nevermind. Maybe there isn't even an 'as' executable on this Property changes on: security/py-pycryptopp/files/patch-setup.py ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property --- patch.txt ends here --- >Release-Note: >Audit-Trail: >Unformatted: