-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Get-Item with a drive's root dir stringifies incorrectly #10956
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Milestone
Description
This is a regression from Windows PowerShell.
When accessing a drive's root directory, an extra path separator is appended on stringification.
Steps to reproduce
$root = ('/', 'C:\')[$env:OS -eq 'Windows_NT']
Push-Location ('/', 'C:\')[$env:OS -eq 'Windows_NT']
(Get-Item /).ToString() | Should -Be $root
(Get-Item .).ToString() | Should -Be $root
Pop-Location Expected behavior
The tests should pass.
Actual behavior
The tests fails; e.g., on Windows:
Expected: 'C:\'
But was: 'C:\\'
Environment data
PowerShell Core 7.0.0-preview.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.