Title: Copy-Item does not understand symlinks · Issue #2957 · PowerShell/PowerShell · GitHub
Open Graph Title: Copy-Item does not understand symlinks · Issue #2957 · PowerShell/PowerShell
X Title: Copy-Item does not understand symlinks · Issue #2957 · PowerShell/PowerShell
Description: Steps to reproduce ~/test |-/ mkdir folder ~/test |-/ touch file ~/test |-/ ln -s folder validfolderlink ~/test |-/ ln -s file validfilelink ~/test |-/ ln -s foobarbaz brokenlink ~/test |-/ Copy-Item ./validfolderlink validfolderlinkcopy...
Open Graph Description: Steps to reproduce ~/test |-/ mkdir folder ~/test |-/ touch file ~/test |-/ ln -s folder validfolderlink ~/test |-/ ln -s file validfilelink ~/test |-/ ln -s foobarbaz brokenlink ~/test |-/ Copy-It...
X Description: Steps to reproduce ~/test |-/ mkdir folder ~/test |-/ touch file ~/test |-/ ln -s folder validfolderlink ~/test |-/ ln -s file validfilelink ~/test |-/ ln -s foobarbaz brokenlink ~/test |-/ Copy-It...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2957
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Copy-Item does not understand symlinks","articleBody":"Steps to reproduce\r\n------------------\r\n```powershell\r\n~/test |-/ mkdir folder\r\n~/test |-/ touch file\r\n~/test |-/ ln -s folder validfolderlink\r\n~/test |-/ ln -s file validfilelink\r\n~/test |-/ ln -s foobarbaz brokenlink\r\n~/test |-/ Copy-Item ./validfolderlink validfolderlinkcopy\r\n~/test |-/ ls -l validfolderlinkcopy\r\ntotal 0\r\n~/test |-/ Copy-Item ./validfilelink validfilelinkcopy\r\n~/test |-/ ls -l ./validfilelinkcopy\r\n-rw-rw-r--. 1 andschwa andschwa 0 Jan 5 13:29 ./validfilelinkcopy\r\n~/test |-/ Copy-Item ./brokenlink brokenlinkcopy\r\nCopy-Item : Could not find file '/home/andschwa/test/brokenlink'.\r\nAt line:1 char:1\r\n+ Copy-Item ./brokenlink brokenlinkcopy\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [Copy-Item], FileNotFoundException\r\n + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand\r\n\r\n~/test |-/\r\n\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n1) `validfolderlinkcopy` should be a copy of the symlink `validfolderlink`\r\n2) `validfilelinkcopy` should be a copy of the symlink `validfilelink`\r\n3) `brokenlinkcopy` should be a copy of the symlink `brokenlink`\r\n\r\nActual behavior\r\n---------------\r\n1) `validfolderlinkcopy` is a copy of link's target `folder`\r\n2) `validfilelinkcopy` is a copy of the link's target `file`\r\n3) PowerShell throws an error when copying `brokenlink` to `brokenlinkcopy` \r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```powershell\r\n> $PSVersionTable\r\nv6.0.0-alpha.14\r\n> uname -nro\r\nandschwa-centos 3.10.0-514.2.2.el7.x86_64 GNU/Linux\r\n```\r\n\r\nThis is similar to #804 where `New-Item` did not understand broken symlinks, since it was trying to follow it. The semantics on Linux of copy/move/new is to treat the symlink as a normal file, instead of following it, but PowerShell does not do this.","author":{"url":"https://github.com/andyleejordan","@type":"Person","name":"andyleejordan"},"datePublished":"2017-01-05T21:37:08Z","url":"https://github.com/PowerShell/PowerShell/issues/2957"}
| 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:5ee93669-3d8f-6787-5025-570eed4be6ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3D4:3042FD:10FA4C:182168:6AFD5DAE |
| html-safe-nonce | 0790df7e6f006626dcabd12a67cdd67ddf90fb17b40997b6d4bbb87b5f9b54df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0Q0OjMwNDJGRDoxMEZBNEM6MTgyMTY4OjZBRkQ1REFFIiwidmlzaXRvcl9pZCI6IjMxODc5NzM2MzUxMjU4OTQ1NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | afd95a0ec335b551b7fe2779c982c84bc79f87aa1f728cc3bf5ad8a9a3f2213a |
| hovercard-subject-tag | issue:199065842 |
| 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/2957/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39d20d41c76b93bfe6801a3357b0ee96ec42f2e0e16d6c0bc65b5445f84fe831/PowerShell/PowerShell/issues/2957 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39d20d41c76b93bfe6801a3357b0ee96ec42f2e0e16d6c0bc65b5445f84fe831/PowerShell/PowerShell/issues/2957 |
| og:image:alt | Steps to reproduce ~/test |-/ mkdir folder ~/test |-/ touch file ~/test |-/ ln -s folder validfolderlink ~/test |-/ ln -s file validfilelink ~/test |-/ ln -s foobarbaz brokenlink ~/test |-/ Copy-It... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andyleejordan |
| 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