Title: Get-ChildItem -path '/' breaks -exclude or -include parameters · Issue #15497 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ChildItem -path '/' breaks -exclude or -include parameters · Issue #15497 · PowerShell/PowerShell
X Title: Get-ChildItem -path '/' breaks -exclude or -include parameters · Issue #15497 · PowerShell/PowerShell
Description: I believe there is a bug with Get-ChildItem for pwsh v7.1.3 on Ubuntu 20.04 (WSL2) when using the -exclude and -include parameters in conjunction with the -Path '/' parameter/argument combo. This seems primarily be limited to Get-ChildIt...
Open Graph Description: I believe there is a bug with Get-ChildItem for pwsh v7.1.3 on Ubuntu 20.04 (WSL2) when using the -exclude and -include parameters in conjunction with the -Path '/' parameter/argument combo. This s...
X Description: I believe there is a bug with Get-ChildItem for pwsh v7.1.3 on Ubuntu 20.04 (WSL2) when using the -exclude and -include parameters in conjunction with the -Path '/' parameter/argument combo...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/15497
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ChildItem -path '/' breaks -exclude or -include parameters","articleBody":"I believe there is a bug with `Get-ChildItem` for pwsh v7.1.3 on Ubuntu 20.04 (WSL2) when using the `-exclude` and `-include` parameters in conjunction with the ` -Path '/'` parameter/argument combo.\r\n\r\nThis seems primarily be limited to `Get-ChildItem -Path '/'` as both `-LiteralPath '/'` and `-PSPath (Get-Item -Path '/').PSPath` return the data as expected when used with either `-exclude` or `-include`.\r\n\r\nAdditionally using `-exclude` and `-path` together works for directories outside `/`. However, I believe there may be another bug when using `-Path` and `-Include` other places as well.\r\n\r\n## Steps to reproduce\r\n### Get-ChildItem -Path '/' -Exclude 'mnt'\r\n```powershell\r\n# Bad:\r\nGet-ChildItem -Path '/' -Exclude 'mnt'\r\n\r\n# Aligns with expected behavior:\r\nGet-ChildItem -Path '/mnt' -Exclude 'c'\r\nGet-ChildItem -LiteralPath '/' -Exclude 'mnt'\r\nGet-ChildItem -PSPath (Get-Item -Path '/').PSPath -Exclude 'mnt'\r\n```\r\n\r\n\r\n### Get-ChildItem -Path '/' -Include 'mnt'\r\n```powershell\r\n# Bad:\r\nGet-ChildItem -Path '/' -Include 'mnt' # Produces error\r\nGet-ChildItem -Path '/mnt' -Include 'c' # Produces no output when output is expected.\r\n\r\n# Aligns with expected behavior:\r\nGet-ChildItem -LiteralPath '/' -Include 'mnt'\r\nGet-ChildItem -LiteralPath '/mnt' -Include 'c'\r\nGet-ChildItem -PSPath (Get-Item -Path '/').PSPath -Include 'mnt'\r\nGet-ChildItem -PSPath (Get-Item -Path '/mnt').PSPath -Include 'c'\r\n```\r\n\r\n\r\nI'm unsure if the behavior of `-Include` deserves its own bug report but would be happy to split it up if needed.\r\n\r\n## Environment data\r\n\r\n\r\n```plaintext\r\nStackTrace:\r\n at Microsoft.PowerShell.Commands.FileSystemProvider.GetChildName(String path) in /PowerShell/src/System.Management.Automation/namespaces/FileSystemProvider.cs:line 5683\r\n at System.Management.Automation.Provider.NavigationCmdletProvider.GetChildName(String path, CmdletProviderContext context) in /PowerShell/src/System.Management.Automation/namespaces/NavigationProviderBase.cs:line 174\r\n at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context) in /PowerShell/src/System.Management.Automation/namespaces/LocationGlobber.cs:line 2763\r\n at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance) in /PowerShell/src/System.Management.Automation/namespaces/LocationGlobber.cs:line 516\r\n at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance) in /PowerShell/src/System.Management.Automation/namespaces/LocationGlobber.cs:line 218\r\n at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance) in /PowerShell/src/System.Management.Automation/namespaces/LocationGlobber.cs:line 779\r\n at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context) in /PowerShell/src/System.Management.Automation/engine/SessionStateContainer.cs:line 1393\r\n at System.Management.Automation.ChildItemCmdletProviderIntrinsics.Get(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context) in /PowerShell/src/System.Management.Automation/engine/ChildrenCmdletProviderInterfaces.cs:line 278\r\n at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord() in /PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/GetChildrenCommand.cs:line 318\r\n at System.Management.Automation.Cmdlet.DoProcessRecord() in /PowerShell/src/System.Management.Automation/engine/cmdlet.cs:line 173\r\n at System.Management.Automation.CommandProcessor.ProcessRecord() in /PowerShell/src/System.Management.Automation/engine/CommandProcessor.cs:line 388\r\n```\r\n","author":{"url":"https://github.com/tsmarvin","@type":"Person","name":"tsmarvin"},"datePublished":"2021-06-01T06:18:45Z","url":"https://github.com/PowerShell/PowerShell/issues/15497"}
| 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:82ab4bd8-ff01-f081-afe7-0f7fc30ba6e1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0F0:28C95D:2A6F264:3B53C22:6AFD5D16 |
| html-safe-nonce | cff461320cc2acdf09c9f323ea3b555f0da75a779f36a933432e008bbdb49a7e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEYwOjI4Qzk1RDoyQTZGMjY0OjNCNTNDMjI6NkFGRDVEMTYiLCJ2aXNpdG9yX2lkIjoiMjMwODgxMTk0NTgwNjc0ODk1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5da03fb530b13e08ceff43f8695cc21130a3917b2327b3dbdba98e5826ed7d8c |
| hovercard-subject-tag | issue:907935169 |
| 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/15497/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8def9a96f76fce9f1f6c4afd1a4cd5e5ff0163841625bbe0d5a7b308c51e4f45/PowerShell/PowerShell/issues/15497 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8def9a96f76fce9f1f6c4afd1a4cd5e5ff0163841625bbe0d5a7b308c51e4f45/PowerShell/PowerShell/issues/15497 |
| og:image:alt | I believe there is a bug with Get-ChildItem for pwsh v7.1.3 on Ubuntu 20.04 (WSL2) when using the -exclude and -include parameters in conjunction with the -Path '/' parameter/argument combo. This s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tsmarvin |
| 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