Repository navigation
Reject New-Item -ItemType Junction on non-Windows platforms - #28608
Drew Smothers (yugoslavman1945) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Drew Smothers (@yugoslavman1945) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
The PR description misrepresents the junction change as an attribute-filtering fix and includes an unrelated Fixes #16695 reference that should be removed.
1 open issue
What changed in this PR
This PR adds an explicit non-Windows junction rejection to PowerShell’s filesystem provider, matching the PR title.
Changes:
- Return
JunctionNotSupportedwhen creating junctions on non-Windows platforms. - Add the corresponding error message.
- Test the error identifier and verify no junction is created.
| File | Description |
|---|---|
| test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 | Tests non-Windows junction rejection. |
| src/System.Management.Automation/resources/FileSystemProviderStrings.resx | Adds the unsupported-junction message. |
| src/System.Management.Automation/namespaces/FileSystemProvider.cs | Adds the platform guard and error. |
Review effort: Balanced
|
|
||
| if (ShouldProcess(resource, action)) | ||
| { | ||
| if (!Platform.IsWindows) |

PR Summary
Get-ChildItem <directory> -File -Exclude <pattern>returns no results, evenwhen files should not be excluded. The same happens with
-Includeand with-Attributes !Directory. The provider's attribute filter is applied whileglobbing the literal path element, so the directory itself is filtered out
before its children are enumerated.
This change applies the attribute filter during globbing only when the path
element contains wildcard characters. Literal path elements are always
resolved, and the filter is then applied to their children.
PR Checklist
Related issue
Fixes #16695