-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
This is similar to #3414, but involves only the backslash portion.
The basis of the problem is premature normalization of paths. Path normalization happens quite early (and very frequently and in a great number of places in the PowerShell code) while processing a command. Usually this happens before the path reaches its provider, and often that normalization is a brute-force change one slash to another mechanism. Thus a path such as 1\2 on Unix is "normalized" to 1/2, ensuring that the path will never be found.
Using -LiteralPath does not prevent the path normalization, so that is not a workaround.
Steps to reproduce
From bash:
$ touch 'a\b'then from PowerShell:
PS> Remove-Item a\bor
PS> Move-Item a\b a-bExpected behavior
The file a\b is deleted
Actual behavior
Remove-Item : Cannot find path 'a/b' because it does not exist.
At line:1 char:1
+ Remove-Item a\b
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (a/b:String)
[Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
Environment data
> $PSVersionTable
Name Value
---- -----
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-alpha.18-38-g08e855556cff42274a5903799b826e78d0c...
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSEdition Core
PSRemotingProtocolVersion 2.3
PSVersion 6.0.0-alpha
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 mklement0
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.