Title: bug: get-item registry slash-magic trim'ing incorrectly · Issue #15342 · PowerShell/PowerShell · GitHub
Open Graph Title: bug: get-item registry slash-magic trim'ing incorrectly · Issue #15342 · PowerShell/PowerShell
X Title: bug: get-item registry slash-magic trim'ing incorrectly · Issue #15342 · PowerShell/PowerShell
Description: Steps to reproduce pre-setup: registry keys: HKEY_CURRENT_USER\test\noslashes HKEY_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] [...
Open Graph Description: Steps to reproduce pre-setup: registry keys: HKEY_CURRENT_USER\test\noslashes HKEY_CURRENT_USER\test\some/test/key/ HKEY_CURRENT_USER\test\another//caveat/ or as a file.reg: Windows Registry Editor...
X Description: Steps to reproduce pre-setup: registry keys: HKEY_CURRENT_USER\test\noslashes HKEY_CURRENT_USER\test\some/test/key/ HKEY_CURRENT_USER\test\another//caveat/ or as a file.reg: Windows Registry Editor...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/15342
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: get-item registry slash-magic trim'ing incorrectly","articleBody":"\u003c!--\r\n\r\nFor Windows PowerShell 5.1 issues, suggestions, or feature requests please use the following link instead:\r\nWindows PowerShell [UserVoice](https://windowsserver.uservoice.com/forums/301869-powershell)\r\n\r\nThis repository is **ONLY** for PowerShell Core 6 and PowerShell 7+ issues.\r\n\r\n- Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- Search the existing issues.\r\n- Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- Refer to the [known issues](https://docs.microsoft.com/powershell/scripting/whats-new/known-issues-ps6).\r\n\r\n-->\r\n\r\n## Steps to reproduce\r\n\r\npre-setup:\r\n- registry keys: \r\n - `HKEY_CURRENT_USER\\test\\noslashes`\r\n - `HKEY_CURRENT_USER\\test\\some/test/key/`\r\n - `HKEY_CURRENT_USER\\test\\another//caveat/`\r\n- or as a file.reg:\r\n - ```\r\n Windows Registry Editor Version 5.00\r\n [HKEY_CURRENT_USER\\test]\r\n [HKEY_CURRENT_USER\\test\\another//caveat/]\r\n [HKEY_CURRENT_USER\\test\\noslashes]\r\n [HKEY_CURRENT_USER\\test\\some/test/key/]\r\n ```\r\n\r\n```powershell\r\n## should work (and works)\r\nget-item HKCU:\\test\\noslashes\r\n\r\n\r\n## should error (and it 'works' by triming slashes)\r\nget-item HKCU:\\test\\noslashes//////\r\n\r\n\r\n## should error (and it errors)\r\nget-item HKCU:\\test\\some/test/key\r\n\r\n\r\n## should work (and it shows broken behavior)\r\nget-item HKCU:\\test\\some/test/key/\r\n\r\n\r\n## should error (and it 'works' by triming slashes)\r\nget-item HKCU:\\test\\some/test/key////\r\n\r\n\r\n## should work (and it errors)\r\nget-item HKCU:\\test\\another//caveat/\r\n\r\n```\r\n\r\n\r\n\r\n## Expected behavior\r\n\r\n```none\r\nPS HKCU:\\> ## should work (and works)\r\nPS HKCU:\\> get-item HKCU:\\test\\noslashes\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nnoslashes\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it 'works' by triming slashes)\r\nPS HKCU:\\> get-item HKCU:\\test\\noslashes//////\r\nGet-Item: Cannot find path 'HKCU:\\test\\noslashes//////' because it does not exist.\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it errors)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key\r\nGet-Item: Cannot find path 'HKCU:\\test\\some\\test\\key' because it does not exist.\r\n\r\n\r\n\r\nPS HKCU:\\> ## should work (and it shows broken behavior)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key/\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nsome/test/key/\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it 'works' by triming slashes)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key////\r\nGet-Item: Cannot find path 'HKCU:\\test\\some/test/key////' because it does not exist.\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should work (and it errors)\r\nPS HKCU:\\> get-item HKCU:\\test\\another//caveat/\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nanother//caveat/\r\n```\r\n\r\n\r\n\r\n\r\n## Actual behavior (ps 7.1.3)\r\n\r\n```none\r\nPS HKCU:\\> ## should work (and works)\r\nPS HKCU:\\> get-item HKCU:\\test\\noslashes\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nnoslashes\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it 'works' by triming slashes)\r\nPS HKCU:\\> get-item HKCU:\\test\\noslashes//////\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nnoslashes\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it errors)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key\r\nGet-Item: Cannot find path 'HKCU:\\test\\some\\test\\key' because it does not exist.\r\n\r\n\r\n\r\nPS HKCU:\\> ## should work (and it shows broken behavior)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key/\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nkey\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should error (and it 'works' by triming slashes)\r\nPS HKCU:\\> get-item HKCU:\\test\\some/test/key////\r\n\r\n Hive: HKEY_CURRENT_USER\\test\r\n\r\nName Property\r\n---- --------\r\nkey\r\n\r\n\r\n\r\n\r\nPS HKCU:\\> ## should work (and it errors)\r\nPS HKCU:\\> get-item HKCU:\\test\\another//caveat/\r\nGet-Item: Cannot find path 'HKCU:\\test\\another\\caveat\\' because it does not exist.\r\n```\r\n\r\n## Environment data (ps 7.1.3)\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 7.1.3\r\nPSEdition Core\r\nGitCommitId 7.1.3\r\nOS Microsoft Windows 6.3.9600\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0.}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\n\r\n\r\n## potentially related\r\n- https://github.com/PowerShell/PowerShell/issues/5536\r\n- https://github.com/PowerShell/PowerShell/pull/8587\r\n \r\n","author":{"url":"https://github.com/vanillaSprinkles","@type":"Person","name":"vanillaSprinkles"},"datePublished":"2021-05-03T21:19:02Z","url":"https://github.com/PowerShell/PowerShell/issues/15342"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:eafbcbf4-f0ac-c277-d8d5-cea9be10024c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD0C:3FAC3:C9454:124137:6AFD723B |
| html-safe-nonce | 076607a29a2487f975f5d5fd2afd38c0ab137cb8e2617df5607021520974b1a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDBDOjNGQUMzOkM5NDU0OjEyNDEzNzo2QUZENzIzQiIsInZpc2l0b3JfaWQiOiI4MzY2NjA0NjUyNDA5MzUyNzYzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4872f1c497b17f0a2caef4ad092e078db9b6a9d5b85bb9b0e36854b852a1886f |
| hovercard-subject-tag | issue:874918810 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/15342/issue_layout |
| twitter:image | https://opengraph.githubassets.com/45d7bc360049f48377ad2bdf59386f8246626d583be88395b48fab24347d6b22/PowerShell/PowerShell/issues/15342 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/45d7bc360049f48377ad2bdf59386f8246626d583be88395b48fab24347d6b22/PowerShell/PowerShell/issues/15342 |
| og:image:alt | Steps to reproduce pre-setup: registry keys: HKEY_CURRENT_USER\test\noslashes HKEY_CURRENT_USER\test\some/test/key/ HKEY_CURRENT_USER\test\another//caveat/ or as a file.reg: Windows Registry Editor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vanillaSprinkles |
| hostname | github.com |
| expected-hostname | github.com |
| None | e54006cf2b96d1ac260960edd10003132911469ccd1ec99c9803119fe2a4e032 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5be0bf2b8cf26f8897d31e6bc3c232d328b12a54 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width