systemd/plasma-workspace: replace patch to fix crash for a proper one from upstream

Same as 6afd6efed92708058f3d2b1a52e83a9315387c3c in aports.

Rather than basically disabling the fuzzy search function this actually
fixes the problem and fuzzy search works again.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7344>
This commit is contained in:
Bart Ribbers 2025-11-13 18:24:57 +01:00 committed by The Friendly Merge Bot
parent 58f93cc935
commit eab37a8f47
No known key found for this signature in database
3 changed files with 73 additions and 24 deletions

View file

@ -0,0 +1,70 @@
From 6bb87ff30e4bf00bb3086ee0657af0145810f2de Mon Sep 17 00:00:00 2001
From: John Zimmermann <me@johnnynator.dev>
Date: Sun, 9 Nov 2025 22:33:13 +0100
Subject: [PATCH] bitap: allocate patternMask on heap instead of stack
the current code results in a stackoverflow on systems
with smaller default stack size than glibc (e.g. musl)
BUG: 511233
---
runners/services/bitap.h | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/runners/services/bitap.h b/runners/services/bitap.h
index 1981878361d..be697a1316b 100644
--- a/runners/services/bitap.h
+++ b/runners/services/bitap.h
@@ -4,6 +4,7 @@
#pragma once
#include <bitset>
+#include <memory>
#include <optional>
#include <QDebug>
@@ -62,25 +63,26 @@ inline std::optional<Match> bitap(const QStringView &name, const QStringView &pa
// With hammingDistance >= pattern.length(), it would always match by changing the entire pattern, so clamp it.
hammingDistance = std::min(hammingDistance, int(pattern.length() - 1));
- const PatternMask patternMask = [&pattern, &name] {
- PatternMask patternMask;
+ // allocate on heap to prevent stackoverflow on musl libc (patternMask ~512k size, musl stack 128k)
+ std::unique_ptr<const PatternMask> patternMask = [&pattern, &name] {
+ auto patternMask = std::make_unique<PatternMask>();
// The following is an optimized version of patternMask.fill(Mask().set()); to set all **necessary** bits to 1.
for (const auto &qchar : pattern) {
- patternMask.at(qchar.unicode()).set();
+ patternMask->at(qchar.unicode()).set();
}
for (const auto &qchar : name) {
- patternMask.at(qchar.unicode()).set();
+ patternMask->at(qchar.unicode()).set();
}
for (int i = 0; i < pattern.size(); ++i) {
const auto char_ = pattern.at(i).unicode();
- patternMask.at(char_).reset(i); // unset the relevant index bits
+ patternMask->at(char_).reset(i); // unset the relevant index bits
}
if (BITAP().isDebugEnabled()) {
for (const auto &i : pattern) {
const auto char_ = i.unicode();
- qCDebug(BITAP) << "Pattern mask for" << char_ << "is" << patternMask.at(char_).to_string();
+ qCDebug(BITAP) << "Pattern mask for" << char_ << "is" << patternMask->at(char_).to_string();
}
}
@@ -97,7 +99,7 @@ inline std::optional<Match> bitap(const QStringView &name, const QStringView &pa
for (int i = 0; i < name.size(); ++i) {
const auto &char_ = name.at(i);
auto previousBit = bits[0];
- const auto mask = patternMask.at(char_.unicode());
+ const auto mask = patternMask->at(char_.unicode());
bits[0] |= mask;
bits[0] <<= 1;
--
GitLab

View file

@ -1,21 +0,0 @@
Prevent krunner from crashing by returning early before entering broken code.
The exact cause of the crash isn't known yet, although it seems Musl specific.
This is not great, but bad search results are not as bad as crashes.
https://bugs.kde.org/show_bug.cgi?id=511233
---
diff --git a/runners/services/bitap.h b/runners/services/bitap.h
index 37c1f34557..ca37e95300 100644
--- a/runners/services/bitap.h
+++ b/runners/services/bitap.h
@@ -42,6 +42,8 @@ inline std::optional<Match> bitap(const QStringView &name, const QStringView &pa
return Match{.size = pattern.size(), .distance = 0}; // Perfect match
}
+ return std::nullopt;
+
if (pattern.isEmpty() || name.isEmpty()) {
return std::nullopt;
}

View file

@ -3,7 +3,7 @@
pkgname=plasma-workspace
pkgver=99996.5.2
_pkgver=6.5.2
pkgrel=0
pkgrel=1
pkgdesc="KDE Plasma Workspace"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
@ -118,7 +118,7 @@ subpackages="
"
_repo_url="https://invent.kde.org/plasma/plasma-workspace.git"
source="https://download.kde.org/$_rel/plasma/$_pkgver/plasma-workspace-$_pkgver.tar.xz
0001-plasma-workspace-krunner-crash-workaround.patch
0001-plasma-workspace-bitap-allocate-patternMask-on-heap-instead-of-stack.patch
"
builddir="$srcdir/$pkgname-$_pkgver"
@ -211,5 +211,5 @@ x11() {
sha512sums="
53d23c0b9e98a23c7189b9a83bc9a21290e94d741a5e8f8f793b5a4742d8c46b2e1fdd9e0b143e153440a26219d0edc46e55acabe93cac07b988e323f2829ecc plasma-workspace-6.5.2.tar.xz
8ea774b192bd79c2f03fb7e7219f352eab83f10cb9df3e6eeede236c83e22cce134e7a6ae29a18c7d45b0689e137a7df9ed67e57be3f7c9b2fd9623cfc7b7df2 0001-plasma-workspace-krunner-crash-workaround.patch
0bfa5b5331fbc9365726d80a289cbecc691a6ddb43cff6f32f18bec7d3d019af1fab08cf80f246ced092c4c12405d4f2083f438619712f3c85d868d2aa5117c9 0001-plasma-workspace-bitap-allocate-patternMask-on-heap-instead-of-stack.patch
"