-
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 productOS-LinuxOS-macOSResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
With pwsh on macOS and Linux, the LinkType property on IO.DirectoryInfo IO.FileInfo objects have a value of SymbolicLink when creating objects to non-existent directories or files. In Windows PowerShell and pwsh on Windows 10, LinkType is null. I would expect pwsh on macOS/Linux to behave the same.
Steps to reproduce
pwsh 7.1.3 on macOS and Linux
[IO.DirectoryInfo]::new('doesnotexist') | Format-List
[IO.FileInfo]::new('doesnotexist') | Format-ListExpected behavior
pwsh 7.1.3 on Windows 10
> [IO.DirectoryInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
CreationTime : 12/31/1600 4:00:00 PM
LastWriteTime : 12/31/1600 4:00:00 PM
LastAccessTime : 12/31/1600 4:00:00 PM
Mode : larhs
LinkType :
Target : doesnotexist
> [IO.FileInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
Length :
CreationTime : 12/31/1600 4:00:00 PM
LastWriteTime : 12/31/1600 4:00:00 PM
LastAccessTime : 12/31/1600 4:00:00 PM
Mode : larhs
LinkType :
Target : doesnotexistActual behavior
On macOS and Linux, the LinkType property has a value of SymbolicLink, even though the directory/file does not exist.
> [IO.DirectoryInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
CreationTime : 12/31/1600 16:07:00
LastWriteTime : 12/31/1600 16:07:00
LastAccessTime : 12/31/1600 16:07:00
Mode : larhs
LinkType : SymbolicLink
Target : doesnotexist
> [IO.FileInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
Length :
CreationTime : 12/31/1600 16:07:00
LastWriteTime : 12/31/1600 16:07:00
LastAccessTime : 12/31/1600 16:07:00
Mode : larhs
LinkType : SymbolicLink
Target : doesnotexistEnvironment data
WSL
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Linux 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Windows 10
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
mklement0
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productOS-LinuxOS-macOSResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.