commit c850b9f1a960788be51687ebabfabe8490de4fb3
Author: Jakub Bogusz <[email protected]>
Date:   Sat May 21 19:18:05 2022 +0200

    - added regex-lock patch (avoid SEGV on parallel lf_db_load() calls done by 
gegl)

 lensfun-regex-lock.patch | 37 +++++++++++++++++++++++++++++++++++++
 lensfun.spec             |  2 ++
 2 files changed, 39 insertions(+)
---
diff --git a/lensfun.spec b/lensfun.spec
index 89e9968..46a59d8 100644
--- a/lensfun.spec
+++ b/lensfun.spec
@@ -20,6 +20,7 @@ Group:                Libraries
 #Source0Download: https://github.com/lensfun/lensfun/releases
 Source0:       
https://github.com/lensfun/lensfun/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5: 04e0b58fd685ee680b0d70d61f0a5c17
+Patch0:                %{name}-regex-lock.patch
 URL:           http://lensfun.sourceforge.net/
 BuildRequires: cmake >= 2.8
 BuildRequires: docutils
@@ -86,6 +87,7 @@ Interfejs Pythoan 3 do lensfun.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' 
apps/lensfun-{add-adapter,update-data}
 %{__sed} -i -e '1s,/usr/bin/env sh,%{__sh},' apps/g-lensfun-update-data
diff --git a/lensfun-regex-lock.patch b/lensfun-regex-lock.patch
new file mode 100644
index 0000000..254d02e
--- /dev/null
+++ b/lensfun-regex-lock.patch
@@ -0,0 +1,37 @@
+gegl calls lf_db_load() in parallel, glibc doesn't support parallel regcomp() 
of the same regex
+
+--- lensfun-0.3.3/libs/lensfun/lens.cpp.orig   2022-02-22 21:49:04.000000000 
+0100
++++ lensfun-0.3.3/libs/lensfun/lens.cpp        2022-05-21 18:13:46.981677714 
+0200
+@@ -15,6 +15,12 @@
+ #include "windows/mathconstants.h"
+ #include <algorithm>
+ 
++#if defined(GLIB_CHECK_VERSION) && GLIB_CHECK_VERSION(2,32,0)
++static GMutex lens_name_regex_lock;
++#else
++static GStaticMutex lock = G_STATIC_MUTEX_INIT;
++#endif
++
+ static struct
+ {
+     const char *regex;
+@@ -69,9 +75,19 @@ static bool _lf_parse_lens_name (const c
+     {
+         if (!lens_name_regex [i].compiled)
+         {
++#if defined(GLIB_CHECK_VERSION) && GLIB_CHECK_VERSION(2,32,0)
++            g_mutex_lock (&lens_name_regex_lock);
++#else
++            g_static_mutex_lock (&lens_name_regex_lock);
++#endif
+             regcomp (&lens_name_regex [i].rex, lens_name_regex [i].regex,
+                      REG_EXTENDED | REG_ICASE);
+             lens_name_regex [i].compiled = true;
++#if defined(GLIB_CHECK_VERSION) && GLIB_CHECK_VERSION(2,32,0)
++            g_mutex_unlock (&lens_name_regex_lock);
++#else
++            g_static_mutex_unlock (&lens_name_regex_lock);
++#endif
+         }
+ 
+         regmatch_t matches [10];
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lensfun.git/commitdiff/c850b9f1a960788be51687ebabfabe8490de4fb3

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to