You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New-Item Type SymbolicLink on Unix-like platforms unexpectedly converts relative target paths to absolute one #15233
PR #12797 tried to implement support for relative target paths for symbolic links (symlinks).
On Windows, this now works properly.
On Unix-like platforms, a relative input path is still unexpectedly converted to a full path and stored as such in the symlink.
Steps to reproduce
Note: Run on macOS and/or Linux (the test succeeds on Windows).
Push-Location-ea Stop ($tmpDir= (New-Item-Type Directory -Force (Join-Path Temp:/$PID)).FullName)
# Create a file to serve as the symlink target.$null=New-Item-Force file
# Determine the native file-system path separator, as well as the one # *not* native to the platform.$sep= [IO.Path]::DirectorySeparatorChar
$otherSep=$sep-eq'/'?'\' : '/'# To also test path-separator normalization, we use the non-native separator.$null=New-Item-Force -Type SymbolicLink fileL -Target ".${otherSep}file"# The symlink's target should be a relative path that uses the platform-appropriate path separator.
(Get-Item fileL).Target | Should -Be ".${sep}file"# Clean up.Pop-Location; Remove-Item$tmpDir-Recurse
Expected behavior
The test should succeed.
Actual behavior
The test fails, because the relative input path is unexpectedly first resolved to a full path before the symlink is defined:
InvalidResult: Expected strings to be the same, but they were different.
Expected length: 6 Actual length: 14 Strings differ at index 0.
Expected: './file' But was: '/tmp/2802/file'
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Activity
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.