Repository navigation
[release/10.0] Decode escaped Linux mountinfo paths - #137420
Merged
Merged
Conversation
Backport #137195 to release/10.0. Keep the release/10.0 UnixFileSystemTypes compile item and add ValueStringBuilder when resolving the RuntimeInformation test project. (cherry picked from commit e0bc8a0) Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries |
2 of 4 tasks
adamsitnik
approved these changes
Nov 12, 2026
adamsitnik
left a comment
Member
There was a problem hiding this comment.
LGTM, thank you for taking care of backporting the fix @krwq !
Member
|
Hi, the code complete date for 10.0.16 (the December 2026 release) is Monday 16 November. Make sure to merge this PR on that date at the latest, or it won't make it into that release. As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval). Happy to help with the merge if needed! |
Member
Author
|
/ba-g unrelated failures |
krwq
added a commit
that referenced
this pull request
Nov 17, 2026
> [!NOTE] > This pull request description was updated with AI (GitHub Copilot). Backport of #137195 to release/11.0 /cc @krwq Fixes Issue #123347 <!-- Issue Number --> main PR #137195 <!-- Link to PR if any that fixed this in the main branch. --> # Description <!-- Give a brief summary of the issue and how the pull request is fixing it. --> Decode escaped `Root` and `MountPoint` paths when parsing Linux `/proc/self/mountinfo`. Keep ordinary paths as spans into the input, decode the four supported escapes in one pass, and preserve unknown or truncated sequences. A literal `\134040` becomes `\040`, not a space. Filesystem-type and super-options fields remain unchanged. This is the automatic .NET 11 backport of #137195 (`e0bc8a0abf07459a1b5b993896e6478c65166106`). The decoder and regression-test files are byte-for-byte identical to the merged main fix. Unlike the .NET 10 backport in #137420, this backport did not require a manual project-file conflict resolution. The project changes add the shared `ValueStringBuilder.cs` compile item to DriveInfo and RuntimeInformation.Tests. Changed files, under `src\libraries\`: - `Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.cs` - `Common\tests\Tests\Interop\procfsTests.cs` - `System.IO.FileSystem.DriveInfo\src\System.IO.FileSystem.DriveInfo.csproj` - `System.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csproj` # Customer Impact <!-- What is the impact to customers of not taking this fix? --> - [x] Customer reported - [ ] Found internally #123347 reports incorrect Linux drive information for mounted volumes whose labels contain spaces. `DriveInfo.GetDrives()` returns a name such as `/run/media/user/DISC\0403` instead of `/run/media/user/DISC 3`. `RootDirectory` is incorrect, and `DriveType` can be `NoRootDirectory` instead of `CDRom`. A [second customer report](#123347 (comment)) confirms that `Environment.GetLogicalDrives()` is also affected. Without this fix, applications cannot reliably use those returned paths. The shared parser also supplies filesystem-type lookup and cgroup paths. The change handles the Linux mount-table escapes for spaces, tabs, newlines, and backslashes. # Regression <!-- Is this fixing a problem that was introduced in the most recent release, ie., fixing a regression? --> - [x] Yes - [ ] No Introduced in .NET 10 by #116102, which switched Linux mount-point enumeration and filesystem-type lookup to `/proc/self/mountinfo`, and carried forward into .NET 11. The customer reports that the same code worked on .NET 8 and .NET 9. # Testing <!-- What kind of testing has been done with the fix. --> The added tests cover both pathname fields, all four supported escapes, combined and literal escapes, unknown/truncated sequences, Unicode, stack/pool buffer boundaries, and preservation of input-backed spans for ordinary paths. There are 31 mountinfo parser cases: the expanded 24-case theory, six buffer-boundary cases, and the original-input-span check. The previous parser coverage did not exercise the escaped pathname cases. **Validation scope:** No separate local .NET 11 build or test run was performed for this description update. The results below are supporting evidence from the manual **.NET 10** backport in #137420, not .NET 11 test results. Validation of the original main fix is recorded in #137195. The .NET 11 decoder and regression-test file blobs were compared with main and match exactly. On the .NET 10 worktree, the original parser reproduced 18 expected failures among the 24 theory cases, with no skips or runner errors. The fixed code passed all 31 parser cases on Windows and browser. Windows also passed 1,701 Common tests, 13 existing cgroup mount/path cases, 15 RuntimeInformation tests, and 24 DriveInfo tests. The Linux-managed DriveInfo build passed all three target frameworks. Browser Common passed 1,124 tests; browser RuntimeInformation passed 9 tests with 3 existing remote-executor skips. **Pre-existing .NET 10 browser limitation:** the browser commands returned 0 and wrote successful test results, but the Debug WASM runner then logged a `runtimeKeepalivePop` shutdown assertion and "Application exited without sending a wasm exit message." This was also reproduced with the exact original release/10.0 CoreLib parser and original Common test source: 1,098 tests passed, with the same shutdown diagnostics and exit code 0. No WASM runtime or runner changes are included in this fix. This observation is not a claim about a .NET 11 browser run. No live Linux mount smoke test or WASI runtime test was run locally. No shared mount state was changed. <details> <summary>Supporting .NET 10 build/test commands and results</summary> These are the existing results from #137420, using SDK `10.0.114` and locally built .NET `10.0.16` binaries. Windows uses Release CoreCLR and Debug libraries/tests; browser uses Debug Mono. Cross-target builds were run serially. `%CD%` represents that .NET 10 worktree root; these commands were not rerun against release/11.0 for this description update. | Command | Result on the .NET 10 backport | | --- | --- | | `.\build.cmd -rc Release -s clr+libs` | Passed before changes and after the port; 0 MSBuild warnings/errors. | | `.\build.cmd mono+libs -os browser` | Passed before changes; 0 MSBuild warnings/errors. | | `.\build.cmd mono.corelib+mono.wasmruntime+libs.pretest -os browser` | Passed after the port and again after restoring the fixed product from the baseline comparison; 0 MSBuild warnings/errors. | | `.\.dotnet\dotnet.exe build src\libraries\Common\tests\Common.Tests.csproj /t:Test /p:RuntimeConfiguration=Release` | Passed: 1,701 tests, 0 failures/skips/runner errors. | | `.\.dotnet\dotnet.exe build src\libraries\System.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csproj /t:Test /p:RuntimeConfiguration=Release` | Passed: 15 tests, 0 failures/skips/runner errors. | | `.\.dotnet\dotnet.exe build src\libraries\System.IO.FileSystem.DriveInfo\tests\System.IO.FileSystem.DriveInfo.Tests.csproj /t:Test /p:RuntimeConfiguration=Release` | Passed: 24 tests, 0 failures/skips/runner errors. | | `.\.dotnet\dotnet.exe build src\libraries\System.IO.FileSystem.DriveInfo\src\System.IO.FileSystem.DriveInfo.csproj /p:TargetOS=linux /p:RuntimeConfiguration=Release /p:BuildProjectReferences=false` | Passed: `net10.0`, `net10.0-unix`, and `net10.0-windows`; 0 warnings/errors. | | `.\.dotnet\dotnet.exe build src\libraries\Common\tests\Common.Tests.csproj /t:Test /p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=Mono /p:InstallV8ForTests=true /p:WasmXHarnessArgsCli=--js-engine-path=%CD%\artifacts\bin\v8-13.9.205\d8.exe` | 1,124 passed, 0 failures/skips/runner XML errors; command exit 0. Pre-existing shutdown limitation described above. | | `.\.dotnet\dotnet.exe build src\libraries\System.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csproj /t:Test /p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=Mono /p:InstallV8ForTests=true /p:WasmXHarnessArgsCli=--js-engine-path=%CD%\artifacts\bin\v8-13.9.205\d8.exe` | 9 passed, 3 existing remote-executor skips, 0 failures/runner XML errors; command exit 0. Same pre-existing shutdown limitation. | Browser execution used the restored, pinned XHarness `net10.0` entrypoint through `XHARNESS_CLI_PATH` and repository-provisioned V8 `13.9.205`. The three RuntimeInformation skips require `RemoteExecutor.IsSupported`; no tests were changed to skip. The 13 cgroup cases were source-linked into the RuntimeInformation harness using ignored scratch compile-item overrides. The negative control and browser baseline comparison also used exact original source snapshots through scratch overrides. Final product and normal test projects were rebuilt without those overrides. Full setup, exact supplemental control commands, baseline comparison, and results are recorded in #137420. </details> # Risk <!-- Please assess the risk of taking this fix. Provide details backing up your assessment. --> Low. This is the already-merged managed fix, with no decoder changes for the .NET 11 backport, no new public APIs, and no native-code changes. Only the two pathname fields are decoded, and only when they contain a backslash. Ordinary paths retain their input-backed spans. Filesystem-type and super-options fields remain unchanged; unknown/truncated sequences and literal escaped backslashes are covered by regression tests. The two project changes only include the existing shared builder source. There is no .NET 10-specific conflict resolution in this PR. Supporting validation covers the shared decoder, cgroup callers, affected project files, Linux-managed compilation, and browser compilation/execution on .NET 10; it is not presented as separate .NET 11 execution evidence. **IMPORTANT**: If this backport is for a servicing release, please verify that: - For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`, not `release/X.0`. - For .NET 10+: The PR target branch is `release/X.0` (no `-staging` suffix). # Package authoring no longer needed in .NET 9 IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. Keep in mind that we still need package authoring in .NET 8 and older versions. > AI-generated with GitHub Copilot. Co-authored-by: Krzysztof Wicher <[email protected]> Co-authored-by: Copilot App <[email protected]>
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.
Note
This pull request was generated with AI (GitHub Copilot).
Backport of #137195 to release/10.0
/cc @krwq
Fixes Issue #123347
main PR #137195
Description
Decode escaped
RootandMountPointpaths when parsing Linux/proc/self/mountinfo. Keep ordinary paths as spans into the input, decode the four supported escapes in one pass, and preserve unknown or truncated sequences. A literal\134040becomes\040, not a space.The decoding logic and regression tests are unchanged from #137195 (
e0bc8a0abf07459a1b5b993896e6478c65166106). The only manual conflict resolution keeps the existingInterop.UnixFileSystemTypes.cscompile item inSystem.Runtime.InteropServices.RuntimeInformation.Tests.csprojand addsValueStringBuilder.cs. The .NET 10 target frameworks and project layout are unchanged.Changed files, under
src\libraries\:Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.csCommon\tests\Tests\Interop\procfsTests.csSystem.IO.FileSystem.DriveInfo\src\System.IO.FileSystem.DriveInfo.csprojSystem.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csprojCustomer Impact
#123347 reports a .NET 10 regression on Linux. For a mounted volume whose label contains spaces,
DriveInfo.GetDrives()returns a name such as/run/media/user/DISC\0403instead of/run/media/user/DISC 3.RootDirectoryis incorrect, andDriveTypecan beNoRootDirectoryinstead ofCDRom.Environment.GetLogicalDrives()is also affected.Without this fix, applications cannot reliably use those returned paths. The shared parser also supplies filesystem-type lookup and cgroup paths. The change handles the Linux mount-table escapes for spaces, tabs, newlines, and backslashes.
Regression
Introduced in .NET 10 by #116102, which switched Linux mount-point enumeration and filesystem-type lookup to
/proc/self/mountinfo. The customer reports that the same code worked on .NET 8 and .NET 9.Testing
All results below are from this .NET 10 worktree, based on
56d5bb652aced6bb4fed74ab43fbdd4c39b6b7ed, using the pinned SDK10.0.114and locally built .NET10.0.16binaries. Windows uses Release CoreCLR and Debug libraries/tests; browser uses Debug Mono. Builds for different targets were run serially.The fixed code passed 1,701 Common tests, 13 existing cgroup mount/path cases, 15 RuntimeInformation tests, and 24 DriveInfo tests on Windows. The Linux-managed DriveInfo build passed all three target frameworks. Browser Common passed 1,124 tests; browser RuntimeInformation passed 9 tests with 3 existing remote-executor skips. All 31 mountinfo parser cases passed on both Windows and browser, including the six buffer-boundary cases and the original-input-span check.
Pre-existing browser limitation: both browser commands returned 0 and wrote successful test results, but the Debug WASM runner then logged a
runtimeKeepalivePopshutdown assertion and "Application exited without sending a wasm exit message." This was also reproduced with the exact original release/10.0 CoreLib parser and original Common test source: 1,098 tests passed, with the same shutdown diagnostics and exit code 0. This backport does not change the WASM runtime or runner.No live Linux mount smoke test or WASI runtime test was run on this Windows host. No shared mount state was changed.
Exact local build and test commands and results
Commands ran from a temporary short path to this worktree to avoid Windows path-length limits.
%CD%below replaces that worktree root..\build.cmd -rc Release -s clr+libs.\build.cmd mono+libs -os browser.\build.cmd mono.corelib+mono.wasmruntime+libs.pretest -os browser.\.dotnet\dotnet.exe build src\libraries\Common\tests\Common.Tests.csproj /t:Test /p:RuntimeConfiguration=Release.\.dotnet\dotnet.exe build src\libraries\System.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csproj /t:Test /p:RuntimeConfiguration=Release.\.dotnet\dotnet.exe build src\libraries\System.IO.FileSystem.DriveInfo\tests\System.IO.FileSystem.DriveInfo.Tests.csproj /t:Test /p:RuntimeConfiguration=Release.\.dotnet\dotnet.exe build src\libraries\System.IO.FileSystem.DriveInfo\src\System.IO.FileSystem.DriveInfo.csproj /p:TargetOS=linux /p:RuntimeConfiguration=Release /p:BuildProjectReferences=falsenet10.0,net10.0-unix, andnet10.0-windows; 0 warnings/errors..\.dotnet\dotnet.exe tool restore --tool-manifest %CD%\.config\dotnet-tools.json.\.dotnet\dotnet.exe build src\libraries\Common\tests\Common.Tests.csproj /t:Test /p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=Mono /p:InstallV8ForTests=true /p:WasmXHarnessArgsCli=--js-engine-path=%CD%\artifacts\bin\v8-13.9.205\d8.exe.\.dotnet\dotnet.exe build src\libraries\System.Runtime\tests\System.Runtime.InteropServices.RuntimeInformation.Tests\System.Runtime.InteropServices.RuntimeInformation.Tests.csproj /t:Test /p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=Mono /p:InstallV8ForTests=true /p:WasmXHarnessArgsCli=--js-engine-path=%CD%\artifacts\bin\v8-13.9.205\d8.exeFor browser execution,
XHARNESS_CLI_PATHselected the restoredmicrosoft.dotnet.xharness.cli\11.0.0-prerelease.26556.1\tools\net10.0\any\Microsoft.DotNet.XHarness.CLI.dllunder the NuGet global-packages cache. The existing repository target provisioned V813.9.205. The three RuntimeInformation skips requireRemoteExecutor.IsSupported; no tests were disabled or changed to skip.Supplemental controls used ignored scratch MSBuild compile-item overrides, not changes to the committed projects. Final product and normal test projects were rebuilt without those overrides.
Expected failure with the original parser: 18 of 24 cases failed, with 0 skips or runner errors. The source snapshot matched original blob
dc89ddb285e78a4566120cec0b3aa5132c9d1bfe. All cases pass with the fix.Passed: all 13 existing cgroup mountinfo/path cases, source-linked into the RuntimeInformation test harness on Windows; 0 failures/skips/runner errors. The normal RuntimeInformation project was then rebuilt and its 15 tests passed without the supplemental inclusion.
The bounded browser baseline comparison used these commands with exact original parser and test-source snapshots:
Both commands returned 0. Original Common tests: 1,098 passed, 0 failures/skips/runner XML errors, with the same shutdown assertion. The original procfs test snapshot matched blob
707a9f7954491aa4ad8a36858d11ab6da9f05d57. The fixed browser product was restored and both final browser suites were rerun afterward.Risk
Low. This is the already-merged managed fix, with no decoding changes for the backport, no new public APIs, and no native-code changes. Only the two path fields are decoded, and only when they contain a backslash. Ordinary paths retain their input-backed spans. Filesystem-type and super-options fields are unchanged; unknown/truncated sequences and literal escaped backslashes are covered by regression tests.
The sole manual project-file resolution retains the .NET 10-specific compile item rather than replacing it. Builds and tests cover the parser, its cgroup callers, both affected project files, Linux-managed compilation, and browser compilation/execution. The pre-existing WASM shutdown limitation is called out above rather than changed in this backport.
IMPORTANT: If this backport is for a servicing release, please verify that:
release/X.0-staging, notrelease/X.0.release/X.0(no-stagingsuffix).Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.