From c35eac32e7e6e443156d7964dae9084a106334fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Deop=20i=20Argem=C3=AD?= Date: Wed, 7 Jun 2023 21:08:37 +0200 Subject: [PATCH] fix: backport patch from upstream to fix btrfs re-indexing --- kf5-baloo.spec | 7 ++- ...the_device_identifier_where_possible.patch | 43 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 use_the_FSID_as_the_device_identifier_where_possible.patch diff --git a/kf5-baloo.spec b/kf5-baloo.spec index d3f2c53..cbfab7f 100644 --- a/kf5-baloo.spec +++ b/kf5-baloo.spec @@ -10,7 +10,7 @@ Name: kf5-%{framework} Summary: A Tier 3 KDE Frameworks 5 module that provides indexing and search functionality Version: 5.107.0 -Release: 1%{?dist} +Release: 2%{?dist} # libs are LGPL, tools are GPL # KDE e.V. may determine that future LGPL/GPL versions are accepted @@ -30,6 +30,8 @@ Source2: baloo_file_shutdown.sh ## upstreamable patches # http://bugzilla.redhat.com/1235026 Patch100: baloo-5.67.0-baloofile_config.patch +# https://invent.kde.org/frameworks/baloo/-/merge_requests/131 +Patch101: use_the_FSID_as_the_device_identifier_where_possible.patch ## upstream patches @@ -207,6 +209,9 @@ make test ARGS="--output-on-failure --timeout 300" -C %{_target_platform} ||: %changelog +* Wed Jun 07 2023 Marc Deop i Argemí - 5.107.0-2 +- Backport patch from upstream + * Sat Jun 03 2023 Marc Deop i Argemí - 5.107.0-1 - 5.107.0 diff --git a/use_the_FSID_as_the_device_identifier_where_possible.patch b/use_the_FSID_as_the_device_identifier_where_possible.patch new file mode 100644 index 0000000..89ce3cd --- /dev/null +++ b/use_the_FSID_as_the_device_identifier_where_possible.patch @@ -0,0 +1,43 @@ +diff --git a/src/engine/idutils.h b/src/engine/idutils.h +index 78d881a96e894d731ba024acc8cc74b47823c96b..606ac9dca0a647fcc78ffb031c081201fbb1a491 100644 +--- a/src/engine/idutils.h ++++ b/src/engine/idutils.h +@@ -13,6 +13,8 @@ + + #ifdef Q_OS_WIN + # include ++#else ++# include + #endif + + namespace Baloo { +@@ -40,10 +42,28 @@ inline quint64 statBufToId(const QT_STATBUF& stBuf) + static_cast(stBuf.st_ino)); + } + ++#ifndef Q_OS_WIN ++inline int statWithFsid(const char* path, QT_STATBUF* statBuf) ++{ ++ int ret = QT_LSTAT(path, statBuf); ++ if (ret != 0) { ++ return ret; ++ } ++ ++ struct statvfs fsBuf; ++ ret = statvfs(path, &fsBuf); ++ if (ret == 0 && fsBuf.f_fsid != 0) { ++ // Fold FSID into 32 bits, statBufToId would discard anything else ++ statBuf->st_dev = static_cast(fsBuf.f_fsid ^ (fsBuf.f_fsid >> 32)); ++ } ++ return ret; ++} ++#endif ++ + inline int filePathToStat(const QByteArray& filePath, QT_STATBUF& statBuf) + { + #ifndef Q_OS_WIN +- return QT_LSTAT(filePath.constData(), &statBuf); ++ return statWithFsid(filePath.constData(), &statBuf); + #else + const int ret = QT_STAT(filePath.constData(), &statBuf); + const QString filePathStr = QString::fromUtf8(filePath);