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,23 @@ _k_updateFstabMountPointsCache(); _k_updateMtabMountPointsCache(); - QStringList devices = globalFstabCache->m_fstabCache.keys(); - devices += globalFstabCache->m_mtabCache.keys(); - devices.removeDuplicates(); + QStringList devices = globalFstabCache->m_mtabCache.keys(); + const QStringList fstabDevices = globalFstabCache->m_fstabCache.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 (const QString &device : fstabDevices) { + // one of device or deviceName will have a trailing slash + 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; }