Bug 418906

Summary: UDI (Unique Device Identifier) provided by solid is not actually unique, entry gets overwritten
Product: [Frameworks and Libraries] frameworks-solid Reporter: Bernard Gray <bernard.gray>
Component: generalAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED FIXED    
Severity: major CC: kdelibs-bugs, meven29
Priority: NOR    
Version: 5.44.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.69

Description Bernard Gray 2020-03-16 02:43:05 UTC
SUMMARY

Unique Device Identifier provided by solid is not unique


STEPS TO REPRODUCE
1. Sign in as user 1 and mount a samba network share (cifs://server/files) as user1 under /home/user1/files/


2. run `solid-hardware list details` to see the solid-hardware entry, note the: 
  UDI /org/kde/fstab///server/files, and
  StorageAccess.filePath = '/home/user1/files' (String)


3. Switch user and sign in as user2 , then mount _the_same_ network share smb://server/files as user2 under /home/user2/files/

4. confirm both shares are correctly mounted: `mount | grep files`

5. run `solid-hardware list details` to see the solid-hardware entries


OBSERVED RESULT
solid-hardware list details shows a single entry for the mounted network share, with the StorageAccess.filePath value of the most recently mounted share. The previous solid-hardware device entry is overwritten
The UDI is identical to the first mounted device, which means that solid is not actually using "Unique" Identifiers -


EXPECTED RESULT
solid-hardware list details should show multiple entries for the same network share mounted at different locations.
These entries should have a unique UDI

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 18.04 (bionic)/KDE Plasma 5.12.9
(available in About System)
KDE Plasma Version: 5.12.9
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
This manifests itself in places like dolphin, in the device list it will only show the most recently mounted share, making the shortcut inaccessible to user1 via the Devices panel list.
Comment 1 Bernard Gray 2020-03-16 02:59:36 UTC
To extend ADDITIONAL INFORMATION section:
...making the shortcut inaccessible to user1 via the Devices panel list.

Note that user1 still *sees* the share/Device listed (which is expected), but clicking on it attempts to display the contents of the mountpoint in user2's home directory (which is *not* expected)
Comment 2 Bernard Gray 2020-03-16 05:19:29 UTC
Further clarification:

When mounting the network share, use `sudo mount.cifs` (not the KDE userspace way).

In my specific use case, users mount network shares using mount.cifs called by the pam_mount module at login -
Comment 3 Méven Car 2020-04-01 08:46:16 UTC
Differential review: https://phabricator.kde.org/D28476
Comment 4 Méven Car 2020-04-01 10:28:40 UTC
Git commit a99c6136da2d232dd699a8accd58deae1db3be41 by Méven Car.
Committed on 01/04/2020 at 10:28.
Pushed by meven into branch 'master'.

Samba: Ensure to differenciate mounts sharing the same source

Summary:
`getmntent` for samba returns fsname of the form "//server/folder" (same as `mount`)
It is not sufficient to use in udi as device name as it does not differenciate mounts sharing the same source but having different mount points.
FIXED-IN: 5.69

Test Plan:
With a local cifs mount point:

Before
$ solid-hardware5 list | grep ourfiles
udi = '/org/kde/fstab///meven-synapse/ourfiles'

After
$ solid-hardware5 list | grep ourfiles
udi = '/org/kde/fstab///meven-synapse/ourfiles:/media/samba'

Reviewers: #frameworks, sitter

Reviewed By: sitter

Subscribers: ahmadsamir, anthonyfieroni, sitter, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28476

M  +4    -0    src/solid/devices/backends/fstab/fstabhandling.cpp

https://commits.kde.org/solid/a99c6136da2d232dd699a8accd58deae1db3be41