Conversation
Cards mount at /media/<user>/<LABEL> (or /run/media/<user>/<LABEL>) on Linux, one level below where the drive scan looked. It listed the empty /media/<user> directory itself instead, and an unreadable /media/root where another user's session had left a mount, both badged as fake removable drives, while the actual card never showed up. Read /proc/self/mountinfo instead: it names real mount points, gives the filesystem type (surfaced in the drive panel), and lets pseudo, network and system filesystems be filtered by type rather than by guessing from the path. Falls back to the old /Volumes,/media,/mnt scan if /proc is unavailable (some containers).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes drive detection on Linux, tested on this machine while getting offloader running here.
Problem
The Linux volume scan listed the children of
/media. Ubuntu (and most distros using udisks) mounts removable media one level deeper, at/media/<user>/<LABEL>, so:/media/<user>directory itself was listed and badged as a removable drive/media/rootshowed up too, unreadableFix
_linux_volumes()now reads/proc/self/mountinfodirectly: real mount points, actual filesystem type, and enough to filter out pseudo filesystems (tmpfs, overlay, gvfs, squashfs, ...), classify network and optical filesystems by type, and tell a removable device from a fixed one via sysfs rather than guessing from the path. The drive panel also now shows the filesystem type on Linux, matching what it already showed via GetVolumeInformationW on Windows.Falls back to the previous
/Volumes,/media,/mntscan if/procisn't available (some containers).Windows and macOS paths are untouched.
Testing
ruff checkclean.mountinfotable covering: cards under/media/<user>and/run/media/<user>, octal-escaped mount points (spaces in labels), pseudo/system mounts excluded, and drive-type classification (fixed/removable/network/optical).