Skip to content

Find the base mount point of a partition that has bind mounts

Ahmad Samir requested to merge work/ahmad/bind-mount into master

With bind mounts on Linux, UDisks returns a 'MountPoints' property that could include several paths, try to get the actual mount point of the partition and ignore bind mounts.

Inspired by the approach used by GNOME's gio, use libmount to parse "/proc/self/mountinfo" and check the path returned by mnt_fs_get_root(), for the base partition this should return "/", for bind mounts it returns a dir e.g. /mnt/dirA/.

This fixes a bug where clicking a Device icon in the Places panel could open the path of one of the bind mounts instead of the actual/base partition mount point, which is confusing to say the least.

For more details: !37 (merged)

https://gitlab.gnome.org/GNOME/glib/-/issues/1271#note_352412 https://gitlab.gnome.org/GNOME/glib/-/commit/e1fa5ffb91e74376394fe17612015d44fec82366 https://github.com/storaged-project/udisks/issues/478

BUG: 349617 FIXED-IN: 5.84

Edited by Ahmad Samir

Merge request reports