Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian@packages.debian.org
Usertags: pu
Hi! print-manager suffers from a bug in which if multiple print jobs are given
the same ID it will make plasmashell (basic part of Plasma, aka KDE desktop)
crash and thus not allow to start.
The bug has finally been solved by upstream and I backported it and:
- Compiled it for buster, installed it on my machine, uploaded it to unstable.
- I've built this package for buster on a clean buster chroot and tested it on a
machine suffering this bug which I had at hand. It worked perfectly.
I have already uploaded the package to buster-pu and I'm attaching the debdiff.
Thanks in advance, Lisandro.
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'unstable-debug'), (500,
'testing-debug'), (500, 'buildd-unstable'), (500, 'testing'), (1,
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64, armhf
Kernel: Linux 5.4.0-3-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8),
LANGUAGE=es_AR:es (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru print-manager-18.12.1/debian/changelog
print-manager-18.12.1/debian/changelog
--- print-manager-18.12.1/debian/changelog 2019-02-01 15:27:55.0
-0300
+++ print-manager-18.12.1/debian/changelog 2020-01-25 16:08:59.0
-0300
@@ -1,3 +1,12 @@
+print-manager (4:18.12.1-2+deb10u1) buster; urgency=medium
+
+ * Team upload.
+ * Backport fix_crash_when_cups_returns_jobs_with_duplicate_id.patch. This
+fixes a longstanding bug when multiple print job IDs are given the same
+ID, and so it was not easy to reproduce (Closes: #910879).
+
+ -- Lisandro Damián Nicanor Pérez Meyer Sat, 25 Jan
2020 16:08:59 -0300
+
print-manager (4:18.12.1-2) unstable; urgency=medium
* New revision
diff -Nru
print-manager-18.12.1/debian/patches/fix_crash_when_cups_returns_jobs_with_duplicate_id.patch
print-manager-18.12.1/debian/patches/fix_crash_when_cups_returns_jobs_with_duplicate_id.patch
---
print-manager-18.12.1/debian/patches/fix_crash_when_cups_returns_jobs_with_duplicate_id.patch
1969-12-31 21:00:00.0 -0300
+++
print-manager-18.12.1/debian/patches/fix_crash_when_cups_returns_jobs_with_duplicate_id.patch
2020-01-25 15:49:03.0 -0300
@@ -0,0 +1,83 @@
+From c93f2f16c30d10fbd0f4bfb4c0bf0cec07a4c93b Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid
+Date: Mon, 2 Dec 2019 23:04:42 +0100
+Subject: Fix crash when cups returns jobs with duplicate id
+
+Summary:
+For some reason my cups was giving me two withheld jobs with id 33 and two
with id 40
+
+That made the JobModel code crash, because it went like this
+
+ * First job with id 33 found
+ * insertRow with 0 called
+ * Row 0 inserted
+ * Job at row 0 updated (from inside insertRow)
+ * Second job with id 33 found
+ * The "oh i already have this job code triggers", updates the job, then
takesRow 0 and inserts at row 1. QStandardItemModel doesn't like getting a row
add at 1 inserted when empty
+ * First job with id 40 found
+ * insertRow with 2 called
+ * Row 2 inserted, it fails, QStandardItemModel doesn't like getting a row add
at 2 when empty
+ * Job at row 2 updated (from iniside insertRow)
+ * Crash because there's no row 2 in the model
+
+BUGS: 326289
+
+Test Plan: Doesn't crash anymore with my weird cups list of pending jobs
+
+Reviewers: dantti
+
+Reviewed By: dantti
+
+Subscribers: ngraham, marcelm, fvogt, broulik, nicolasfella, kmaterka,
kde-utils-devel
+
+Differential Revision: https://phabricator.kde.org/D25623
+---
+ libkcups/JobModel.cpp | 23 +--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/libkcups/JobModel.cpp
b/libkcups/JobModel.cpp
+@@ -172,6 +172,25 @@ void JobModel::getJobs()
+ m_processingJob.clear();
+ }
+
++static KCupsJobs sanitizeJobs(KCupsJobs jobs)
++{
++// For some reason sometimes cups has broken job queues with jobs with
duplicated id
++// our model doesn't like that at all so sanitize the job list before
processing it
++QVector seenIds;
++int i = 0;
++while (i < jobs.count()) {
++const int jobId = jobs.at(i).id();
++if (seenIds.contains(jobId)) {
++qCWarning(LIBKCUPS) << "Found job with duplicated id" << jobId;
++jobs.removeAt(i);
++} else {
++seenIds << jobId;
++++i;
++}
++}
++return jobs;
++}
++
+ void JobModel::getJobFinished(KCupsRequest *request)
+ {
+ if (request) {
+@@ -179,7 +198,7 @@ void JobModel::getJobFinished(KCupsReque
+ // clear the model after so that the proper widget can be shown
+ clear();
+ } else {
+-const KCupsJobs