-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerBreaking-Changebreaking change that may affect usersbreaking change that may affect usersIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Create 2 links and 1 file:
touch foo
ln -s bar foo
ln -s baz barso 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-GreetingExpected 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
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.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerBreaking-Changebreaking change that may affect usersbreaking change that may affect usersIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime