Title: Get-ChildItem -Name and Get-ChildItem -Include / -Exclude unexpectedly follow symlinks with -Recurse · Issue #9126 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ChildItem -Name and Get-ChildItem -Include / -Exclude unexpectedly follow symlinks with -Recurse · Issue #9126 · PowerShell/PowerShell
X Title: Get-ChildItem -Name and Get-ChildItem -Include / -Exclude unexpectedly follow symlinks with -Recurse · Issue #9126 · PowerShell/PowerShell
Description: PowerShell Core (unlike Windows PowerShell) by default is supposed to not follow symlinks (symbolic links) to directories during recursive traversal with Get-ChildItem -Recurse (you can opt in with -FollowSymlink). While this generally w...
Open Graph Description: PowerShell Core (unlike Windows PowerShell) by default is supposed to not follow symlinks (symbolic links) to directories during recursive traversal with Get-ChildItem -Recurse (you can opt in with...
X Description: PowerShell Core (unlike Windows PowerShell) by default is supposed to not follow symlinks (symbolic links) to directories during recursive traversal with Get-ChildItem -Recurse (you can opt in with...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/9126
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ChildItem -Name and Get-ChildItem -Include / -Exclude unexpectedly follow symlinks with -Recurse","articleBody":"PowerShell Core (unlike Windows PowerShell) by default is supposed to _not_ follow symlinks (symbolic links) to directories during recursive traversal with `Get-ChildItem -Recurse` (you can opt in with `-FollowSymlink`).\r\n\r\nWhile this generally works, using the `-Name` or `-Include` / `-Exclude` switches unexpectedly causes symlinks to be followed even without the `-FollowSymlink` switch.\r\n\r\nNote: On _Windows_, the tests currently fail categorically, due to an unrelated bug: #9127\r\n\r\n# Steps to reproduce (on Unix)\r\n\r\nRun the following Pester tests:\r\n\r\n```powershell\r\nDescribe \"Get-ChildItem: symlink-following tests\" {\r\n BeforeAll {\r\n Push-Location TestDrive:/\r\n # Create a directory with 2 files in it. \r\n $null = New-Item -Type Directory someDir\r\n 1..2 | % { $_ > \"someDir/$_.txt\" }\r\n # Create a symlink to that directory, as a sibling.\r\n New-Item -Type SymbolicLink someDirLink -Target someDir\r\n }\r\n AfterAll {\r\n Pop-Location\r\n }\r\n \r\n It \"Get-ChildItem -Recurse doesn't follow dir. symlinks.\" {\r\n (Get-ChildItem -File -Recurse).Count | Should -Be 2\r\n }\r\n\r\n It \"Get-ChildItem -Recurse -Path with a wildcard doesn't follow dir. symlinks.\" {\r\n (Get-ChildItem -File -Recurse -Path *).Count | Should -Be 2\r\n }\r\n\r\n It \"Get-ChildItem -Recurse -Name doesn't follow dir. symlinks.\" {\r\n (Get-ChildItem -File -Recurse -Name).Count | Should -Be 2\r\n }\r\n\r\n It \"Get-ChildItem -Recurse -Include doesn't follow dir. symlinks.\" {\r\n (Get-ChildItem -File -Recurse -Include *).Count | Should -Be 2\r\n }\r\n\r\n It \"Get-ChildItem -Recurse -Exclude doesn't follow dir. symlinks.\" {\r\n (Get-ChildItem -File -Recurse -Exclude nosuch).Count | Should -Be 2\r\n }\r\n \r\n}\r\n```\r\n\r\n# Expected behavior\r\n\r\nAll tests should pass.\r\n\r\n# Actual behavior\r\n\r\nThe last 3 tests fail.\r\n\r\n# Environment data\r\n\r\n```none\r\nPowerShell Core 6.2.0-rc.1\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-03-12T20:37:52Z","url":"https://github.com/PowerShell/PowerShell/issues/9126"}
| 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:cb54e68a-a49f-6378-f464-d9b65fadecd8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 90DE:3BDFE7:69C9A:8D3D3:6AFD48FB |
| html-safe-nonce | 1c7ca3530c1db976ccd372678c5c5e80f44f472f534273b0f4e2be2b6ef84b4d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MERFOjNCREZFNzo2OUM5QTo4RDNEMzo2QUZENDhGQiIsInZpc2l0b3JfaWQiOiI2NTQ1ODAwNjc0MDk0MTQzOTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 69226b72a713c798df6c961eb7208461973d390fc8ec6b1e7c5568b1707d644d |
| hovercard-subject-tag | issue:420194228 |
| 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/9126/issue_layout |
| twitter:image | https://opengraph.githubassets.com/28fefb7390a8873fb65afc0480019ed6040d812868566dc31266a45e8c0ab761/PowerShell/PowerShell/issues/9126 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/28fefb7390a8873fb65afc0480019ed6040d812868566dc31266a45e8c0ab761/PowerShell/PowerShell/issues/9126 |
| og:image:alt | PowerShell Core (unlike Windows PowerShell) by default is supposed to not follow symlinks (symbolic links) to directories during recursive traversal with Get-ChildItem -Recurse (you can opt in with... |
| 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 | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| 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 | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width