Skip to content
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

Unexpected backslashes when remoting from Win to Nix #3923

Closed
PowerCoder opened this issue Apr 3, 2020 · 8 comments · Fixed by #3935
Closed

Unexpected backslashes when remoting from Win to Nix #3923

PowerCoder opened this issue Apr 3, 2020 · 8 comments · Fixed by #3935
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed

Comments

@PowerCoder
Copy link

PowerCoder commented Apr 3, 2020

A minor cosmetic issue described in VSCode's Repo.

Steps to reproduce & actual behavior

If I start PwSH on my Windows-box:

PS C:\Windows\System32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Then use remoting to my Linux box:

PS C:\Windows\System32> Enter-PSSession -HostName 'linuxbox.localdomain' -UserName 'root'
[email protected]'s password:
[[email protected]]: PS /root> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Linux 5.4.28-1-lts PowerShell/PowerShell#1 SMP Wed, 25 Mar 2020 13:04:22 +0000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

And then use TAB-completion on file-paths, it will append backslashes instead of forward slashes.
In this case, I typed /tm followed by TAB.

[[email protected]]: PS /root> Set-Location -Path '/tmp\'

Powershell can, however deal with them, as I can keep typing and the next TAB will auto-correct the backslash to a forward slash.
In this case, I typed /tmp\scrip followed by TAB.

[[email protected]]: PS /tmp> Set-Location -Path '/tmp/scriptroot\'

Pressing Enter on the above command also works fine with the backslash.

[[email protected]]: PS /tmp/scriptroot>_

If I (as accurately as is possible) reproduce the steps involved in a Enter-PSSession over SSH by:

  • Starting PwSh on Windows
  • From there using the Windows OpenSSH client native to Win10 to connect to the Linux box
  • And finish by starting pwsh manually from the default Linux shell
    it works just fine:
PS C:\Windows\System32> ssh [email protected]
[email protected]'s password:
Last login: Thu Apr  2 23:34:34 2020 from 192.168.xxx.xxx
root@linuxbox ~ # pwsh
PowerShell 7.0.0
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

PS /root> Set-Location -Path '/tmp/'
PS /tmp> Set-Location -Path '/tmp/scriptroot/'
PS /tmp/scriptroot>                           

In other news, I notice the previous PSRemoting session isn't registered as a login session.

PS /tmp/scriptroot> last
root     pts/0        192.168.xxx.xxx   Fri Apr  3 20:02   still logged in
root     pts/0        192.168.xxx.xxx   Thu Apr  2 23:34 - 23:36  (00:01)

Linux security admins everywhere are blocking PwSh-over-SSH right now.

Expected behavior

Do you want me to write it out? Expected behavior is when TAB auto-complete appends forward slashes instead of backslashes. Which happens when running pwsh from the linux console, as well as when I connect using SSH into the default shell first, before starting pwsh from said shell.

My guess is it has something to do with the fact that the parent-session is Windows. But since Linux-native commands like ls (and as you can see last) work, it would mean that IsLinux should be $True. I'll leave it to the experts.

@iSazonov
Copy link

iSazonov commented Apr 5, 2020

I think this could be resolved in PSReadline (detect remoting session and switching to Unix or Windows mode as needed).

/cc @daxian-dbw Should we move this in PSReadline repo?

@aaronfranke
Copy link

Fixing PowerShell/PowerShell#10509 would probably fix this issue too.

Copy link
Contributor

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.

1 similar comment
Copy link
Contributor

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.

@aaronfranke
Copy link

This is still a problem. PowerShell still tries to use \.

Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

@aaronfranke
Copy link

I was active in this issue last week.

@theJasonHelmick theJasonHelmick added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jan 17, 2024
@theJasonHelmick
Copy link
Collaborator

Thank you @PowerCoder for this issue. The interactive WG agrees that this is a bug to be investigated and fixed in the future.

@daxian-dbw daxian-dbw transferred this issue from PowerShell/PowerShell Jan 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jan 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR A PR is opened targeting the issue label Jan 31, 2024
@daxian-dbw daxian-dbw removed Issue-Question For non-bug questions or discussion. Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Jan 31, 2024
@daxian-dbw daxian-dbw added Resolution-Fixed and removed In-PR A PR is opened targeting the issue labels Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants