-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
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
~/test |-/ ls -l validfolderlinkcopy
total 0
~/test |-/ Copy-Item ./validfilelink validfilelinkcopy
~/test |-/ ls -l ./validfilelinkcopy
-rw-rw-r--. 1 andschwa andschwa 0 Jan 5 13:29 ./validfilelinkcopy
~/test |-/ Copy-Item ./brokenlink brokenlinkcopy
Copy-Item : Could not find file '/home/andschwa/test/brokenlink'.
At line:1 char:1
+ Copy-Item ./brokenlink brokenlinkcopy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-Item], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
~/test |-/
Expected behavior
validfolderlinkcopyshould be a copy of the symlinkvalidfolderlinkvalidfilelinkcopyshould be a copy of the symlinkvalidfilelinkbrokenlinkcopyshould be a copy of the symlinkbrokenlink
Actual behavior
validfolderlinkcopyis a copy of link's targetfoldervalidfilelinkcopyis a copy of the link's targetfile- PowerShell throws an error when copying
brokenlinktobrokenlinkcopy
Environment data
> $PSVersionTable
v6.0.0-alpha.14
> uname -nro
andschwa-centos 3.10.0-514.2.2.el7.x86_64 GNU/LinuxThis 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.
Schweinepriester and ObDest
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues