Prerequisites
Steps to reproduce
Create 2 links and 1 file:
touch foo
ln -s bar foo
ln -s baz bar
so you have baz -> bar -> foo
I used the following Cmdlet to exemplify the error:
using System.Management.Automation; // Windows PowerShell assembly.
using Microsoft.PowerShell.Commands;
namespace SendGreeting
{
[Cmdlet(VerbsCommunications.Send, "Greeting")]
public class SendGreetingCommand : Cmdlet
{
protected override void ProcessRecord()
{
WriteObject("Hello " + name + "!!");
string fileName = FileSystemProvider.NameString(new PSObject(new System.IO.FileInfo("/home/user/baz")));
WriteObject(fileName);
}
}
}
Import-Module /home/user/Cmdlet/bin/Debug/net5.0/Cmdlet.dll
Send-Greeting
Expected behavior
Actual behavior
Error details
This differs with Windows and also seems to differ when realpath fails since it fallsback to readlink:
https://github.com/PowerShell/PowerShell-Native/blob/deb01d6f65b07a0861933a2986cce2318fd60492/src/libpsl-native/src/followsymlink.cpp#L39-L54
Environment data
PS /home/jozky/pscore> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.4
PSEdition Core
GitCommitId 7.1.4
OS Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
Create 2 links and 1 file:
so you have baz -> bar -> foo
I used the following Cmdlet to exemplify the error:
Expected behavior
baz -> barActual behavior
baz -> fooError details
This differs with Windows and also seems to differ when realpath fails since it fallsback to readlink:
https://github.com/PowerShell/PowerShell-Native/blob/deb01d6f65b07a0861933a2986cce2318fd60492/src/libpsl-native/src/followsymlink.cpp#L39-L54
Environment data
Visuals
No response