Title: The FileSystem provider does not reliably report invalid wildcard patterns · Issue #6733 · PowerShell/PowerShell · GitHub
Open Graph Title: The FileSystem provider does not reliably report invalid wildcard patterns · Issue #6733 · PowerShell/PowerShell
X Title: The FileSystem provider does not reliably report invalid wildcard patterns · Issue #6733 · PowerShell/PowerShell
Description: See also: #12168 Note: This is an obscure edge case. For the most part, malformed wildcard patterns are quietly ignored and fall back to literal treatment (e.g., Get-Item a].txt matches a file literally named a].txt) - that inconsistency...
Open Graph Description: See also: #12168 Note: This is an obscure edge case. For the most part, malformed wildcard patterns are quietly ignored and fall back to literal treatment (e.g., Get-Item a].txt matches a file lite...
X Description: See also: #12168 Note: This is an obscure edge case. For the most part, malformed wildcard patterns are quietly ignored and fall back to literal treatment (e.g., Get-Item a].txt matches a file lite...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/6733
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The FileSystem provider does not reliably report invalid wildcard patterns","articleBody":"See also: #12168\r\n\r\nNote: This is an obscure edge case. \r\n\r\n~~For the most part, malformed wildcard patterns are _quietly ignored_ and fall back to _literal_ treatment (e.g., `Get-Item a].txt` matches a file literally named `a].txt`) - that inconsistency could be considered problematic in itself, however.~~\r\n\r\n_Update: A pattern such as `a].txt` is actually valid, because the `]` is not special unless preceded by `[`. However, patterns such as `a[].txt` and `a[.txt` and `a[foo.txt` are invalid, and the problem is that they are not consistently reported as such. The rest of this post has been revised accordingly._\r\n\r\nWhen an invalid wildcard pattern - e.g., one that ends in `[]` before the filename extension - is passed to `Get-Item` or `Get-ChildItem`, the error that _should_ occur occurs _only_ if at least two files exists that have the same matching prefix (the exact logic is not clear to me).\r\n\r\n(@BrucePay states that the source of the error is the FileSystem provider itself, not the cmdlets mentioned.)\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n# Assume that no `tmp*.txt` files exist.\r\nGet-Item tmp[].txt\r\n'---'\r\n$null = New-Item -Force tmp.txt; Get-Item tmp[].txt\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nGet-Item : Cannot retrieve the dynamic parameters for the cmdlet. \r\nThe specified wildcard character pattern is not valid: tmp[].txt\r\n---\r\nGet-Item : Cannot retrieve the dynamic parameters for the cmdlet. \r\nThe specified wildcard character pattern is not valid: tmp[].txt\r\n```\r\n\r\nThat is, two instances of the same `The specified wildcard character pattern is not valid` error should occur, irrespective of whether any `tmp*.txt` files exist or not.\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\n---\r\nGet-Item : Cannot retrieve the dynamic parameters for the cmdlet. \r\nThe specified wildcard character pattern is not valid: tmp[].txt\r\n```\r\n\r\nThat is, in the absence of any `tmp*.txt` files, the invalid wildcard expression was not reported as invalid.\r\n\r\nEnvironment data\r\n----------------\r\n\r\nOriginally reported for 6.0.2, updated for:\r\n\r\n```powershell\r\nPowerShell Core v7.0.0\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2018-04-25T20:32:56Z","url":"https://github.com/PowerShell/PowerShell/issues/6733"}
| 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:2825cffb-9d86-231f-2a15-554d7045821a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F52:1BA848:24796B:318610:6AFD5299 |
| html-safe-nonce | 372d3fcc6f08265041522f37f26444580415ee4c5f0184a9875d244791343103 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjUyOjFCQTg0ODoyNDc5NkI6MzE4NjEwOjZBRkQ1Mjk5IiwidmlzaXRvcl9pZCI6IjU2OTg3MDEwNDU1MTM2NzEzMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 99740249358b0918f721d69529b7738281c0fa4a04f66b25648c96c442f8b8e3 |
| hovercard-subject-tag | issue:317783263 |
| 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/6733/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b64e0aaae22d0bb64262397b3b1b91272845cf297785449d4c3e2dad0b22d486/PowerShell/PowerShell/issues/6733 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b64e0aaae22d0bb64262397b3b1b91272845cf297785449d4c3e2dad0b22d486/PowerShell/PowerShell/issues/6733 |
| og:image:alt | See also: #12168 Note: This is an obscure edge case. For the most part, malformed wildcard patterns are quietly ignored and fall back to literal treatment (e.g., Get-Item a].txt matches a file lite... |
| 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