-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Join-Path doesn't handle provider prefixes correctly on Unix-like platforms #14538
Comments
Is this for Linux and MacOs only? |
@iSazonov, yes, because the problem is related to normalizing |
Hi folks. Is this up for grabs? If so, I'd like to take it on. |
@iSazonov, resurfacing my question above. This issue is not tagged as up for grabs but I'm wondering whether it could still be a good one for me to look into. |
@octos4murai I haven't seen anyone else wanting to take it up, and it seems a fairly clear case of the behaviour being bugged, so yeah, we may as well consider it up for grabs. 🙂 |
I've been able to take a better look and wanted to ask a couple questions before I start writing any code:
|
FileSystem Provider always normalizes paths. See PowerShell/src/System.Management.Automation/namespaces/FileSystemProvider.cs Lines 103 to 106 in 3733a0b
|
Thanks for your response @iSazonov -- but allow me to switch gears for a bit... Is A supported way to accomplish @mklement0's example above is to do this instead: Join-Path (Get-Item .).Parent.FullName foo
# Returns something like: /home/octos4murai/foo Unless I'm missing something, this should be classified as an enhancement (if it's decided it should be supported at all).
|
Yes, it is. All paths on top level is PowerShell paths (provider qualified paths). Then on level below they are resolved to provider specific paths. Root of the issue is in broken normalization |
Thanks! For the following command in Unix-like systems: Join-Path (Get-Item .).PSParentPath foo Which of the following is the expected result: Microsoft.PowerShell.Core/FileSystem::/home/octos4murai/foo or Microsoft.PowerShell.Core\FileSystem::/home/octos4murai/foo I assume it's the first one with consistent path separators? |
Provider names are never normalized. You can find them in SingleShellProviderNames class. |
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. |
2 similar comments
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. |
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. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Steps to reproduce
On macOS or Linux:
Expected behavior
The test should succeed.
Actual behavior
The test fails, because the existing provider prefix isn't recognized as such, causing its
\
separator to be normalized to/
and another provider prefix to be prepended.That is,
Join-Path
's output was something like (note the doubled provider prefix, with the 2nd one using/
):Environment data
The text was updated successfully, but these errors were encountered: