Title: Emulation of ~ (tilde) expansion for native utilities is incomplete · Issue #11386 · PowerShell/PowerShell · GitHub
Open Graph Title: Emulation of ~ (tilde) expansion for native utilities is incomplete · Issue #11386 · PowerShell/PowerShell
X Title: Emulation of ~ (tilde) expansion for native utilities is incomplete · Issue #11386 · PowerShell/PowerShell
Description: Note: ~ expansion for native utilities currently fundamentally only works on Unix platforms - but Windows would benefit from it too: see #10675 Fully emulating the logic of ~ expansion in PowerShell requires recognizing partial quoting o...
Open Graph Description: Note: ~ expansion for native utilities currently fundamentally only works on Unix platforms - but Windows would benefit from it too: see #10675 Fully emulating the logic of ~ expansion in PowerShel...
X Description: Note: ~ expansion for native utilities currently fundamentally only works on Unix platforms - but Windows would benefit from it too: see #10675 Fully emulating the logic of ~ expansion in PowerShel...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11386
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Emulation of ~ (tilde) expansion for native utilities is incomplete","articleBody":"Note: \r\n\r\n* `~` expansion for native utilities currently fundamentally only works on _Unix_ platforms - but Windows would benefit from it too: see #10675\r\n\r\n* Fully emulating the logic of `~` expansion in PowerShell requires recognizing _partial_ quoting of sub-tokens in arguments (e.g., `~/'foo bar'`), which may turn out to be a challenge based on how argument parsing currently works.\r\n\r\n# Steps to reproduce\r\n\r\nOn a Unix-like platform:\r\n\r\n```powershell\r\n# Quoting the argument as a whole always suppresses ~ expansion.\r\n/bin/echo '~/foo' | Should -Be '~/foo'\r\n\r\n# Both commands should expand ~ to the value of $HOME, \r\n# because the ~/ prefix is unquoted.\r\n/bin/echo ~/foo | Should -Not -BeLike '~/*'\r\n/bin/echo ~/'foo bar' | Should -Not -BeLike '~/*'\r\n```\r\n\r\n# Expected behavior\r\n\r\nAll tests should succeed.\r\n\r\n# Actual behavior\r\n\r\nThe 3rd test fails, because the partially quoted argument prevented `~` expansion - even though `~/` is _unquoted_.\r\n\r\n```none\r\nExpected like wildcard '~*' to not match '~/foo bar', but it did match.\r\n```\r\n\r\nNote that in POSIX-like shells - whose behavior here is being emulated - `/bin/echo ~/'foo bar'` indeed expands `~`, as expected.\r\n\r\n# Environment data\r\n\r\n```none\r\nPowerShell Core 7.0.0-rc.1\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-12-17T20:40:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/11386/PowerShell/issues/11386"}
| 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:4a89d7f0-2eed-456e-41ed-7bcc5efabbbd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3A8:397A9E:B20E54:1049FEE:6A575FAC |
| html-safe-nonce | 88e99300f0efbcb0c339929ef173c6af91ab38ad0de4e051cbc8cf6083facaae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0E4OjM5N0E5RTpCMjBFNTQ6MTA0OUZFRTo2QTU3NUZBQyIsInZpc2l0b3JfaWQiOiIzMzI5NjgxNjMxNDYwNDE3NDUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 39baa92e44f170cf7adc934efc129c9b9951ceec55240d9e08694a6372e73f71 |
| hovercard-subject-tag | issue:539298749 |
| 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/11386/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2f64ab88b9938cf3fa4b6e1a433738de2e06c4810f3d46a1c191295e5b7ca0b9/PowerShell/PowerShell/issues/11386 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2f64ab88b9938cf3fa4b6e1a433738de2e06c4810f3d46a1c191295e5b7ca0b9/PowerShell/PowerShell/issues/11386 |
| og:image:alt | Note: ~ expansion for native utilities currently fundamentally only works on Unix platforms - but Windows would benefit from it too: see #10675 Fully emulating the logic of ~ expansion in PowerShel... |
| 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 | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| 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 | 87685a1c739dbf97e95760413799bb0221799457 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width