[Libreoffice-commits] core.git: external/gpgmepp external/libgpg-error

Thorsten Behrens thorsten.behrens at cib.de
Fri Nov 24 15:04:05 UTC 2017


 external/gpgmepp/UnpackedTarball_gpgmepp.mk           |    1 
 external/gpgmepp/w32-add-initializer.patch.1          |   16 +++++
 external/libgpg-error/UnpackedTarball_libgpg-error.mk |    1 
 external/libgpg-error/w32-disable-dllinit.patch.1     |   55 ++++++++++++++++++
 4 files changed, 73 insertions(+)

New commits:
commit b9c2fac7bc81866c01b7179796861533aadc190b
Author: Thorsten Behrens <thorsten.behrens at cib.de>
Date:   Thu Nov 23 18:09:19 2017 +0100

    gpg4libre: call libgpg-error subsystem init
    
    Due to a string of unhelpful coincidences, _gpgrt_lock_init never
    got called in libgpg-error for Windows; resulting in occasional
    crashes.
    
    Change-Id: I95f508e4622777c21f90c76dce5b5ff420c81fa1
    Reviewed-on: https://gerrit.libreoffice.org/45191
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Siegmund Gorr <siegmund.gorr at cib.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index db8c398e3003..8f69b8d2af96 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -21,5 +21,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
     $(if $(filter MSC,$(COM)),external/gpgmepp/w32-disable-docs.patch.1) \
     $(if $(filter MSC,$(COM)),external/gpgmepp/w32-fix-win32-macro.patch.1) \
     $(if $(filter MSC,$(COM)),external/gpgmepp/w32-fix-libtool.patch.1) \
+    $(if $(filter MSC,$(COM)),external/gpgmepp/w32-add-initializer.patch.1) \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/w32-add-initializer.patch.1 b/external/gpgmepp/w32-add-initializer.patch.1
new file mode 100644
index 000000000000..b33f0d42a95f
--- /dev/null
+++ b/external/gpgmepp/w32-add-initializer.patch.1
@@ -0,0 +1,16 @@
+Make sure the gpgrt_lock_init gets called in libgpg-error, otherwise
+several critical section statics are uninitialized
+
+diff -ur gpgmepp.org/src/version.c gpgmepp/src/version.c
+--- gpgmepp.org/src/version.c	2016-11-16 13:22:41.000000000 +0100
++++ gpgmepp/src/version.c	2017-11-23 17:16:35.218735200 +0100
+@@ -66,6 +66,9 @@
+     return;
+ 
+ #ifdef HAVE_W32_SYSTEM
++  // initialize libgpg-error stuff
++  gpg_err_init();
++
+   /* We need to make sure that the sockets are initialized.  */
+   {
+     WSADATA wsadat;
diff --git a/external/libgpg-error/UnpackedTarball_libgpg-error.mk b/external/libgpg-error/UnpackedTarball_libgpg-error.mk
index 2d662f4161d2..02ad356444ee 100644
--- a/external/libgpg-error/UnpackedTarball_libgpg-error.mk
+++ b/external/libgpg-error/UnpackedTarball_libgpg-error.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libgpg-error, \
 	$(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes.patch) \
 	$(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes-2.patch.1) \
 	$(if $(filter MSC,$(COM)),external/libgpg-error/w32-build-fixes-3.patch.1) \
+	$(if $(filter MSC,$(COM)),external/libgpg-error/w32-disable-dllinit.patch.1) \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libgpg-error/w32-disable-dllinit.patch.1 b/external/libgpg-error/w32-disable-dllinit.patch.1
new file mode 100644
index 000000000000..96abb3bbdc52
--- /dev/null
+++ b/external/libgpg-error/w32-disable-dllinit.patch.1
@@ -0,0 +1,55 @@
+Disable all DLL init functions in libgpg-error, since they're
+not actually run in statically linked libs. And libtool seems
+to unconditionally set that flag on all Windows builds.
+
+diff -ur libgpg-error.org/src/init.c libgpg-error/src/init.c
+--- libgpg-error.org/src/init.c	2017-02-28 10:11:05.000000000 +0100
++++ libgpg-error/src/init.c	2017-11-23 16:44:56.850797400 +0100
+@@ -88,7 +88,7 @@
+ _gpg_err_init (void)
+ {
+ #ifdef HAVE_W32_SYSTEM
+-# ifdef DLL_EXPORT
++# ifdef HAVE_DLL_INIT
+   /* We always have a constructor and thus this function is called
+      automatically.  Due to the way the C init code of mingw works,
+      the constructors are called before our DllMain function is
+@@ -130,7 +130,7 @@
+ void
+ _gpg_err_deinit (int mode)
+ {
+-#if defined (HAVE_W32_SYSTEM) && !defined(DLL_EXPORT)
++#if defined (HAVE_W32_SYSTEM) && !defined(HAVE_DLL_INIT)
+   struct tls_space_s *tls;
+ 
+   tls = TlsGetValue (tls_index);
+@@ -473,7 +473,7 @@
+ 
+ 
+ /* Entry point called by the DLL loader.  */
+-#ifdef DLL_EXPORT
++#ifdef HAVE_DLL_INIT
+ int WINAPI
+ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
+ {
+diff -ur libgpg-error.org/src/w32-gettext.c libgpg-error/src/w32-gettext.c
+--- libgpg-error.org/src/w32-gettext.c	2016-12-02 22:51:19.000000000 +0100
++++ libgpg-error/src/w32-gettext.c	2017-11-23 16:43:28.450453000 +0100
+@@ -1180,7 +1180,7 @@
+    DLL.  If used as a static lib we can't control the process set; for
+    example it might be used with a main module which is not build with
+    mingw and thus does not know how to call the constructors.  */
+-#ifdef DLL_EXPORT
++#ifdef HAVE_DLL_INIT
+ static void module_init (void) _GPG_ERR_CONSTRUCTOR;
+ #endif
+ static void
+@@ -1195,7 +1195,7 @@
+     }
+ }
+ 
+-#if !defined(DLL_EXPORT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
++#if !defined(HAVE_DLL_INIT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
+ void
+ _gpg_w32__init_gettext_module (void)
+ {


More information about the Libreoffice-commits mailing list