-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
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
Summary
wsl ~ works in PowerShell 7.5 but fails in PowerShell 7.6 due to unexpected tilde expansion and argument mangling
Steps to reproduc
Run the following command in PowerShell:
wsl ~
the command fails with:
/bin/bash: line 1:
D:Users<username>: command not found
Additional information
The issue does not occur in cmd.exe
The issue did not occur in PowerShell 7.5
This suggests a regression or change in native argument passing behavior in 7.6
Workarounds
The following commands work as expected:
wsl --cd ~
wsl "~"
Expected behavior
~ should be passed to WSL and resolved to the Linux home directory (e.g. /home/<user>).
This is the behavior observed in PowerShell 7.5.Actual behavior
In PowerShell 7.6, the command fails with:
/bin/bash: line 1:
D:Users<username>: command not found
It appears that:
1. ~ is expanded by PowerShell into a Windows path (e.g. D:\Users\<username>)
2. The backslashes (\) are stripped or mangled when passed to the native command
3. The resulting string (D:Users<username>) is interpreted by bash as a commandError details
Environment data
Name Value
---- -----
PSVersion 7.6.0
PSEdition Core
GitCommitId 7.6.0
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.