Title: Unix: Native globbing cannot be bypassed when using splatting · Issue #24178 · PowerShell/PowerShell · GitHub
Open Graph Title: Unix: Native globbing cannot be bypassed when using splatting · Issue #24178 · PowerShell/PowerShell
X Title: Unix: Native globbing cannot be bypassed when using splatting · Issue #24178 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/24178
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unix: Native globbing cannot be bypassed when using splatting","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nNote: This has been reported before, but not as a dedicated issue:\r\n\r\n* By @jborean93 in https://github.com/PowerShell/PowerShell/issues/24170#issuecomment-2294602625\r\n* Prior to that, by @andrewhickman in https://github.com/PowerShell/PowerShell/issues/17176#issuecomment-1185753356\r\n\r\nOn Unix, barewords passed as arguments to external (native) programs are subject to globbing (filename expansion), if they contain `*` or `?`, for compatibility with native Unix shells.\r\n\r\n* In _direct_ invocation, the way to avoid this is to _quote_ the bareword, e.g. `'*'`\r\n\r\n* However - and this constitutes the bug - when _splatting_, the globbing _cannot be prevented_:\r\n\r\n```powershell\r\n# On Unix-like platforms.\r\n/bin/echo @( '*' )\r\n```\r\n\r\nNote that using _embedded_ quoting (e.g., `@('\"*\"')`) is _not_ an option, because it becomes part of the argument.\r\n\r\n### Expected behavior\r\n\r\n`*` should print verbatim.\r\n\r\nNote:\r\n\r\n* The above assumes that `'*'` should _not_ be treated like a bareword in the context of splatting, which in turn implies that you fundamentally cannot specify barewords that way, and would have to use something like `@((Get-Item * -Name))` to manually perform the desired globbing.\r\n\r\n* This strikes me as an acceptable trade-off and much preferable to the alternative: defaulting to interpretation as barewords, with a yet-to-be-devised opt-out method.\r\n\r\n\r\n### Actual behavior\r\n\r\nThe names of the files and subdirectories in the current directory print, because native globbing was applied.\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPowerShell 7.5.0-preview.3 on Unix-like platforms.\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2024-08-20T18:31:25Z","url":"https://github.com/PowerShell/PowerShell/issues/24178"}
| 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:938e0741-bd3c-8852-9283-ec944bb437e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E8B2:32B4C5:149A15:1C2B92:6AFD4D6D |
| html-safe-nonce | 9d49bc088916e59149af4361046614ab484f120386cc72171823594c35c868ce |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEIyOjMyQjRDNToxNDlBMTU6MUMyQjkyOjZBRkQ0RDZEIiwidmlzaXRvcl9pZCI6IjM3MDk3MzE1MzIxNjg4NDI2MDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 37e29143a75d4716e025929459acf32f3d5e32797ea0a8155cf9dcc3b656738d |
| hovercard-subject-tag | issue:2476277245 |
| 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/24178/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c119476e9c45635b9102f1d17295b583b9116cc04f8ae554aa4b4544df86feb/PowerShell/PowerShell/issues/24178 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c119476e9c45635b9102f1d17295b583b9116cc04f8ae554aa4b4544df86feb/PowerShell/PowerShell/issues/24178 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| 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 | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| 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 | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width