Repository navigation
fix(mount): take what a disk says about itself as values - #28
Merged
Merged
Conversation
A mount point is made of the name asked for, the label and the model of the disk. MountDisk now hands the device and the mount point to the helper as two arguments, so a label with a space in it is one mount point; GetMountPoint keeps the mount point one folder of /media; and do_mount reads the filesystem type as a value from blkid.
inkly
marked this pull request as ready for review
November 10, 2026 14:14
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.
A mount point is made of the name asked for, the label and the model of the disk. This change makes all three plain values on their way to
mount.MountDiskhands the device and the mount point tolocal-storage-helper.shas two arguments, in place of one command line built by joining strings. A label with a space in it ("My Passport") is one mount point.GetMountPointkeeps the mount point one folder of/media: a/in the name becomes_, and a name that would still leave/mediafalls back toStorage_<device>. A name asked for asPhotos/2024is now/media/Photos_2024.do_mountreads the filesystem type withblkid -o value -s TYPEand takes it as a value. The message for a drive with no filesystem is unchanged.Tests. Three new tests. One checks the helper receives exactly two arguments, as they are. One checks the mount point for a list of names, labels and models. One runs the shipped script with a stand-in
blkid,lsblkandmount, and checks whatmountis given.GOOS=linux go vet ./...andgo test ./...pass in agolang:1.26container; theblkidcall was checked there against a real formatted image (util-linux 2.41.5). No real disk was mounted.