diff --git a/src/solid/devices/backends/fstab/fstabhandling.cpp b/src/solid/devices/backends/fstab/fstabhandling.cpp --- a/src/solid/devices/backends/fstab/fstabhandling.cpp +++ b/src/solid/devices/backends/fstab/fstabhandling.cpp @@ -223,9 +223,26 @@ _k_updateFstabMountPointsCache(); _k_updateMtabMountPointsCache(); - QStringList devices = globalFstabCache->m_fstabCache.keys(); - devices += globalFstabCache->m_mtabCache.keys(); - devices.removeDuplicates(); + QStringList devices = globalFstabCache->m_mtabCache.keys(); + + // Ensure that regardless an fstab device ends with a slash + // it will match its eventual mounted device regardless whether or not it ends with a slash + for (auto it = globalFstabCache->m_fstabCache.constBegin(), + end = globalFstabCache->m_fstabCache.constEnd(); + it != end; ++it) { + + // one of device or deviceName will have a trailing slash + auto device = it.key(); + QString deviceName = device; + if (deviceName.endsWith(QLatin1Char('/'))) { + deviceName.chop(1); + } else { + deviceName.append(QLatin1Char('/')); + } + if (!devices.contains(deviceName) && !devices.contains(device)) { + devices.append(device); + } + } return devices; }