[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1049974: marked as done (bookworm-pu: package plasma-workspace/5.27.5-2+deb12u1)



Your message dated Sat, 07 Oct 2023 09:59:39 +0000
with message-id <E1qp45z-00A4Ck-SO@coccia.debian.org>
and subject line Released with 12.2
has caused the Debian Bug report #1049974,
regarding bookworm-pu: package plasma-workspace/5.27.5-2+deb12u1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1049974: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1049974
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org@packages.debian.org
Usertags: pu
X-Debbugs-Cc: plasma-workspace@packages.debian.org, deltaone@debian.org
Control: affects -1 + src:plasma-workspace

[ Reason ]
krunner (a launcher built into KDE Plasma capable of doing all
sorts of things) crashes when characters or numbers are typed
in a rapid fashion.
The bug was sadly introduced in Plasma 5.27.5, but subsequently
fixed in Plasma 5.27.6. The Debian bug report can be found under
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1037557

This update backports a patch for plasma-workspace that is included
in 5.27.6 back to 5.27.5. The patch is taken directly from the
upstream project.

[ Impact ]
krunner cannot be used, in some cases hardly at all.

[ Tests ]
Both the bug submitter and myself verified that in the fixed
version of plasma-workspace krunner does not crash any more.
The bug is also solved in testing and unstable as they ship
Plasma 5.27.7.

[ Risks ]
Risks are generally low. The patch is directly from upstream and
part of subsequent releases of Plasma.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
Added patch to migiate krunner crash.
diffstat for plasma-workspace-5.27.5 plasma-workspace-5.27.5

 changelog                   |    6 ++
 patches/krunner_crash.patch |  107 ++++++++++++++++++++++++++++++++++++++++++++
 patches/series              |    3 +
 3 files changed, 116 insertions(+)

diff -Nru plasma-workspace-5.27.5/debian/changelog plasma-workspace-5.27.5/debian/changelog
--- plasma-workspace-5.27.5/debian/changelog	2023-05-27 18:23:46.000000000 +0200
+++ plasma-workspace-5.27.5/debian/changelog	2023-08-16 21:18:49.000000000 +0200
@@ -1,3 +1,9 @@
+plasma-workspace (4:5.27.5-2+deb12u1) bookworm; urgency=medium
+
+  * Backport patch to fix crash in krunner (Closes: #1037557).
+
+ -- Patrick Franz <deltaone@debian.org>  Wed, 16 Aug 2023 21:18:49 +0200
+
 plasma-workspace (4:5.27.5-2) unstable; urgency=medium
 
   * Release to unstable.
diff -Nru plasma-workspace-5.27.5/debian/patches/krunner_crash.patch plasma-workspace-5.27.5/debian/patches/krunner_crash.patch
--- plasma-workspace-5.27.5/debian/patches/krunner_crash.patch	1970-01-01 01:00:00.000000000 +0100
+++ plasma-workspace-5.27.5/debian/patches/krunner_crash.patch	2023-08-16 21:14:47.000000000 +0200
@@ -0,0 +1,107 @@
+From 9d18e0821455366c00a763252515d48741316f6c Mon Sep 17 00:00:00 2001
+From: Max Ramanouski <max8rr8@gmail.com>
+Date: Thu, 1 Jun 2023 19:05:00 +0300
+Subject: [PATCH] runners/calculator: implement thread-safety in
+ QalculateEngine::evaluate
+
+Libqalculate does not seem to support ability to run multiple computations
+that are controlled or have timeout set beeing run in the same time.
+After the timeout was introduced in QalculateEngine this led to BUG 470219,
+which happens when computations are started from multiple threads in the same time
+that "confuses" libqalculate computation thread which leads to crash in libqalculate code.
+
+To fix that we need to ensure that only one evaluation is running at single moment of time.
+This is done via QalculateLock class that is like QMutexLocker but for libqalculate.
+QalculateLock is implemented with two static mutexes. Mutex s_evalLock is used
+to ensure that only one evaluation is running at single moment.
+Mutex s_ctrlLock is used to ensure that thread that aborted evaluation will
+get to start next evaluation.
+
+BUG: 470219
+---
+ runners/calculator/qalculate_engine.cpp | 43 ++++++++++++++++++++-----
+ 1 file changed, 35 insertions(+), 8 deletions(-)
+
+diff --git a/runners/calculator/qalculate_engine.cpp b/runners/calculator/qalculate_engine.cpp
+index a9d0a78243..09ff75fed5 100644
+--- a/runners/calculator/qalculate_engine.cpp
++++ b/runners/calculator/qalculate_engine.cpp
+@@ -17,11 +17,42 @@
+ #include <QClipboard>
+ #include <QDebug>
+ #include <QFile>
++#include <QMutex>
+ 
+ #include <KIO/Job>
+ #include <KLocalizedString>
+ #include <KProtocolManager>
+ 
++constexpr int evaluationTimeout = 10000;
++
++// Synchronization lock that ensures that
++// a) only one evaluation is running at a time
++// b) abortion and preemption of evaluation is synchronized
++class QalculateLock
++{
++public:
++    QalculateLock()
++    {
++        QMutexLocker ctrlLocker(&s_ctrlLock);
++        CALCULATOR->abort();
++        s_evalLock.lock();
++        CALCULATOR->startControl(evaluationTimeout);
++    }
++
++    ~QalculateLock()
++    {
++        CALCULATOR->stopControl();
++        s_evalLock.unlock();
++    }
++
++private:
++    static QMutex s_ctrlLock;
++    static QMutex s_evalLock;
++};
++
++QMutex QalculateLock::s_ctrlLock;
++QMutex QalculateLock::s_evalLock;
++
+ QAtomicInt QalculateEngine::s_counter;
+ 
+ QalculateEngine::QalculateEngine(QObject *parent)
+@@ -114,7 +145,8 @@ QString QalculateEngine::evaluate(const QString &expression, bool *isApproximate
+     QByteArray ba = input.replace(QChar(0xA3), "GBP").replace(QChar(0xA5), "JPY").replace('$', "USD").replace(QChar(0x20AC), "EUR").toLocal8Bit();
+     const char *ctext = ba.data();
+ 
+-    CALCULATOR->terminateThreads();
++    QalculateLock qalculateLock;
++
+     EvaluationOptions eo;
+ 
+     eo.auto_post_conversion = POST_CONVERSION_BEST;
+@@ -150,12 +182,7 @@ QString QalculateEngine::evaluate(const QString &expression, bool *isApproximate
+     }
+ #endif
+ 
+-    constexpr int timeout = 10000;
+-    MathStructure result;
+-    if (!CALCULATOR->calculate(&result, ctext, timeout, eo)) {
+-        // BUG 468084: stop libqalculate thread if timeout is reached
+-        return {};
+-    }
++    MathStructure result = CALCULATOR->calculate(ctext, eo);
+ 
+     PrintOptions po;
+     po.base = base;
+@@ -173,7 +200,7 @@ QString QalculateEngine::evaluate(const QString &expression, bool *isApproximate
+ 
+     result.format(po);
+ 
+-    m_lastResult = QString::fromStdString(CALCULATOR->print(result, timeout, po));
++    m_lastResult = QString::fromStdString(result.print(po));
+ 
+     if (isApproximate) {
+         *isApproximate = result.isApproximate();
+-- 
+GitLab
+
diff -Nru plasma-workspace-5.27.5/debian/patches/series plasma-workspace-5.27.5/debian/patches/series
--- plasma-workspace-5.27.5/debian/patches/series	2023-05-27 18:23:46.000000000 +0200
+++ plasma-workspace-5.27.5/debian/patches/series	2023-08-16 21:17:26.000000000 +0200
@@ -1,2 +1,5 @@
 add_sddm_debian_breeze.patch
 enable_debianabimanager.diff
+
+# Fixed in 5.27.6
+krunner_crash.patch

--- End Message ---
--- Begin Message ---
Version: 12.2

The upload requested in this bug has been released as part of 12.2.

--- End Message ---

Reply to: