Bug#1049974: bookworm-pu: package plasma-workspace/5.27.5-2+deb12u1

2023-09-24 Thread Patrick Franz
Hi Adam,

On Sat, 23 Sep 2023 21:41:40 +0100 "Adam D. Barratt"  wrote:
[...]
> Please go ahead.

Package has been uploaded.


-- 
Med vänliga hälsningar

Patrick Franz



Bug#1049974: bookworm-pu: package plasma-workspace/5.27.5-2+deb12u1

2023-09-23 Thread Adam D. Barratt
Control: tags -1 confirmed

On Thu, 2023-08-17 at 20:01 +0200, Patrick Franz wrote:
> 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
> 

Please go ahead.

Regards,

Adam



Bug#1049974: bookworm-pu: package plasma-workspace/5.27.5-2+deb12u1

2023-08-17 Thread Patrick Franz
Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian@packages.debian.org
Usertags: pu
X-Debbugs-Cc: plasma-worksp...@packages.debian.org, delta...@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/changelog2023-05-27 18:23:46.0 
+0200
+++ plasma-workspace-5.27.5/debian/changelog2023-08-16 21:18:49.0 
+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   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.0 +0100
+++ plasma-workspace-5.27.5/debian/patches/krunner_crash.patch  2023-08-16 
21:14:47.0 +0200
@@ -0,0 +1,107 @@
+From 9d18e0821455366c00a763252515d48741316f6c Mon Sep 17 00:00:00 2001
+From: Max Ramanouski 
+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 
+ #include 
+ #include 
++#include 
+ 
+ #include 
+ #include 
+ #include 
+ 
++constexpr int evaluationTimeout = 1;
++
++// 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(_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 
, bool *isApproximate
+