]> git.pld-linux.org Git - packages/lensfun.git/commitdiff
- added regex-lock patch (avoid SEGV on parallel lf_db_load() calls done by gegl) auto/th/lensfun-0.3.3-1
authorJakub Bogusz <qboosh@pld-linux.org>
Sat, 21 May 2022 17:18:05 +0000 (19:18 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Sat, 21 May 2022 17:18:05 +0000 (19:18 +0200)
lensfun-regex-lock.patch [new file with mode: 0644]
lensfun.spec

diff --git a/lensfun-regex-lock.patch b/lensfun-regex-lock.patch
new file mode 100644 (file)
index 0000000..254d02e
--- /dev/null
@@ -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];
index 89e9968c97aa62e04b51a236f185ba59f9de4e87..46a59d857b2e8ba66511163c4e46138d249d1013 100644 (file)
@@ -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
This page took 0.15832 seconds and 4 git commands to generate.