Accepting request 1083554 from home:krop:branches:KDE:Applications

- Add more fixes:
  * 0001-Avoid-crashing-before-priting-debug-output-when-sett.patch 
    (kde#468985)
  * 0001-Remove-dangling-reference.patch
  * 0001-Allow-running-mysql_upgrade-when-starting-Akonadi.patch
    (kde#402680)

- Add upstream changes:
  * 0001-Fix-wrong-for-clause-in-Akonadi-Session.patch (kde#458315)
  * 0002-Remove-dead-code-from-FavoriteCollectionsModel.patch
  * 0003-Fix-a-bug-in-for-clause-in-EntityTreeModel.patch
  * 0001-Fix-crash-on-server-shutdown.patch (kde#450217, kde#462692)

OBS-URL: https://build.opensuse.org/request/show/1083554
OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/akonadi-server?expand=0&rev=340
This commit is contained in:
Luca Beltrame 2023-04-28 18:33:43 +00:00 committed by Git OBS Bridge
parent 38ac5d54ac
commit 829fd7a70f
9 changed files with 317 additions and 0 deletions

View File

@ -0,0 +1,61 @@
From 5d6bf9ab17c89bb42ba6dc579ea564d105c6efcb Mon Sep 17 00:00:00 2001
From: Christophe Marin <christophe@krop.fr>
Date: Fri, 28 Apr 2023 16:29:45 +0200
Subject: [PATCH] Allow running mysql_upgrade when starting Akonadi
Amends d6a1c057327332487adc9ad39252f9481ae28288
CCBUG: 402680
(cherry picked from commit 620ea58f76e00aed52c1acee9c8d11b6f3279953)
---
apparmor/mariadbd_akonadi | 3 ++-
apparmor/mysqld_akonadi | 1 +
apparmor/usr.bin.akonadiserver | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/apparmor/mariadbd_akonadi b/apparmor/mariadbd_akonadi
index b63465278..7c0497a3d 100644
--- a/apparmor/mariadbd_akonadi
+++ b/apparmor/mariadbd_akonadi
@@ -30,9 +30,10 @@ profile mariadbd_akonadi {
/{usr/,}bin/mkdir mrix,
/{usr/,}bin/sed mrix,
/usr/bin/my_print_defaults mrix,
- /usr/bin/mariadb-install-db mrix,
/usr/bin/mariadb-admin mrix,
/usr/bin/mariadb-check mrix,
+ /usr/bin/mariadb-install-db mrix,
+ /usr/bin/mariadb-upgrade mrix,
/usr/{,s}bin/mariadbd mrix,
/usr/share/mysql/** r,
owner @{xdg_data_home}/akonadi/** rwk,
diff --git a/apparmor/mysqld_akonadi b/apparmor/mysqld_akonadi
index 72949d025..4940bf4d2 100644
--- a/apparmor/mysqld_akonadi
+++ b/apparmor/mysqld_akonadi
@@ -31,6 +31,7 @@ profile mysqld_akonadi {
/{usr/,}bin/sed mrix,
/usr/bin/my_print_defaults mrix,
/usr/bin/mysql_install_db mrix,
+ /usr/bin/mysql_upgrade mrix,
/usr/bin/mysqladmin mrix,
/usr/bin/mysqlcheck mrix,
/usr/{,s}bin/mysqld mrix,
diff --git a/apparmor/usr.bin.akonadiserver b/apparmor/usr.bin.akonadiserver
index aa489a3d0..917d5bf78 100644
--- a/apparmor/usr.bin.akonadiserver
+++ b/apparmor/usr.bin.akonadiserver
@@ -46,8 +46,10 @@ abi <abi/3.0>,
/usr/bin/mariadb-admin Px -> mariadbd_akonadi,
/usr/bin/mariadb-check Px -> mariadbd_akonadi,
/usr/bin/mariadb-install-db Px -> mariadbd_akonadi,
+ /usr/bin/mariadb-upgrade Px -> mariadbd_akonadi,
/usr/{,s}bin/mariadbd Px -> mariadbd_akonadi,
/usr/bin/mysql_install_db Px -> mysqld_akonadi,
+ /usr/bin/mysql_upgrade Px -> mysqld_akonadi,
/usr/bin/mysqladmin Px -> mysqld_akonadi,
/usr/bin/mysqlcheck Px -> mysqld_akonadi,
/usr/{,s}bin/mysqld Px -> mysqld_akonadi,
--
2.40.0

View File

@ -0,0 +1,36 @@
From 518c99d1313b621312275a5bd6af919a3d889f26 Mon Sep 17 00:00:00 2001
From: Carl Schwan <carl@carlschwan.eu>
Date: Wed, 26 Apr 2023 19:35:57 +0200
Subject: [PATCH] Avoid crashing before priting debug output when setting up db
Calling debugLastDbError requires the database to be already setup
as it is using the akonadi tracer. So using it to debug why the database
didn't open doesn't work.
CCBUG: 468985
(cherry picked from commit 05db7d03baae46513cd6735ec2c3f28733145b0a)
---
src/server/storage/datastore.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/server/storage/datastore.cpp b/src/server/storage/datastore.cpp
index 8f8a6bc1f..31a29b670 100644
--- a/src/server/storage/datastore.cpp
+++ b/src/server/storage/datastore.cpp
@@ -113,7 +113,10 @@ void DataStore::open()
m_dbOpened = m_database.open();
if (!m_dbOpened) {
- debugLastDbError("Cannot open database.");
+ qCCritical(AKONADISERVER_LOG) << "Database error: Cannot open database.";
+ qCCritical(AKONADISERVER_LOG) << " Last driver error:" << m_database.lastError().driverText();
+ qCCritical(AKONADISERVER_LOG) << " Last database error:" << m_database.lastError().databaseText();
+ return;
} else {
qCDebug(AKONADISERVER_LOG) << "Database" << m_database.databaseName() << "opened using driver" << m_database.driverName();
}
--
2.40.0

View File

@ -0,0 +1,39 @@
From 1d9d64ec3cf78dfdddc2239df0d33b08dc442104 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
Date: Sat, 22 Apr 2023 11:43:02 +0200
Subject: [PATCH] Fix crash on server shutdown
When AkonadiServer::quit() is called it clears the vector of existing
connections and destroys them. This can race with a resource disconnecting
or crashing on its own, which then enqueues a singal emission from the
Connection to remove itself from the connections vector as well.
Previously the code assumed the Connection must always exist in the vector
which caused a crash when it did not...surprise surprise.
BUG: 462692
FIXED-IN: 23.04.0
---
src/server/akonadi.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/server/akonadi.cpp b/src/server/akonadi.cpp
index 7ede9e238..5ff4a9c46 100644
--- a/src/server/akonadi.cpp
+++ b/src/server/akonadi.cpp
@@ -230,8 +230,10 @@ void AkonadiServer::connectionDisconnected()
auto it = std::find_if(mConnections.begin(), mConnections.end(), [this](const auto &ptr) {
return ptr.get() == sender();
});
- Q_ASSERT(it != mConnections.end());
- mConnections.erase(it);
+
+ if (it != mConnections.end()) {
+ mConnections.erase(it);
+ }
}
bool AkonadiServer::setupDatabase()
--
2.40.0

View File

@ -0,0 +1,53 @@
From 0ab418bacdaf8322771e41452a87d062a2449869 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pale=C4=8Dek?= <jpalecek@web.de>
Date: Thu, 20 Apr 2023 16:17:12 +0200
Subject: [PATCH 1/3] Fix wrong for clause in Akonadi::Session
BUG: 468343
BUG: 465245
BUG: 464275
BUG: 462213
BUG: 462169
BUG: 461131
BUG: 460653
BUG: 460586
BUG: 458497
BUG: 458315
(cherry picked from commit eca4fdbdf328883ae564b568c9ba13697cc90c4a)
---
src/core/session.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/core/session.cpp b/src/core/session.cpp
index 227dda367..46106b923 100644
--- a/src/core/session.cpp
+++ b/src/core/session.cpp
@@ -293,7 +293,8 @@ void SessionPrivate::serverStateChanged(ServerManager::State state)
} else if (!connected && state == ServerManager::Broken) {
// If the server is broken, cancel all pending jobs, otherwise they will be
// blocked forever and applications waiting for them to finish would be stuck
- for (Job *job : std::as_const(queue)) {
+ auto q = queue;
+ for (Job *job : q) {
job->setError(Job::ConnectionFailed);
job->kill(KJob::EmitResult);
}
@@ -435,11 +436,13 @@ void Session::clear()
void SessionPrivate::clear(bool forceReconnect)
{
- for (Job *job : std::as_const(queue)) {
+ auto q = queue;
+ for (Job *job : q) {
job->kill(KJob::EmitResult); // safe, not started yet
}
queue.clear();
- for (Job *job : std::as_const(pipeline)) {
+ auto p = pipeline;
+ for (Job *job : p) {
job->d_ptr->mStarted = false; // avoid killing/reconnect loops
job->kill(KJob::EmitResult);
}
--
2.40.0

View File

@ -0,0 +1,31 @@
From d46d05e67c729902e30691fc5f013504c8734ba4 Mon Sep 17 00:00:00 2001
From: Carl Schwan <carl@carlschwan.eu>
Date: Tue, 25 Apr 2023 19:40:09 +0200
Subject: [PATCH] Remove dangling reference
remoteCollection.contentMimeTypes() creates a temporary which is deleted
at the end of the expression. This was a compiler warning.
(cherry picked from commit d9476fd48863a46d4ef5deac4d8a0c7fbdb1c6c5)
---
src/core/collectionsync.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/collectionsync.cpp b/src/core/collectionsync.cpp
index 6195b501e..c8817676e 100644
--- a/src/core/collectionsync.cpp
+++ b/src/core/collectionsync.cpp
@@ -376,8 +376,8 @@ public:
return true;
} else {
for (int i = 0, total = remoteCollection.contentMimeTypes().size(); i < total; ++i) {
- const QString &m = remoteCollection.contentMimeTypes().at(i);
- if (!localCollection.contentMimeTypes().contains(m)) {
+ const QString mimetype = remoteCollection.contentMimeTypes().at(i);
+ if (!localCollection.contentMimeTypes().contains(mimetype)) {
return true;
}
}
--
2.40.0

View File

@ -0,0 +1,34 @@
From 70679e219841733000bf5abfc2462872058a4042 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pale=C4=8Dek?= <jpalecek@web.de>
Date: Thu, 20 Apr 2023 16:18:22 +0200
Subject: [PATCH 2/3] Remove dead code from FavoriteCollectionsModel
This code has per search been always dead. On top of that, the for
loop is faulty
(cherry picked from commit 56706add168cdc2a83eda49bfed7714a3ad01cc5)
---
src/core/models/favoritecollectionsmodel.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/core/models/favoritecollectionsmodel.cpp b/src/core/models/favoritecollectionsmodel.cpp
index 3ba7cec2c..835d8e277 100644
--- a/src/core/models/favoritecollectionsmodel.cpp
+++ b/src/core/models/favoritecollectionsmodel.cpp
@@ -152,13 +152,6 @@ public:
}
}
- void clearReferences()
- {
- for (const Collection::Id &collectionId : std::as_const(referencedCollections)) {
- dereference(collectionId);
- }
- }
-
/**
* Adds a collection to the favorite collections
*/
--
2.40.0

View File

@ -0,0 +1,30 @@
From 046a3e20663f00d75899677656b14c0bc3225526 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pale=C4=8Dek?= <jpalecek@web.de>
Date: Thu, 20 Apr 2023 16:22:14 +0200
Subject: [PATCH 3/3] Fix a bug in for clause in EntityTreeModel
The body of the for loop calls function monitoredCollectionRemoved,
which modifies the list which is iterated over. This can lead to
undefined behavior, so it's better to just iterate over a copy.
(cherry picked from commit b2b2ac0311b735ec80e9b02addae4e00398cf21e)
---
src/core/models/entitytreemodel_p.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/models/entitytreemodel_p.cpp b/src/core/models/entitytreemodel_p.cpp
index ab67c482a..531019562 100644
--- a/src/core/models/entitytreemodel_p.cpp
+++ b/src/core/models/entitytreemodel_p.cpp
@@ -174,7 +174,7 @@ void EntityTreeModelPrivate::agentInstanceRemoved(const Akonadi::AgentInstance &
}
return;
}
- const auto &children = m_childEntities[Collection::root().id()];
+ const auto children = m_childEntities[Collection::root().id()];
for (const Node *node : children) {
Q_ASSERT(node->type == Node::Collection);
--
2.40.0

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Fri Apr 28 14:05:49 UTC 2023 - Christophe Marin <christophe@krop.fr>
- Add more fixes:
* 0001-Avoid-crashing-before-priting-debug-output-when-sett.patch
(kde#468985)
* 0001-Remove-dangling-reference.patch
* 0001-Allow-running-mysql_upgrade-when-starting-Akonadi.patch
(kde#402680)
-------------------------------------------------------------------
Sat Apr 22 07:32:39 UTC 2023 - Christophe Marin <christophe@krop.fr>
- Add upstream changes:
* 0001-Fix-wrong-for-clause-in-Akonadi-Session.patch (kde#458315)
* 0002-Remove-dead-code-from-FavoriteCollectionsModel.patch
* 0003-Fix-a-bug-in-for-clause-in-EntityTreeModel.patch
* 0001-Fix-crash-on-server-shutdown.patch (kde#450217, kde#462692)
-------------------------------------------------------------------
Sat Apr 15 08:45:07 UTC 2023 - Christophe Marin <christophe@krop.fr>

View File

@ -31,6 +31,20 @@ Source1: https://download.kde.org/stable/release-service/%{version}/src/%
Source2: applications.keyring
%endif
Source99: akonadi-server-rpmlintrc
# PATCH-FIX-UPSTREAM -- kde#458315 and duplicates
Patch0: 0001-Fix-wrong-for-clause-in-Akonadi-Session.patch
# PATCH-FIX-UPSTREAM
Patch1: 0002-Remove-dead-code-from-FavoriteCollectionsModel.patch
# PATCH-FIX-UPSTREAM -- potential undefined behaviour
Patch2: 0003-Fix-a-bug-in-for-clause-in-EntityTreeModel.patch
# PATCH-FIX-UPSTREAM -- Another crash fix
Patch3: 0001-Fix-crash-on-server-shutdown.patch
# PATCH-FIX-UPSTREAM
Patch4: 0001-Avoid-crashing-before-priting-debug-output-when-sett.patch
# PATCH-FIX-UPSTREAM
Patch5: 0001-Remove-dangling-reference.patch
# PATCH-FIX-UPSTREAM
Patch6: 0001-Allow-running-mysql_upgrade-when-starting-Akonadi.patch
BuildRequires: apparmor-abstractions
BuildRequires: apparmor-rpm-macros
BuildRequires: extra-cmake-modules >= %{kf5_version}