pull in upstream fixes

epel9
Rex Dieter 7 years ago
parent 3d6730d783
commit 655fcef9e9

@ -0,0 +1,49 @@
From 122a6cd8989a4bd3096fddea908a1c2b223be62a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sun, 8 Apr 2018 22:12:10 +0200
Subject: [PATCH 1/5] [UDisks] Correct handling of removable file systems
Summary:
Filesystems which have no fstab entry have an empty filepath (aka
mountpoint), but these should be mountable nevertheless.
The StorageAccess.ignored flag should only be used as a hint if a
device (filesystem) should create a device item in e.g Dolphin.
BUG: 391706
CCBUG: 389479
Reviewers: ngraham, broulik
Reviewed By: ngraham
Subscribers: #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D12051
---
src/solid/devices/backends/udisks2/udisksstorageaccess.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
index dd8f76f..7db2263 100644
--- a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
+++ b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
@@ -111,10 +111,10 @@ bool StorageAccess::isIgnored() const
const QString path = filePath();
- return !path.isEmpty()
- && !path.startsWith(QLatin1String("/media/"))
- && !path.startsWith(QLatin1String("/run/media/"))
- && !path.startsWith(QDir::homePath());
+ bool inUserPath = path.startsWith(QLatin1String("/media/")) ||
+ path.startsWith(QLatin1String("/run/media/")) ||
+ path.startsWith(QDir::homePath());
+ return !inUserPath;
}
bool StorageAccess::setup()
--
2.14.3

@ -0,0 +1,101 @@
From 3c0f767f0337fc136976545cb29f89d76a4a5a8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 10 Apr 2018 06:52:58 +0200
Subject: [PATCH 2/5] [UDisks] Optimize several property checks
Summary:
Use QStringLiteral for hasInterface argument
Retrieve MountPoints propery just once when checking mount state.
Test Plan:
make
solid-hardware5 list details
Reviewers: #frameworks, broulik
Reviewed By: broulik
Subscribers: broulik
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D12123
---
src/solid/devices/backends/udisks2/udisksdevice.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/solid/devices/backends/udisks2/udisksdevice.cpp b/src/solid/devices/backends/udisks2/udisksdevice.cpp
index bbdd904..f3fdfff 100644
--- a/src/solid/devices/backends/udisks2/udisksdevice.cpp
+++ b/src/solid/devices/backends/udisks2/udisksdevice.cpp
@@ -780,17 +780,17 @@ Solid::ErrorType Device::errorToSolidError(const QString &error) const
bool Device::isBlock() const
{
- return hasInterface(UD2_DBUS_INTERFACE_BLOCK);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_BLOCK));
}
bool Device::isPartition() const
{
- return hasInterface(UD2_DBUS_INTERFACE_PARTITION);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_PARTITION));
}
bool Device::isPartitionTable() const
{
- return hasInterface(UD2_DBUS_INTERFACE_PARTITIONTABLE);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_PARTITIONTABLE));
}
bool Device::isStorageVolume() const
@@ -800,12 +800,12 @@ bool Device::isStorageVolume() const
bool Device::isStorageAccess() const
{
- return hasInterface(UD2_DBUS_INTERFACE_FILESYSTEM) || isEncryptedContainer();
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_FILESYSTEM)) || isEncryptedContainer();
}
bool Device::isDrive() const
{
- return hasInterface(UD2_DBUS_INTERFACE_DRIVE);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_DRIVE));
}
bool Device::isOpticalDrive() const
@@ -837,12 +837,13 @@ bool Device::mightBeOpticalDisc() const
bool Device::isMounted() const
{
- return propertyExists("MountPoints") && !qdbus_cast<QByteArrayList>(prop("MountPoints")).isEmpty();
+ QVariant mountPoints = prop(QStringLiteral("MountPoints"));
+ return mountPoints.isValid() && !qdbus_cast<QByteArrayList>(mountPoints).isEmpty();
}
bool Device::isEncryptedContainer() const
{
- return hasInterface(UD2_DBUS_INTERFACE_ENCRYPTED);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_ENCRYPTED));
}
bool Device::isEncryptedCleartext() const
@@ -857,12 +858,12 @@ bool Device::isEncryptedCleartext() const
bool Device::isSwap() const
{
- return hasInterface(UD2_DBUS_INTERFACE_SWAP);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_SWAP));
}
bool Device::isLoop() const
{
- return hasInterface(UD2_DBUS_INTERFACE_LOOP);
+ return hasInterface(QStringLiteral(UD2_DBUS_INTERFACE_LOOP));
}
QString Device::drivePath() const
--
2.14.3

@ -0,0 +1,58 @@
From 15047128e56b97f0c6df4628f87e3653a754ad95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 12 Apr 2018 00:02:29 +0200
Subject: [PATCH 3/5] Avoid creating duplicate property entries in the cache
Summary:
Properties are associated with a specific interface, although the Solid
UDisks2 backend merges properties from all interfaces into a single
namespace.
Fortunately most properties have either unique names accross interfaces,
or are consistent (e.g. "Size" in org.fd.UDisks2.{Block,Partition}), thus
this poses no problem in practice.
QMap<>::unite(other) behaves like QMap<>::insertMulti(item), i.e. the
map may contain multiple values per key, while QMap<>::insert(item)
updates the value for existing keys.
Test Plan:
make
solid-hardware list details
Reviewers: #frameworks, broulik
Reviewed By: broulik
Subscribers: broulik
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D12124
---
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
index 69ebc72..def7dff 100644
--- a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
+++ b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
@@ -139,11 +139,15 @@ QVariantMap DeviceBackend::allProperties() const
QDBusPendingReply<QVariantMap> reply = QDBusConnection::systemBus().call(call);
if (reply.isValid()) {
- m_propertyCache.unite(reply.value());
+ auto props = reply.value();
+ // Can not use QMap<>::unite(), as it allows multiple values per key
+ for (auto it = props.cbegin(); it != props.cend(); ++it) {
+ m_propertyCache.insert(it.key(), it.value());
+ }
} else {
qWarning() << "Error getting props:" << reply.error().name() << reply.error().message();
}
- //qDebug() << "After iface" << iface << ", cache now contains" << m_cache.size() << "items";
+ //qDebug() << "After iface" << iface << ", cache now contains" << m_propertyCache.size() << "items";
}
return m_propertyCache;
--
2.14.3

@ -0,0 +1,43 @@
From 796dea6c044030bc2c02bcfcc967e1fffe9fa276 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 12 Apr 2018 00:12:54 +0200
Subject: [PATCH 4/5] Invalidate property cache when an interface is removed
Summary:
As we do not know which property belongs to which interface we have to
drop the whole cache whenever one or multiples interface are removed.
Test Plan:
make
solid-hardware5 list details
solid-hardware5 listen
Reviewers: #frameworks, broulik
Reviewed By: broulik
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D12126
---
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
index def7dff..2349d54 100644
--- a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
+++ b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp
@@ -247,4 +247,10 @@ void DeviceBackend::slotInterfacesRemoved(const QDBusObjectPath &object_path, co
Q_FOREACH (const QString &iface, interfaces) {
m_interfaces.removeAll(iface);
}
+
+ // We don't know which property belongs to which interface, so remove all
+ m_propertyCache.clear();
+ if (!m_interfaces.isEmpty()) {
+ allProperties();
+ }
}
--
2.14.3

@ -0,0 +1,118 @@
From d735708ff11c40ee6b9bee64544250d55067403f Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Tue, 1 May 2018 22:16:28 +0100
Subject: [PATCH 5/5] Update mount point after mount operations
Summary:
The order of udisks evaluation has changed from:
call Mount
propertiesChanged
mount call returns
call Mount
mount call returns
propertiesChanged
The mount has finished, but the property is not yet updated.
Solid caches properties, updating them when they change. This worked
before but due to the re-ordering client code gets "setupDone" requests
the mount point gets an outdated version from the cache and we get
errors. Invalidating the cache causes us to round-trip to the udisks
daemon meaning we'll have the correct values.
BUG: 370975
Test Plan:
Diagnosed but with dbus-monitor trace
Asked someone on the bug report to test this
Reviewers: #plasma
Subscribers: #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D12648
---
src/solid/devices/backends/udisks2/udisksdevice.cpp | 7 +++++++
src/solid/devices/backends/udisks2/udisksdevice.h | 1 +
src/solid/devices/backends/udisks2/udisksstorageaccess.cpp | 8 ++++----
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/solid/devices/backends/udisks2/udisksdevice.cpp b/src/solid/devices/backends/udisks2/udisksdevice.cpp
index f3fdfff..0df32be 100644
--- a/src/solid/devices/backends/udisks2/udisksdevice.cpp
+++ b/src/solid/devices/backends/udisks2/udisksdevice.cpp
@@ -157,6 +157,13 @@ QStringList Device::interfaces() const
return QStringList();
}
+void Device::invalidateCache()
+{
+ if (m_backend) {
+ return m_backend->invalidateProperties();
+ }
+}
+
QObject *Device::createDeviceInterface(const Solid::DeviceInterface::Type &type)
{
if (!queryDeviceInterface(type)) {
diff --git a/src/solid/devices/backends/udisks2/udisksdevice.h b/src/solid/devices/backends/udisks2/udisksdevice.h
index 147d554..1492564 100644
--- a/src/solid/devices/backends/udisks2/udisksdevice.h
+++ b/src/solid/devices/backends/udisks2/udisksdevice.h
@@ -61,6 +61,7 @@ public:
QVariant prop(const QString &key) const;
bool propertyExists(const QString &key) const;
QVariantMap allProperties() const;
+ void invalidateCache();
bool hasInterface(const QString &name) const;
QStringList interfaces() const;
diff --git a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
index 7db2263..d08f35d 100644
--- a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
+++ b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
@@ -166,6 +166,7 @@ void StorageAccess::slotDBusReply(const QDBusMessage & /*reply*/)
mount();
} else { // Don't broadcast setupDone unless the setup is really done. (Fix kde#271156)
m_setupInProgress = false;
+ m_device->invalidateCache();
m_device->broadcastActionDone("setup");
checkAccessibility();
@@ -191,6 +192,7 @@ void StorageAccess::slotDBusReply(const QDBusMessage & /*reply*/)
}
m_teardownInProgress = false;
+ m_device->invalidateCache();
m_device->broadcastActionDone("teardown");
checkAccessibility();
@@ -227,9 +229,8 @@ void StorageAccess::slotSetupDone(int error, const QString &errorString)
{
m_setupInProgress = false;
//qDebug() << "SETUP DONE:" << m_device->udi();
- emit setupDone(static_cast<Solid::ErrorType>(error), errorString, m_device->udi());
-
checkAccessibility();
+ emit setupDone(static_cast<Solid::ErrorType>(error), errorString, m_device->udi());
}
void StorageAccess::slotTeardownRequested()
@@ -241,9 +242,8 @@ void StorageAccess::slotTeardownRequested()
void StorageAccess::slotTeardownDone(int error, const QString &errorString)
{
m_teardownInProgress = false;
- emit teardownDone(static_cast<Solid::ErrorType>(error), errorString, m_device->udi());
-
checkAccessibility();
+ emit teardownDone(static_cast<Solid::ErrorType>(error), errorString, m_device->udi());
}
bool StorageAccess::mount()
--
2.14.3

@ -2,7 +2,7 @@
Name: kf5-%{framework} Name: kf5-%{framework}
Version: 5.45.0 Version: 5.45.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: KDE Frameworks 5 Tier 1 integration module that provides hardware information Summary: KDE Frameworks 5 Tier 1 integration module that provides hardware information
License: LGPLv2+ License: LGPLv2+
@ -18,6 +18,11 @@ URL: https://solid.kde.org/
Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{framework}-%{version}.tar.xz Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{framework}-%{version}.tar.xz
## upstreamable patches ## upstreamable patches
Patch1: 0001-UDisks-Correct-handling-of-removable-file-systems.patch
Patch2: 0002-UDisks-Optimize-several-property-checks.patch
Patch3: 0003-Avoid-creating-duplicate-property-entries-in-the-cac.patch
Patch4: 0004-Invalidate-property-cache-when-an-interface-is-remov.patch
Patch5: 0005-Update-mount-point-after-mount-operations.patch
BuildRequires: extra-cmake-modules >= %{version} BuildRequires: extra-cmake-modules >= %{version}
BuildRequires: kf5-rpm-macros >= %{version} BuildRequires: kf5-rpm-macros >= %{version}
@ -114,6 +119,9 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
%changelog %changelog
* Wed May 02 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.45.0-2
- pull in upstream fixes
* Sun Apr 08 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.45.0-1 * Sun Apr 08 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.45.0-1
- 5.45.0 - 5.45.0

Loading…
Cancel
Save