Title: Passing a provider-name-prefixed path to Set-Location makes $PWD retain the prefix · Issue #10522 · PowerShell/PowerShell · GitHub
Open Graph Title: Passing a provider-name-prefixed path to Set-Location makes $PWD retain the prefix · Issue #10522 · PowerShell/PowerShell
X Title: Passing a provider-name-prefixed path to Set-Location makes $PWD retain the prefix · Issue #10522 · PowerShell/PowerShell
Description: Perhaps related: #9293 Steps to reproduce Run the following on Windows (works analogously on Unix): Set-Location Microsoft.PowerShell.Core\FileSystem::C:\Windows "$PWD" | Should -Be C:\Windows Note: A real-life scenario in which this cou...
Open Graph Description: Perhaps related: #9293 Steps to reproduce Run the following on Windows (works analogously on Unix): Set-Location Microsoft.PowerShell.Core\FileSystem::C:\Windows "$PWD" | Should -Be C:\Windows Note...
X Description: Perhaps related: #9293 Steps to reproduce Run the following on Windows (works analogously on Unix): Set-Location Microsoft.PowerShell.Core\FileSystem::C:\Windows "$PWD" | Should -Be C:\Wi...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10522
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Passing a provider-name-prefixed path to Set-Location makes $PWD retain the prefix","articleBody":"Perhaps related: #9293\r\n\r\n# Steps to reproduce\r\n\r\nRun the following on Windows (works analogously on Unix):\r\n\r\n```powershell\r\nSet-Location Microsoft.PowerShell.Core\\FileSystem::C:\\Windows\r\n\"$PWD\" | Should -Be C:\\Windows\r\n```\r\n\r\nNote: A real-life scenario in which this could occur is if you pipe the output from a `New-Item -Type Directory` call to `Set-Location`, e.g.:\r\n\r\n```powershell\r\nNew-Item -Type Directory $HOME -Force | Set-Location\r\n```\r\n\r\n# Expected behavior\r\n\r\nThe test should pass.\r\n\r\n# Actual behavior\r\n\r\nThe test fails:\r\n\r\n```none\r\nExpected strings to be the same, but they were different.\r\nExpected length: 10\r\nActual length: 48\r\nStrings differ at index 0.\r\nExpected: 'C:\\Windows'\r\nBut was: 'Microsoft....'\r\n```\r\n\r\nThat is, `$PWD` stringified (via `.Path`) to `'Microsoft.PowerShell.Core\\FileSystem::C:\\Windows'`, not the expected `C:\\Windows`, as also reflected in the prompt string afterwards (via `$executionContext.SessionState.Path.CurrentLocation`).\r\n\r\nWhile `$PWD.ProviderPath` does reflect the _unprefixed_ (but always native) fileysystem path, relying on `\"$PWD\"` or `$PWD.Path` to do that too is very common.\r\n\r\n# Environment data\r\n\r\n```none\r\nPowerShell Core 7.0.0-preview.3\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-09-12T17:25:45Z","url":"https://github.com/PowerShell/PowerShell/issues/10522"}
| 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:13984ac0-1d0f-6f1f-5a39-7fc6caedf8f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9226:D2092:9D02BB:E07385:6AFDA0B3 |
| html-safe-nonce | e09af11df0d5e9b88033278207b42aa416c0f2b843e1efdc315542087683878c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjI2OkQyMDkyOjlEMDJCQjpFMDczODU6NkFGREEwQjMiLCJ2aXNpdG9yX2lkIjoiNTM4NDc2NjU0ODUyMDgzNzI5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a0837a878d6f827cebb1a97171cc19e0eab0d376fa120bbb939b7d88ea098fa9 |
| hovercard-subject-tag | issue:492934305 |
| 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/10522/issue_layout |
| twitter:image | https://opengraph.githubassets.com/133ce3088fe3f5c074743c923999b678cc05b247018ff6638e4c6a7193b5dc1e/PowerShell/PowerShell/issues/10522 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/133ce3088fe3f5c074743c923999b678cc05b247018ff6638e4c6a7193b5dc1e/PowerShell/PowerShell/issues/10522 |
| og:image:alt | Perhaps related: #9293 Steps to reproduce Run the following on Windows (works analogously on Unix): Set-Location Microsoft.PowerShell.Core\FileSystem::C:\Windows "$PWD" | Should -Be C:\Windows Note... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width