summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2016-09-15 04:04:32 +1000
committerMichael Palimaka <kensington@gentoo.org>2016-09-15 04:12:16 +1000
commit1f9700ed2ec8463a6b7d80a06f83c7b50c973b54 (patch)
tree4a5042f5e2915e29ee83096ce0306f8e0e8208ee /kde-frameworks/baloo
parentdev-python/simplecv: remove unused patch (diff)
downloadgentoo-1f9700ed2ec8463a6b7d80a06f83c7b50c973b54.tar.gz
gentoo-1f9700ed2ec8463a6b7d80a06f83c7b50c973b54.tar.bz2
gentoo-1f9700ed2ec8463a6b7d80a06f83c7b50c973b54.zip
kde-frameworks: version bump 5.26.0
Package-Manager: portage-2.3.0
Diffstat (limited to 'kde-frameworks/baloo')
-rw-r--r--kde-frameworks/baloo/Manifest1
-rw-r--r--kde-frameworks/baloo/baloo-5.26.0-r1.ebuild50
-rw-r--r--kde-frameworks/baloo/files/baloo-5.26.0-dont-corrupt.patch193
-rw-r--r--kde-frameworks/baloo/files/baloo-5.26.0-runtime-crash.patch41
-rw-r--r--kde-frameworks/baloo/files/baloo-5.26.0-size-limit.patch118
-rw-r--r--kde-frameworks/baloo/files/baloo-5.26.0-thread-safety.patch253
-rw-r--r--kde-frameworks/baloo/files/baloo-5.26.0-zerotimestamp-crash.patch39
7 files changed, 695 insertions, 0 deletions
diff --git a/kde-frameworks/baloo/Manifest b/kde-frameworks/baloo/Manifest
index bd97636ef11..03248b53299 100644
--- a/kde-frameworks/baloo/Manifest
+++ b/kde-frameworks/baloo/Manifest
@@ -1,2 +1,3 @@
DIST baloo-5.23.0.tar.xz 185060 SHA256 4b32fc91a8f71b4ff5c0d7832ac6da41cdd8ea1a33594e905519565c4bbb6ed6 SHA512 3e0f157c05217c424b5eacb88773e232ce066b3354c37f95e5b5bcecb53250a0551faa3091b942ba9fc26c5905f8929311047fa5c3ef58a4ef57b46d5daa14d5 WHIRLPOOL 88c340f781f4d1c71addc709efddbb3aa20ebb44b062d723938556f6b4642e1223b876b6b0c8d152d0049e55d656962534a13abb1993691b665a1f5b7426d6b2
DIST baloo-5.25.0.tar.xz 186448 SHA256 8fef4b655660d6f2f05a5af794ab578afa2f9be7b665ed0313ce79e654c2b4c5 SHA512 3d5426f3964d563db1a7859b1db94ad74e7262c46762b286f413288f9409802ae6298fb8912d6a52304e68659491896242806cd825a6e539dde5148cbff5f86d WHIRLPOOL 8dc02221a8a09bef3a24b26e4e779d4258f595be1077c93597adf34e65211afecbc0c80af780bf189044ccd905fb343ed43d9101091012374559bf070441e36f
+DIST baloo-5.26.0.tar.xz 187444 SHA256 dedd54b468e799cf0fc6e4f69e05659605907a026ec02895fc3bc250ab13f331 SHA512 bec8591648c0e3af7e96e2097725383195fd21fbb7d973738e2ff0caff9fd631b336bccca5ac9d3bc135fda00d2e2edcd9e0d26213f8a0cd1ea88588bc97d2d2 WHIRLPOOL f33b1d5ba9fc2250586f437bc613c3088a18058594f64f80d2b23665c83aa8c15e7167f5cd60dbf8405439e374e55b2a20f92bfb8567c0da17788d47ed75357a
diff --git a/kde-frameworks/baloo/baloo-5.26.0-r1.ebuild b/kde-frameworks/baloo/baloo-5.26.0-r1.ebuild
new file mode 100644
index 00000000000..ae67c60031b
--- /dev/null
+++ b/kde-frameworks/baloo/baloo-5.26.0-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+KDE_TEST="forceoptional"
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="Framework for searching and managing metadata"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND="
+ $(add_frameworks_dep kconfig)
+ $(add_frameworks_dep kcoreaddons)
+ $(add_frameworks_dep kcrash)
+ $(add_frameworks_dep kdbusaddons)
+ $(add_frameworks_dep kfilemetadata)
+ $(add_frameworks_dep ki18n)
+ $(add_frameworks_dep kidletime)
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep solid)
+ $(add_qt_dep qtdbus)
+ $(add_qt_dep qtdeclarative)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtwidgets)
+ >=dev-db/lmdb-0.9.17
+"
+RDEPEND="${DEPEND}
+ !kde-base/baloo:4[-minimal(-)]
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-runtime-crash.patch"
+ "${FILESDIR}/${P}-size-limit.patch"
+ "${FILESDIR}/${P}-zerotimestamp-crash.patch"
+ "${FILESDIR}/${P}-thread-safety.patch"
+ "${FILESDIR}/${P}-dont-corrupt.patch"
+)
+
+pkg_postinst() {
+ kde5_pkg_postinst
+ if use x86; then
+ ewarn "The baloo index size limit for 32-bit is 1GB. For large homes, exclude"
+ ewarn "subdirectories in System Settings / Search to avoid random segfaults."
+ ewarn "For more information, visit: https://bugs.kde.org/show_bug.cgi?id=364475"
+ fi
+}
diff --git a/kde-frameworks/baloo/files/baloo-5.26.0-dont-corrupt.patch b/kde-frameworks/baloo/files/baloo-5.26.0-dont-corrupt.patch
new file mode 100644
index 00000000000..1dc1f1f19fc
--- /dev/null
+++ b/kde-frameworks/baloo/files/baloo-5.26.0-dont-corrupt.patch
@@ -0,0 +1,193 @@
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Sun, 11 Sep 2016 21:36:27 +0000
+Subject: Open baloo lmdb database read-only beside in baloo_file/baloo_file_extractor + balooctl (for some commands) + unit tests
+X-Git-Url: http://quickgit.kde.org/?p=baloo.git&a=commitdiff&h=02047b524a176da447d8c96e15c7e2abae8339ae
+---
+Open baloo lmdb database read-only beside in baloo_file/baloo_file_extractor + balooctl (for some commands) + unit tests
+
+At the moment, any application that uses baloo can corrupt the db.
+Now, only the things that need to write to it open it with read-write.
+This only works as long as the library exposes only read-only things like Query/...
+
+REVIEW: 128892
+---
+
+
+--- a/src/engine/database.cpp
++++ b/src/engine/database.cpp
+@@ -79,7 +79,7 @@
+ }
+ QFileInfo indexInfo(dir, QStringLiteral("index"));
+
+- if (mode == OpenDatabase && !indexInfo.exists()) {
++ if ((mode != CreateDatabase) && !indexInfo.exists()) {
+ return false;
+ }
+
+@@ -117,7 +117,7 @@
+
+ // The directory needs to be created before opening the environment
+ QByteArray arr = QFile::encodeName(indexInfo.absoluteFilePath());
+- rc = mdb_env_open(m_env, arr.constData(), MDB_NOSUBDIR | MDB_NOMEMINIT, 0664);
++ rc = mdb_env_open(m_env, arr.constData(), MDB_NOSUBDIR | MDB_NOMEMINIT | ((mode == ReadOnlyDatabase) ? MDB_RDONLY : 0), 0664);
+ if (rc) {
+ mdb_env_close(m_env);
+ m_env = nullptr;
+@@ -136,7 +136,7 @@
+ // Individual Databases
+ //
+ MDB_txn* txn;
+- if (mode == OpenDatabase) {
++ if (mode != CreateDatabase) {
+ int rc = mdb_txn_begin(m_env, NULL, MDB_RDONLY, &txn);
+ Q_ASSERT_X(rc == 0, "Database::transaction ro begin", mdb_strerror(rc));
+ if (rc) {
+
+--- a/src/engine/database.h
++++ b/src/engine/database.h
+@@ -49,8 +49,20 @@
+ * Database open mode
+ */
+ enum OpenMode {
++ /**
++ * Create + open read-write dabase.
++ */
+ CreateDatabase,
+- OpenDatabase
++
++ /**
++ * Read-Write Database, only works if database exists.
++ */
++ ReadWriteDatabase,
++
++ /**
++ * Read-Only Database, only works if database exists.
++ */
++ ReadOnlyDatabase
+ };
+
+ /**
+
+--- a/src/file/extractor/app.cpp
++++ b/src/file/extractor/app.cpp
+@@ -55,7 +55,7 @@
+ void App::slotNewInput()
+ {
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadWriteDatabase)) {
+ qCritical() << "Failed to open the database";
+ exit(1);
+ }
+
+--- a/src/lib/file.cpp
++++ b/src/lib/file.cpp
+@@ -96,7 +96,7 @@
+ }
+
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadOnlyDatabase)) {
+ return false;
+ }
+
+
+--- a/src/lib/searchstore.cpp
++++ b/src/lib/searchstore.cpp
+@@ -48,7 +48,7 @@
+ : m_db(0)
+ {
+ m_db = globalDatabaseInstance();
+- if (!m_db->open(Database::OpenDatabase)) {
++ if (!m_db->open(Database::ReadOnlyDatabase)) {
+ m_db = 0;
+ }
+
+
+--- a/src/lib/taglistjob.cpp
++++ b/src/lib/taglistjob.cpp
+@@ -46,7 +46,7 @@
+ void TagListJob::start()
+ {
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadOnlyDatabase)) {
+ setError(UserDefinedError);
+ setErrorText(QStringLiteral("Failed to open the database"));
+ emitResult();
+
+--- a/src/qml/experimental/monitor.cpp
++++ b/src/qml/experimental/monitor.cpp
+@@ -126,7 +126,7 @@
+ void Monitor::fetchTotalFiles()
+ {
+ Baloo::Database *db = Baloo::globalDatabaseInstance();
+- if (db->open(Baloo::Database::OpenDatabase)) {
++ if (db->open(Baloo::Database::ReadOnlyDatabase)) {
+ Baloo::Transaction tr(db, Baloo::Transaction::ReadOnly);
+ m_totalFiles = tr.size();
+ m_filesIndexed = tr.size() - tr.phaseOneSize();
+
+--- a/src/tools/balooctl/main.cpp
++++ b/src/tools/balooctl/main.cpp
+@@ -191,7 +191,7 @@
+ }
+
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadWriteDatabase)) {
+ out << "Baloo Index could not be opened\n";
+ return 1;
+ }
+@@ -230,7 +230,7 @@
+ }
+
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadWriteDatabase)) {
+ out << "Baloo Index could not be opened\n";
+ return 1;
+ }
+@@ -260,7 +260,7 @@
+
+ if (command == QStringLiteral("indexSize")) {
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadOnlyDatabase)) {
+ out << "Baloo Index could not be opened\n";
+ return 1;
+ }
+@@ -311,7 +311,7 @@
+
+ if (command == QStringLiteral("checkDb")) {
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadOnlyDatabase)) {
+ out << "Baloo Index could not be opened\n";
+ return 1;
+ }
+
+--- a/src/tools/balooctl/statuscommand.cpp
++++ b/src/tools/balooctl/statuscommand.cpp
+@@ -56,7 +56,7 @@
+ }
+
+ Database *db = globalDatabaseInstance();
+- if (!db->open(Database::OpenDatabase)) {
++ if (!db->open(Database::ReadOnlyDatabase)) {
+ out << i18n("Baloo Index could not be opened") << endl;
+ return 1;
+ }
+
+--- a/src/tools/balooshow/main.cpp
++++ b/src/tools/balooshow/main.cpp
+@@ -101,7 +101,7 @@
+ QString text;
+
+ Baloo::Database *db = Baloo::globalDatabaseInstance();
+- if (!db->open(Baloo::Database::OpenDatabase)) {
++ if (!db->open(Baloo::Database::ReadOnlyDatabase)) {
+ stream << i18n("The Baloo index could not be opened. Please run \"balooctl status\" to see if Baloo is enabled and working.")
+ << endl;
+ return 1;
+
diff --git a/kde-frameworks/baloo/files/baloo-5.26.0-runtime-crash.patch b/kde-frameworks/baloo/files/baloo-5.26.0-runtime-crash.patch
new file mode 100644
index 00000000000..0ae8b9b453d
--- /dev/null
+++ b/kde-frameworks/baloo/files/baloo-5.26.0-runtime-crash.patch
@@ -0,0 +1,41 @@
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 08 Sep 2016 22:00:40 +0000
+Subject: fix baloo_file crash with corrupted database
+X-Git-Url: http://quickgit.kde.org/?p=baloo.git&a=commitdiff&h=a03b0caa4ca1fbfc249bfc0c2730aac340bbf929
+---
+fix baloo_file crash with corrupted database
+
+CHANGELOG: Handle corruption of index database for baloo_file, try to recreate the database or abort if that fails.
+
+REVIEW: 128865
+---
+
+
+--- a/src/file/main.cpp
++++ b/src/file/main.cpp
+@@ -82,7 +82,23 @@
+ QFile::remove(path + "/index-lock");
+
+ Baloo::Database *db = Baloo::globalDatabaseInstance();
+- db->open(Baloo::Database::CreateDatabase);
++
++ /**
++ * try to open, if that fails, try to unlink the index db and retry
++ */
++ if (!db->open(Baloo::Database::CreateDatabase)) {
++ // delete old stuff, set to initial run!
++ qWarning() << "Failed to create database, removing corrupted database.";
++ QFile::remove(path + "/index");
++ QFile::remove(path + "/index-lock");
++ indexerConfig.setInitialRun(true);
++
++ // try to create now after cleanup, if still no works => fail
++ if (!db->open(Baloo::Database::CreateDatabase)) {
++ qWarning() << "Failed to create database after deleting corrupted one.";
++ return 1;
++ }
++ }
+
+ Baloo::MainHub hub(db, &indexerConfig);
+ return app.exec();
+
diff --git a/kde-frameworks/baloo/files/baloo-5.26.0-size-limit.patch b/kde-frameworks/baloo/files/baloo-5.26.0-size-limit.patch
new file mode 100644
index 00000000000..6739a2754b6
--- /dev/null
+++ b/kde-frameworks/baloo/files/baloo-5.26.0-size-limit.patch
@@ -0,0 +1,118 @@
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Sun, 11 Sep 2016 16:54:58 +0000
+Subject: Increase size limit of baloo index for 64-bit machines
+X-Git-Url: http://quickgit.kde.org/?p=baloo.git&a=commitdiff&h=b0890aca71aa4f0fdabe65ee7b7fbd0bc844d8b8
+---
+Increase size limit of baloo index for 64-bit machines
+
+CHANGELOG: On 64-bit systems baloo allows now > 5 GB index storage.
+
+Increase size limit of baloo index for 64-bit machines to avoid crashs after > 5GB of index size.
+(Better would be additional out-of-space handling, but ATM baloo has zero checks for that)
+
+The size limit for 32-bit is still 1GB, like before (there was a silent overflow from 5GB to 1GB in the computation), people with large homes will still get random segfaults on 32-bit.
+
+Patch based on patch from Hao Zhang, Bug 364475
+
+REVIEW: 128885
+BUG: 364475
+---
+
+
+--- a/src/engine/database.cpp
++++ b/src/engine/database.cpp
+@@ -93,8 +93,18 @@
+ return false;
+ }
+
++ /**
++ * maximal number of allowed named databases, must match number of databases we create below
++ * each additional one leads to overhead
++ */
+ mdb_env_set_maxdbs(m_env, 12);
+- mdb_env_set_mapsize(m_env, static_cast<size_t>(1024) * 1024 * 1024 * 5); // 5 gb
++
++ /**
++ * size limit for database == size limit of mmap
++ * use 1 GB on 32-bit, use 256 GB on 64-bit
++ */
++ const size_t maximalSizeInBytes = size_t((sizeof(size_t) == 4) ? 1 : 256) * size_t(1024) * size_t(1024) * size_t(1024);
++ mdb_env_set_mapsize(m_env, maximalSizeInBytes);
+
+ // The directory needs to be created before opening the environment
+ QByteArray arr = QFile::encodeName(indexInfo.absoluteFilePath());
+
+--- a/src/engine/databasesize.h
++++ b/src/engine/databasesize.h
+@@ -31,30 +31,30 @@
+ * This is the size which is computed with all the pages used from all the
+ * individual database pages
+ */
+- uint expectedSize;
++ size_t expectedSize;
+
+ /**
+ * This is the size based on the MDB_env and the total number of pages used
+ */
+- uint actualSize;
++ size_t actualSize;
+
+- uint postingDb;
+- uint positionDb;
++ size_t postingDb;
++ size_t positionDb;
+
+- uint docTerms;
+- uint docFilenameTerms;
+- uint docXattrTerms;
++ size_t docTerms;
++ size_t docFilenameTerms;
++ size_t docXattrTerms;
+
+- uint idTree;
+- uint idFilename;
++ size_t idTree;
++ size_t idFilename;
+
+- uint docTime;
+- uint docData;
++ size_t docTime;
++ size_t docData;
+
+- uint contentIndexingIds;
+- uint failedIds;
++ size_t contentIndexingIds;
++ size_t failedIds;
+
+- uint mtimeDb;
++ size_t mtimeDb;
+ };
+
+ }
+
+--- a/src/engine/transaction.cpp
++++ b/src/engine/transaction.cpp
+@@ -402,7 +402,7 @@
+ //
+ // File Size
+ //
+-static uint dbiSize(MDB_txn* txn, MDB_dbi dbi)
++static size_t dbiSize(MDB_txn* txn, MDB_dbi dbi)
+ {
+ MDB_stat stat;
+ mdb_stat(txn, dbi, &stat);
+
+--- a/src/tools/balooctl/statuscommand.cpp
++++ b/src/tools/balooctl/statuscommand.cpp
+@@ -92,8 +92,8 @@
+
+ const QString path = fileIndexDbPath();
+
+- QFileInfo indexInfo(path + QLatin1String("/index"));
+- quint32 size = indexInfo.size();
++ const QFileInfo indexInfo(path + QLatin1String("/index"));
++ const auto size = indexInfo.size();
+ KFormat format(QLocale::system());
+ if (size) {
+ out << "Current size of index is " << format.formatByteSize(size, 2) << endl;
+
diff --git a/kde-frameworks/baloo/files/baloo-5.26.0-thread-safety.patch b/kde-frameworks/baloo/files/baloo-5.26.0-thread-safety.patch
new file mode 100644
index 00000000000..11965f5ef3f
--- /dev/null
+++ b/kde-frameworks/baloo/files/baloo-5.26.0-thread-safety.patch
@@ -0,0 +1,253 @@
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Sun, 11 Sep 2016 18:24:40 +0000
+Subject: Make e.g. Baloo::Query thread safe.
+X-Git-Url: http://quickgit.kde.org/?p=baloo.git&a=commitdiff&h=e34da150d82a57cf417a59b8b632b2fecb32a6f7
+---
+Make e.g. Baloo::Query thread safe.
+
+lmdb itself is thread safe (e.g. you can use the same env in multiple threads).
+Unfortunately, the Baloo:atabase itself not, as open() might race against other open calls (we have one unique db object in baloo).
+
+=> add non-recursive mutex (recursive mutex not needed, one just must avoid to call isOpen() or path() inside open, that is done, else no unit test works).
+
+REVIEW: 128890
+---
+Merged with commits
+988e5feb5de64ed25337fe2ff9b494eb30b15b47
+54f7363048c7db41f63c85f637911a5598c30e9e
+377e62b0307839edb0245d65381a3f55f594ae4e
+---
+
+--- a/src/engine/database.cpp
++++ b/src/engine/database.cpp
+@@ -1,6 +1,7 @@
+ /*
+ This file is part of the KDE Baloo project.
+ * Copyright (C) 2015 Vishesh Handa <vhanda@kde.org>
++ * Copyright (C) 2016 Christoph Cullmann <cullmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+@@ -43,23 +44,31 @@
+ #include <QFile>
+ #include <QFileInfo>
+ #include <QDir>
++#include <QMutexLocker>
+
+ using namespace Baloo;
+
+ Database::Database(const QString& path)
+ : m_path(path)
+- , m_env(0)
++ , m_env(nullptr)
+ {
+ }
+
+ Database::~Database()
+ {
+- mdb_env_close(m_env);
++ // try only to close if we did open the DB successfully
++ if (m_env) {
++ mdb_env_close(m_env);
++ m_env = nullptr;
++ }
+ }
+
+ bool Database::open(OpenMode mode)
+ {
+- if (isOpen()) {
++ QMutexLocker locker(&m_mutex);
++
++ // nop if already open!
++ if (m_env) {
+ return true;
+ }
+
+@@ -89,7 +98,7 @@
+
+ int rc = mdb_env_create(&m_env);
+ if (rc) {
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -110,7 +119,8 @@
+ QByteArray arr = QFile::encodeName(indexInfo.absoluteFilePath());
+ rc = mdb_env_open(m_env, arr.constData(), MDB_NOSUBDIR | MDB_NOMEMINIT, 0664);
+ if (rc) {
+- m_env = 0;
++ mdb_env_close(m_env);
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -118,6 +128,7 @@
+ Q_ASSERT_X(rc == 0, "Database::open reader_check", mdb_strerror(rc));
+ if (rc) {
+ mdb_env_close(m_env);
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -129,9 +140,8 @@
+ int rc = mdb_txn_begin(m_env, NULL, MDB_RDONLY, &txn);
+ Q_ASSERT_X(rc == 0, "Database::transaction ro begin", mdb_strerror(rc));
+ if (rc) {
+- mdb_txn_abort(txn);
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -157,7 +167,7 @@
+ if (!m_dbis.isValid()) {
+ mdb_txn_abort(txn);
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -165,16 +175,15 @@
+ Q_ASSERT_X(rc == 0, "Database::transaction ro commit", mdb_strerror(rc));
+ if (rc) {
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+ } else {
+ int rc = mdb_txn_begin(m_env, NULL, 0, &txn);
+ Q_ASSERT_X(rc == 0, "Database::transaction begin", mdb_strerror(rc));
+ if (rc) {
+- mdb_txn_abort(txn);
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -200,7 +209,7 @@
+ if (!m_dbis.isValid()) {
+ mdb_txn_abort(txn);
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+
+@@ -208,16 +217,24 @@
+ Q_ASSERT_X(rc == 0, "Database::transaction commit", mdb_strerror(rc));
+ if (rc) {
+ mdb_env_close(m_env);
+- m_env = 0;
++ m_env = nullptr;
+ return false;
+ }
+ }
+
++ Q_ASSERT(m_env);
+ return true;
+ }
+
++bool Database::isOpen() const
++{
++ QMutexLocker locker(&m_mutex);
++ return m_env != 0;
++}
++
+ QString Database::path() const
+ {
++ QMutexLocker locker(&m_mutex);
+ return m_path;
+ }
+
+--- a/src/engine/database.h
++++ b/src/engine/database.h
+@@ -1,6 +1,7 @@
+ /*
+ This file is part of the KDE Baloo project.
+ * Copyright (C) 2015 Vishesh Handa <vhanda@kde.org>
++ * Copyright (C) 2016 Christoph Cullmann <cullmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+@@ -21,6 +22,8 @@
+ #ifndef BALOO_DATABASE_H
+ #define BALOO_DATABASE_H
+
++#include <QMutex>
++
+ #include "document.h"
+ #include "databasedbis.h"
+
+@@ -31,21 +34,56 @@
+ class BALOO_ENGINE_EXPORT Database
+ {
+ public:
++ /**
++ * Init database for given DB path, will not open it.
++ * @param path db path
++ */
+ explicit Database(const QString& path);
++
++ /**
++ * Destruct db, might close it, if opened.
++ */
+ ~Database();
+
+- QString path() const;
+-
++ /**
++ * Database open mode
++ */
+ enum OpenMode {
+ CreateDatabase,
+ OpenDatabase
+ };
++
++ /**
++ * Open database in given mode.
++ * Nop after open was done (even if mode differs).
++ * There is no close as this would invalidate the database for all threads using it.
++ * @param mode create or open only?
++ * @return success?
++ */
+ bool open(OpenMode mode);
+
+- bool isOpen() const { return m_env != 0; }
++ /**
++ * Is database open?
++ * @return database open?
++ */
++ bool isOpen() const;
++
++ /**
++ * Path to database.
++ * @return database path
++ */
++ QString path() const;
+
+ private:
+- QString m_path;
++ /**
++ * serialize access, as open might be called from multiple threads
++ */
++ mutable QMutex m_mutex;
++
++ /**
++ * database path
++ */
++ const QString m_path;
+
+ MDB_env* m_env;
+ DatabaseDbis m_dbis;
+@@ -56,6 +94,5 @@
+ };
+ }
+
+-
+ #endif // BALOO_DATABASE_H
+
diff --git a/kde-frameworks/baloo/files/baloo-5.26.0-zerotimestamp-crash.patch b/kde-frameworks/baloo/files/baloo-5.26.0-zerotimestamp-crash.patch
new file mode 100644
index 00000000000..7e666137861
--- /dev/null
+++ b/kde-frameworks/baloo/files/baloo-5.26.0-zerotimestamp-crash.patch
@@ -0,0 +1,39 @@
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Sun, 11 Sep 2016 16:48:53 +0000
+Subject: allow ctime/mtime == 0
+X-Git-Url: http://quickgit.kde.org/?p=baloo.git&a=commitdiff&h=628daced19b88d0c537736a14aea3287a4662609
+---
+allow ctime/mtime == 0
+
+Fix that baloo is instant killed by any file with timestamp 0. (which is OK and can easily happen after unpacking some zip/tar/..)
+
+REVIEW: 128887
+BUG: 355238
+---
+
+
+--- a/src/engine/documenttimedb.cpp
++++ b/src/engine/documenttimedb.cpp
+@@ -58,8 +58,6 @@
+ void DocumentTimeDB::put(quint64 docId, const TimeInfo& info)
+ {
+ Q_ASSERT(docId > 0);
+- Q_ASSERT(info.mTime);
+- Q_ASSERT(info.cTime);
+
+ MDB_val key;
+ key.mv_size = sizeof(quint64);
+
+--- a/src/engine/writetransaction.cpp
++++ b/src/engine/writetransaction.cpp
+@@ -206,9 +206,6 @@
+ }
+
+ if (operations & DocumentTime) {
+- Q_ASSERT(doc.m_mTime);
+- Q_ASSERT(doc.m_cTime);
+-
+ DocumentTimeDB::TimeInfo info;
+ info.mTime = doc.m_mTime;
+ info.cTime = doc.m_cTime;
+