Repository navigation
Closed
Labels
Resolution-DuplicateThe issue is a duplicate.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
Steps to reproduce
pre-setup:
- registry keys:
HKEY_CURRENT_USER\test\noslashesHKEY_CURRENT_USER\test\some/test/key/HKEY_CURRENT_USER\test\another//caveat/
- or as a file.reg:
-
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\test] [HKEY_CURRENT_USER\test\another//caveat/] [HKEY_CURRENT_USER\test\noslashes] [HKEY_CURRENT_USER\test\some/test/key/]
-
## should work (and works)
get-item HKCU:\test\noslashes
## should error (and it 'works' by triming slashes)
get-item HKCU:\test\noslashes//////
## should error (and it errors)
get-item HKCU:\test\some/test/key
## should work (and it shows broken behavior)
get-item HKCU:\test\some/test/key/
## should error (and it 'works' by triming slashes)
get-item HKCU:\test\some/test/key////
## should work (and it errors)
get-item HKCU:\test\another//caveat/
Expected behavior
PS HKCU:\> ## should work (and works)
PS HKCU:\> get-item HKCU:\test\noslashes
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
noslashes
PS HKCU:\> ## should error (and it 'works' by triming slashes)
PS HKCU:\> get-item HKCU:\test\noslashes//////
Get-Item: Cannot find path 'HKCU:\test\noslashes//////' because it does not exist.
PS HKCU:\> ## should error (and it errors)
PS HKCU:\> get-item HKCU:\test\some/test/key
Get-Item: Cannot find path 'HKCU:\test\some\test\key' because it does not exist.
PS HKCU:\> ## should work (and it shows broken behavior)
PS HKCU:\> get-item HKCU:\test\some/test/key/
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
some/test/key/
PS HKCU:\> ## should error (and it 'works' by triming slashes)
PS HKCU:\> get-item HKCU:\test\some/test/key////
Get-Item: Cannot find path 'HKCU:\test\some/test/key////' because it does not exist.
PS HKCU:\> ## should work (and it errors)
PS HKCU:\> get-item HKCU:\test\another//caveat/
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
another//caveat/
Actual behavior (ps 7.1.3)
PS HKCU:\> ## should work (and works)
PS HKCU:\> get-item HKCU:\test\noslashes
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
noslashes
PS HKCU:\> ## should error (and it 'works' by triming slashes)
PS HKCU:\> get-item HKCU:\test\noslashes//////
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
noslashes
PS HKCU:\> ## should error (and it errors)
PS HKCU:\> get-item HKCU:\test\some/test/key
Get-Item: Cannot find path 'HKCU:\test\some\test\key' because it does not exist.
PS HKCU:\> ## should work (and it shows broken behavior)
PS HKCU:\> get-item HKCU:\test\some/test/key/
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
key
PS HKCU:\> ## should error (and it 'works' by triming slashes)
PS HKCU:\> get-item HKCU:\test\some/test/key////
Hive: HKEY_CURRENT_USER\test
Name Property
---- --------
key
PS HKCU:\> ## should work (and it errors)
PS HKCU:\> get-item HKCU:\test\another//caveat/
Get-Item: Cannot find path 'HKCU:\test\another\caveat\' because it does not exist.
Environment data (ps 7.1.3)
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
potentially related
Metadata
Metadata
Assignees
Labels
Resolution-DuplicateThe issue is a duplicate.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Activity
vanillaSprinkles commentedon May 10, 2021
somebody correct me if I'm wrong, but I believe the problem is here:
aka (in case master's line refs get clobbered):
line:
result = path.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator);should be removed. Registry key names include/- and I am guessing now thatStringLiterals.AlternatePathSeparatoris converting that character to\rjmholt commentedon May 25, 2021
As you've linked in the description, this is basically an extension (and thus possibly a duplicate for task-tracking purposes) of #5536.
PowerShell provider path handling is done at a higher layer than the provider itself currently, meaning that there are registry paths that can't currently be represented in PowerShell.
To solve this, we'd need to allow providers to handle their own path format in some way. We'd also need to evaluate the breaking change there, since users might be using
/today with registry paths and would expect that to continue working as it does today.daxian-dbw commentedon May 28, 2021
Resolve this issue as a duplicate of #5536