{{ message }}
Repository navigation
Fix short 8.3 paths in file system normalization - #28172
Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Open
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Slai.life (huong8373tt-beep) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test can mask failures as skips and does not cover the preserved parent-resolution behavior.
3 open findings
What changed in this PR
Fixes Windows filesystem normalization when an 8.3 alias expands to a shorter long name while retaining parent-directory normalization protection.
Changes:
- Compares normalized paths against their parent before rejecting shortened paths.
- Adds Windows regression coverage for removal through an 8.3 alias.
| File | Description |
|---|---|
FileSystem.Tests.ps1 |
Adds short-path removal coverage. |
FileSystemProvider.cs |
Refines path over-normalization detection. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+5709
to
+5713
| var parentInfo = GetFileSystemInfo(GetParentPath(currentPath, null), out bool _); | ||
| if (string.Equals( | ||
| fsinfo.FullName.TrimEnd(StringLiterals.DefaultPathSeparator), | ||
| parentInfo?.FullName.TrimEnd(StringLiterals.DefaultPathSeparator), | ||
| StringComparison.OrdinalIgnoreCase)) |
| try { | ||
| $null = New-Item -ItemType Directory -Path $longDirectory -Force | ||
| & fsutil file setshortname $longDirectory 'A~1' 2>$null | Out-Null | ||
| if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $shortDirectory)) { |
|
|
||
| try { | ||
| $null = New-Item -ItemType Directory -Path $longDirectory -Force | ||
| & fsutil file setshortname $longDirectory 'A~1' 2>$null | Out-Null |
Signed-off-by: wangluoye <294879785+huong8373tt-beep@users.noreply.github.com>
Author
|
Addressed the three Copilot findings in 99f124b:
Validated with the Windows Debug build and both the short-alias and parent-resolution regression cases. The review comments target the prior commit. |
Contributor
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.



Summary
Remove-Itemthrough anA~1alias whose long name isaFixes #21070.
Testing
Start-PSBuild -Runtime win7-x64 -Configuration Debug -NoPSModuleRestore -SkipExperimentalFeatureGenerationFileSystem.Tests.ps1Pester test: 1 passed, 0 failedpwshremoves the same short-path target successfullyAI-assisted disclosure
This contribution was prepared after reproducing issue #21070 in a Windows environment. The developer authorized this contribution after the issue was reproduced and the fix was validated. Slai Agent Runtime assisted with reproduction, implementation, and test execution; the account owner is responsible for this submission.