-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Passing a provider-name-prefixed path to Set-Location makes $PWD retain the prefix #10522
Copy link
Copy link
Closed
Closed
Copy link
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Type
Fields
Give feedbackNo fields configured for issues without a type.
Perhaps related: #9293
Steps to reproduce
Run the following on Windows (works analogously on Unix):
Note: A real-life scenario in which this could occur is if you pipe the output from a
New-Item -Type Directorycall toSet-Location, e.g.:Expected behavior
The test should pass.
Actual behavior
The test fails:
That is,
$PWDstringified (via.Path) to'Microsoft.PowerShell.Core\FileSystem::C:\Windows', not the expectedC:\Windows, as also reflected in the prompt string afterwards (via$executionContext.SessionState.Path.CurrentLocation).While
$PWD.ProviderPathdoes reflect the unprefixed (but always native) fileysystem path, relying on"$PWD"or$PWD.Pathto do that too is very common.Environment data