Title: Experimental feature PSNativeCommandArgumentPassing breaks calls with parameter-like arguments that end in ":" (colon) · Issue #15276 · PowerShell/PowerShell · GitHub
Open Graph Title: Experimental feature PSNativeCommandArgumentPassing breaks calls with parameter-like arguments that end in ":" (colon) · Issue #15276 · PowerShell/PowerShell
X Title: Experimental feature PSNativeCommandArgumentPassing breaks calls with parameter-like arguments that end in ":" (colon) · Issue #15276 · PowerShell/PowerShell
Description: Related: #15239, #15250, #15261 - see overview in #15143. A parameter-like argument (prefixed with -) that ends in : (colon) is unexpectedly merged with the following argument. For instance, this can break awk calls on Unix that use -F: ...
Open Graph Description: Related: #15239, #15250, #15261 - see overview in #15143. A parameter-like argument (prefixed with -) that ends in : (colon) is unexpectedly merged with the following argument. For instance, this c...
X Description: Related: #15239, #15250, #15261 - see overview in #15143. A parameter-like argument (prefixed with -) that ends in : (colon) is unexpectedly merged with the following argument. For instance, this c...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/15276
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Experimental feature PSNativeCommandArgumentPassing breaks calls with parameter-like arguments that end in \":\" (colon)","articleBody":"Related: #15239, #15250, #15261 - see overview in #15143.\r\n\r\nA parameter-like argument (prefixed with `-`) that ends in `:` (colon) is unexpectedly merged with the following argument.\r\n\r\nFor instance, this can break `awk` calls on Unix that use `-F:` to specify `:` as the field separator - see steps below.\r\n\r\nOn Windows, the problem can be demonstrated thus:\r\n\r\n```powershell\r\nPS> cmd /c echo -F: bar # Simplest repro on Unix: /bin/echo -F: bar\r\n-F:bar # !! Missing space between '-F:' and 'bar'\r\n```\r\n\r\nNote: In _PowerShell_ parameter binding, `-Foo: bar` and `-Foo:bar` are equivalent, but this isn't appropriate when calling _external programs_.\r\n\r\n## Steps to reproduce\r\n\r\nRun on **Linux or macOS** (but the problem also affects Windows), with `PSNativeCommandArgumentPassing` in effect (and preference variable `$PSNativeCommandArgumentPassing` set to `'Standard'`):\r\n\r\n```powershell\r\n# Run an awk command that extracts the usernames from /etc/passwd\r\n$sb = { cat /etc/passwd | awk -F: '{print $1 }' | Should -Not -BeNullOrEmpty }\r\n\r\n# In legacy mode, the command succeeds\r\n& { $PSNativeCommandArgumentPassing = 'Legacy'; & $sb }\r\n\r\n# In standard mode (the new mode enable with the experimental feature), the command breaks:\r\n& $sb\r\n```\r\n\r\n## Expected behavior\r\n\r\nBoth tests should pass.\r\n\r\n## Actual behavior\r\n\r\nThe second test fails, because distinct arguments `-F:` and `'{print $1}'` were unexpectedly merged into a _single_ argument with verbatim content `-F:{print $1}`:\r\n\r\n```none\r\n# ... awk error message / usage info, due to the command having become syntactically invalid.\r\nInvalidResult: Expected a value, but got $null or empty.\r\n```\r\n\r\n\r\n## Environment data\r\n\r\n```none\r\nPowerShell Core 7.2.0-preview.5\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2021-04-19T21:32:16Z","url":"https://github.com/PowerShell/PowerShell/issues/15276"}
| 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:864b15b6-d25b-2bc6-a8bd-b751c8ccce8b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0DA:35E8DA:165062:1EB035:6AFD8F7B |
| html-safe-nonce | 6923d718619f805e190a3d02d667ee980817da93b45ee75747926117cf418e67 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMERBOjM1RThEQToxNjUwNjI6MUVCMDM1OjZBRkQ4RjdCIiwidmlzaXRvcl9pZCI6Ijc5NDQ5NzEzNzY1NjgxNDM3MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2b8093546f43ba65c0d90aa96741be4fbbc977ec5f4d6ff75dc82e1060eccdbf |
| hovercard-subject-tag | issue:861948208 |
| 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/15276/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c35d877f5b14eb0756b9b3f51a7eb1762a8d6f0d7e825ecf31a68152968b9695/PowerShell/PowerShell/issues/15276 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c35d877f5b14eb0756b9b3f51a7eb1762a8d6f0d7e825ecf31a68152968b9695/PowerShell/PowerShell/issues/15276 |
| og:image:alt | Related: #15239, #15250, #15261 - see overview in #15143. A parameter-like argument (prefixed with -) that ends in : (colon) is unexpectedly merged with the following argument. For instance, this c... |
| 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