external/gpgmepp/UnpackedTarball_gpgmepp.mk |    1 
 external/gpgmepp/macos-tdf152524.patch      |   64 ++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)

New commits:
commit 839cf255e2670fdf8e974af38432aacf63be4e90
Author:     Patrick Luby <[email protected]>
AuthorDate: Mon Feb 5 19:52:14 2024 -0500
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Feb 7 09:46:25 2024 +0100

    tdf#152524 fork() and exec() in a separate libdispatch queue
    
    This is another attempt to stop the crashing in libdispatch by
    running fork() and exec() within a libdispatch task that will
    run in a sequential queue in a non-main thread.
    
    Change-Id: I3249510c14cc32f7f769b59289fe8380dd22ab68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163036
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index d7b7a8ab4dbe..dcbda38d591d 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -34,5 +34,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
     external/gpgmepp/w32-include.patch \
     external/gpgmepp/Wincompatible-function-pointer-types.patch \
     external/gpgmepp/macos-macports-path.patch \
+    external/gpgmepp/macos-tdf152524.patch \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
new file mode 100644
index 000000000000..a69fbd1cf139
--- /dev/null
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -0,0 +1,64 @@
+--- src/posix-io.c     2023-02-01 11:50:48
++++ src/posix-io.c     2024-02-05 19:16:00
+@@ -62,6 +62,10 @@
+ # endif
+ #endif
+ #include <sys/socket.h>
++
++#if HAVE_MACOS_SYSTEM
++#include <dispatch/dispatch.h>
++#endif
+ 
+ #include "util.h"
+ #include "priv-io.h"
+@@ -517,12 +521,50 @@
+ }
+ 
+ 
++#if HAVE_MACOS_SYSTEM
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++                     struct spawn_fd_item_s *fd_list,
++                     void (*atfork) (void *opaque, int reserved),
++                     void *atforkvalue, pid_t *r_pid);
++#endif /*HAVE_MACOS_SYSTEM*/
++
++
+ /* Returns 0 on success, -1 on error.  */
+ int
+ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
+                struct spawn_fd_item_s *fd_list,
+                void (*atfork) (void *opaque, int reserved),
+                void *atforkvalue, pid_t *r_pid)
++#if HAVE_MACOS_SYSTEM
++{
++      /* tdf#152524 fork() and exec() in a separate libdispatch queue
++       * This is another attempt to stop the crashing in libdispatch by
++       * running fork() and exec() within a libdispatch task that will
++       * run in a sequential queue in a non-main thread.  */
++      static dispatch_queue_t queue = NULL;
++      if (!queue)
++              queue = dispatch_queue_create ("gpgmepp",
++                                             DISPATCH_QUEUE_CONCURRENT);
++      if (!queue)
++              return -1;
++
++      __block int ret = -1;
++      dispatch_sync(queue, ^{
++              ret = _gpgme_io_spawn_macos (path, argv, flags,
++                                           fd_list, atfork,
++                                           atforkvalue, r_pid);
++      });
++
++      return ret;
++}
++
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++                     struct spawn_fd_item_s *fd_list,
++                     void (*atfork) (void *opaque, int reserved),
++                     void *atforkvalue, pid_t *r_pid)
++#endif /*HAVE_MACOS_SYSTEM*/
+ {
+   pid_t pid;
+   int i;

Reply via email to