Repository navigation
Use mountinfo for Android drive enumeration - #137815
Merged
Merged
Conversation
Route Android through the existing decoded mountinfo enumeration path and add isolated source-linked regression coverage for routing, escaped destinations and native fallback. Co-authored-by: Copilot App <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
1 similar comment
This comment was marked as off-topic.
This comment was marked as off-topic.
jkotas
reviewed
Nov 18, 2026
This was referenced Nov 18, 2026
Remove the test-only helper project, routing fixture and Common.Tests wiring. Retain the one-line Android enumeration fix and the existing shared mountinfo parser tests. Co-authored-by: Copilot App <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
1 similar comment
This comment was marked as off-topic.
This comment was marked as off-topic.
jkotas
approved these changes
Nov 21, 2026
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.
This is a follow-up to #137195, which fixed escaped Linux mount paths reported in #123347. The original issue is about desktop Linux; the Android gap was found while reviewing that fix, rather than in a separate customer report, and later reproduced using controlled mounts on Android emulators.
Android already uses the shared mountinfo parser for filesystem-format lookup, but drive enumeration still goes through Bionic's native mount reader, which leaves octal escapes intact. Include Android in the existing managed enumeration path so that
DriveInfo.GetDrives(),Environment.GetLogicalDrives(), andDirectory.GetLogicalDrives()return decoded mount destinations when mountinfo is available.For example, if an Android process has a mount at
/mnt/USB Disk, enumeration should return that path rather than/mnt/USB\040Disk. This is conditional: ordinary Android USB/SD-card paths normally use UUIDs, so a space in a volume label alone does not demonstrate the problem. The native fallback is unchanged when mountinfo is unavailable.Add 22 regression cases to
Common.Tests. A separate test-only helper assembly compiles the actual product helper and decoder with simulated OS checks and temporary mountinfo files. This keeps the substitutes out of other tests and avoids adding a product test hook. The cases cover Android/Linux routing, escaped and literal paths, long records, bind destinations, duplicates, empty tables and native-fallback selection.Testing
Common.Testson Windows: 1,779 passed, 0 failed or skipped.System.IO.FileSystem.DriveInfo.Testson Windows: 24 passed, 0 failed or skipped.net12.0-unixmanaged DriveInfo build: passed with 0 warnings or errors.DriveInfo.GetDrives()failed before the change and returned usable decoded paths afterward.UnauthorizedAccessException. The original native reader still enumerated through/proc/mountsin those controls.The broader all-target Android cross-build encountered APICompat attribute errors that also reproduce with the fix removed. No suppressions were added.
Performance and limits
BenchmarkDotNet ran the original and changed enumeration helpers in optimized Release Android apps over unchanged ordinary mounts:
The managed route is about 1.8-1.9 times slower and allocates 3.6-4.2 times more in these emulator measurements. Together with the unreadable-mountinfo behavior, this is a trade-off to review before choosing this implementation; the one-line fix is not presented as unconditionally ready to merge.
The public DriveInfo library was rebuilt from product sources against the installed .NET 10 contract. A complete matching .NET 12 runtime/CoreLib was not deployed, so corrected public
Environment.GetLogicalDrives()andDirectory.GetLogicalDrives()were not tested. The experimental CoreCLR APK built but aborted with a missing native P/Invoke; it is not counted as a pass. No physical device, ordinary USB/SD-card customer scenario, ARM or NativeAOT execution is covered.Privileged setup was used only to create controlled mounts in the app's namespace. The actual managed queries ran as an ordinary
untrusted_appUID with SELinux enforcing. Setup, validation results and limitations are documented in the linked issue.Fixes #137813
Note
Generated with GitHub Copilot.