all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#42476: Krita fails to start
@ 2020-07-22 17:51 Leo Famulari
  2020-07-23 20:44 ` Leo Famulari
  2020-07-24  2:41 ` Boris A. Dekshteyn
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Famulari @ 2020-07-22 17:51 UTC (permalink / raw)
  To: 42476

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

Currently, Krita fails to start after loading its splash screen. It just
hangs forever.

I found this upstream bug report in Qt:

https://bugreports.qt.io/browse/QTBUG-83207

Currently, I'm testing the build of Krita based on the Qt patch in that
bug report.

I've attached my patch.

[-- Attachment #2: 0001-gnu-Fix-Krita.patch --]
[-- Type: text/plain, Size: 6788 bytes --]

From 616b65411505555f71e44618eeb969cf6aa64f02 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Wed, 22 Jul 2020 13:47:39 -0400
Subject: [PATCH] gnu: Fix Krita.

* gnu/packages/patches/qtbase-fix-krita-deadlock.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/kde.scm (qtbase-for-krita): New variable.
(krita)[inputs]: Replace qtbase with qtbase-for-krita.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/kde.scm                          |  10 +-
 .../patches/qtbase-fix-krita-deadlock.patch   | 110 ++++++++++++++++++
 gnu/packages/qt.scm                           |   1 +
 4 files changed, 121 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/qtbase-fix-krita-deadlock.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a1bd6a644a..6464181548 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1488,6 +1488,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/qrcodegen-cpp-make-install.patch		\
   %D%/packages/patches/qt4-ldflags.patch			\
   %D%/packages/patches/qtbase-absolute-runpath.patch		\
+  %D%/packages/patches/qtbase-fix-krita-deadlock.patch		\
   %D%/packages/patches/qtbase-moc-ignore-gcc-macro.patch	\
   %D%/packages/patches/qtbase-use-TZDIR.patch			\
   %D%/packages/patches/qtscript-disable-tests.patch		\
diff --git a/gnu/packages/kde.scm b/gnu/packages/kde.scm
index 9a80e362b6..9fa8ed7c15 100644
--- a/gnu/packages/kde.scm
+++ b/gnu/packages/kde.scm
@@ -360,6 +360,14 @@ a module for implementing ODF Gantt charts, which are bar charts that
 illustrate project schedules.")
     (license license:gpl2+)))
 
+(define qtbase-for-krita
+  (package
+    (inherit qtbase)
+    (source (origin
+              (inherit (package-source qtbase))
+              (patches (append (origin-patches (package-source qtbase))
+                               (search-patches "qtbase-fix-krita-deadlock.patch")))))))
+
 (define-public krita
   (package
     (name "krita")
@@ -434,7 +442,7 @@ illustrate project schedules.")
        ("openexr" ,openexr)
        ("perl" ,perl)
        ("poppler-qt5" ,poppler-qt5)
-       ("qtbase" ,qtbase)
+       ("qtbase" ,qtbase-for-krita)
        ("qtdeclarative" ,qtdeclarative)
        ("qtmultimedia" ,qtmultimedia)
        ("qtsvg" ,qtsvg)
diff --git a/gnu/packages/patches/qtbase-fix-krita-deadlock.patch b/gnu/packages/patches/qtbase-fix-krita-deadlock.patch
new file mode 100644
index 0000000000..d3554be3c9
--- /dev/null
+++ b/gnu/packages/patches/qtbase-fix-krita-deadlock.patch
@@ -0,0 +1,110 @@
+Fix a deadlock in Krita:
+
+https://bugreports.qt.io/browse/QTBUG-83207
+
+Patch copied from Qt bug tracker:
+
+https://codereview.qt-project.org/c/qt/qtbase/+/296034
+
+From 276fa8383a7535765be7182883ef4aade17ce013 Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Thu, 02 Apr 2020 12:08:41 -0300
+Subject: [PATCH] QLibrary: fix deadlock caused by fix to QTBUG-39642
+
+Commit ae6f73e8566fa76470937aca737141183929a5ec inserted a mutex around
+the entire load_sys(). We had reasoed that deadlocks would only occur if
+the object creation in instance() recursed into its own instance(),
+which was already a bug. But we had forgotten that dlopen()/
+LoadLibrary() executes initialization code from the module being loaded,
+which could cause a recursion back into the same QPluginLoader or
+QLibrary object. This recursion is benign because the module *is* loaded
+and dlopen()/LoadLibrary() returns the same handle.
+
+[ChangeLog][QtCore][QLibrary and QPluginLoader] Fixed a deadlock that
+would happen if the plugin or library being loaded has load-time
+initialization code (C++ global variables) that recursed back into the
+same QLibrary or QPluginLoader object.
+
+PS: QLibraryPrivate::loadPlugin() updates pluginState outside a mutex
+lock, so pluginState should be made an atomic variable. Once that is
+done, we'll only need locking the mutex to update errorString (no
+locking before loading).
+
+Fixes: QTBUG-83207
+Task-number: QTBUG-39642
+Change-Id: Ibdc95e9af7bd456a94ecfffd160209304e5ab2eb
+Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
+Reviewed-by: David Faure <david.faure@kdab.com>
+---
+
+diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
+index ddb053c..be9d92b 100644
+--- a/src/corelib/plugin/qlibrary.cpp
++++ b/src/corelib/plugin/qlibrary.cpp
+@@ -576,9 +576,7 @@
+ 
+     Q_TRACE(QLibraryPrivate_load_entry, fileName);
+ 
+-    mutex.lock();
+     bool ret = load_sys();
+-    mutex.unlock();
+     if (qt_debug_component()) {
+         if (ret) {
+             qDebug() << "loaded library" << fileName;
+diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
+index 017aa97..a5c72f8 100644
+--- a/src/corelib/plugin/qlibrary_unix.cpp
++++ b/src/corelib/plugin/qlibrary_unix.cpp
+@@ -123,6 +123,7 @@
+ 
+ bool QLibraryPrivate::load_sys()
+ {
++    QMutexLocker locker(&mutex);
+     QString attempt;
+     QFileSystemEntry fsEntry(fileName);
+ 
+@@ -213,6 +214,7 @@
+     }
+ #endif
+ 
++    locker.unlock();
+     bool retry = true;
+     Handle hnd = nullptr;
+     for (int prefix = 0; retry && !hnd && prefix < prefixes.size(); prefix++) {
+@@ -273,6 +275,8 @@
+         }
+     }
+ #endif
++
++    locker.relock();
+     if (!hnd) {
+         errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror());
+     }
+diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
+index 000bf76..ef58724 100644
+--- a/src/corelib/plugin/qlibrary_win.cpp
++++ b/src/corelib/plugin/qlibrary_win.cpp
+@@ -78,6 +78,7 @@
+     //     fileName
+     //
+     // NB If it's a plugin we do not ever try the ".dll" extension
++    QMutexLocker locker(&mutex);
+     QStringList attempts;
+ 
+     if (pluginState != IsAPlugin)
+@@ -95,6 +96,7 @@
+         attempts.prepend(QDir::rootPath() + fileName);
+ #endif
+ 
++    locker.unlock();
+     Handle hnd = nullptr;
+     for (const QString &attempt : qAsConst(attempts)) {
+ #ifndef Q_OS_WINRT
+@@ -115,6 +117,7 @@
+ #ifndef Q_OS_WINRT
+     SetErrorMode(oldmode);
+ #endif
++    locker.relock();
+     if (!hnd) {
+         errorString = QLibrary::tr("Cannot load library %1: %2").arg(
+                     QDir::toNativeSeparators(fileName), qt_error_string());
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 0cb36427a0..e0e71c595d 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -342,6 +342,7 @@ developers using C++ or QML, a CSS & JavaScript like language.")
 (define-public qtbase
   (package
     (name "qtbase")
+    ;; TODO Remove ((gnu packages kde) qtbase-for-krita) when upgrading qtbase.
     (version "5.14.2")
     (source (origin
              (method url-fetch)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#42476: Krita fails to start
  2020-07-22 17:51 bug#42476: Krita fails to start Leo Famulari
@ 2020-07-23 20:44 ` Leo Famulari
  2020-07-23 22:30   ` Leo Famulari
  2020-07-24  2:41 ` Boris A. Dekshteyn
  1 sibling, 1 reply; 4+ messages in thread
From: Leo Famulari @ 2020-07-23 20:44 UTC (permalink / raw)
  To: 42476-done

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

This should be fixed with commit
5f63905096e456097fca206f56ce9257f72faf64

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#42476: Krita fails to start
  2020-07-23 20:44 ` Leo Famulari
@ 2020-07-23 22:30   ` Leo Famulari
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Famulari @ 2020-07-23 22:30 UTC (permalink / raw)
  To: 42476-done

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

On Thu, Jul 23, 2020 at 04:44:08PM -0400, Leo Famulari wrote:
> This should be fixed with commit
> 5f63905096e456097fca206f56ce9257f72faf64

That commit actually broke `guix pull` as shown below. Sorry!

------
Backtrace:
In ice-9/boot-9.scm:
   222:29 19 (map1 _)
   222:29 18 (map1 _)
   222:29 17 (map1 _)
   222:29 16 (map1 _)
   222:17 15 (map1 (((gnu packages kde)) ((gnu packages libevent)) ((gnu packages libidn)) ((gnu packages #)) ((?)) ?))
  3297:17 14 (resolve-interface (gnu packages kde) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _)
In ice-9/threads.scm:
    390:8 13 (_ _)
In ice-9/boot-9.scm:
  3223:13 12 (_)
In ice-9/threads.scm:
    390:8 11 (_ _)
In ice-9/boot-9.scm:
  3507:20 10 (_)
   2806:4  9 (save-module-excursion _)
  3527:26  8 (_)
In unknown file:
           7 (primitive-load-path "gnu/packages/kde" #<procedure 7f68d6fe5da0 at ice-9/boot-9.scm:3514:37 ()>)
In ice-9/eval.scm:
   626:19  6 (_ #<directory (gnu packages kde) 7f68d6175b40>)
   293:34  5 (_ #<directory (gnu packages kde) 7f68d6175b40>)
   173:47  4 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>))
    159:9  3 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>))
   191:35  2 (_ #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval.sc?>))
   223:20  1 (proc #(#<directory (gnu packages kde) 7f68d6175b40> #<promise #<procedure 7f68dc5a5d00 at ice-9/eval?>))
In unknown file:
           0 (%resolve-variable (7 . qtbase) #<directory (gnu packages kde) 7f68d6175b40>)

ERROR: In procedure %resolve-variable:
error: qtbase: unbound variable
------

I fixed it by moving qtbase-for-krita package to (gnu packages qt) and
pushed as 0448bfe2d769998ba33c288a07738e13b02113a4. I'm not sure exactly
what's wrong but my hunch is that there is a module dependency cycle.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#42476: Krita fails to start
  2020-07-22 17:51 bug#42476: Krita fails to start Leo Famulari
  2020-07-23 20:44 ` Leo Famulari
@ 2020-07-24  2:41 ` Boris A. Dekshteyn
  1 sibling, 0 replies; 4+ messages in thread
From: Boris A. Dekshteyn @ 2020-07-24  2:41 UTC (permalink / raw)
  To: 42476

Hello,

Leo Famulari <leo@famulari.name> writes:

> Currently, Krita fails to start after loading its splash screen. It just
> hangs forever.
>
> I found this upstream bug report in Qt:
>
> https://bugreports.qt.io/browse/QTBUG-83207
>
> Currently, I'm testing the build of Krita based on the Qt patch in that
> bug report.
>
> I've attached my patch.

fixed in krita 4.3, relased about a month ago:

-    (version "4.2.9")
+    (version "4.3.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -372,7 +372,7 @@ illustrate project schedules.")
                     "/krita-" version ".tar.gz"))
               (sha256
                (base32
-                "1a3djmjhnvlp8dpiz68s0lwg71nv3ypq592jfgsnm5zlxa0vp1cz"))))
+                "1njbxv7b56if838gv7ydzm1sprgmaabnp0jlj0bxryxzfdy8hwfh"))))



-- 
WBR, Boris Dekshteyn




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-24  2:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-22 17:51 bug#42476: Krita fails to start Leo Famulari
2020-07-23 20:44 ` Leo Famulari
2020-07-23 22:30   ` Leo Famulari
2020-07-24  2:41 ` Boris A. Dekshteyn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.