ctrl+u in password contexts does not produce the expected results with WSL #6151

Closed
opened 2026-01-31 00:31:05 +00:00 by claunia · 6 comments
Owner

Originally created by @richardnpaul on GitHub (Jan 26, 2020).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]

Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0

Windows Terminal version (if applicable):

Version: 0.8.10091.0

Steps to reproduce

  1. Create an SSH key with passphrase set and use this SSH key to ssh to a remote machine, in WSL. When prompted for the passphrase, mistype something, press Ctrl+u key combination and type the correct password.
  2. Alternatively, in WSL, attempt to su to an account which has a password, or perform a command with sudo and when prompted for the password, mistype, press ctrl+u and type the correct password.

Expected behavior

  1. The SSH key should be decrypted correctly and you should be connected via SSH to the remote machine.
  2. The password should be accepted and the account switched or the sudo command performed.

Actual behavior

  1. Reprompted for the password. Type it in correctly and this just works.
  2. Reprompted for the password. Type it in correctly and this just works.

I don't actually know or understand what's going on in the background here but this is a fairly frequently used shortcut with reasonably long&/complex passwords.

I added { "command": null, "keys": ["ctrl+u"] }, to my profile.json without improvement.

Originally created by @richardnpaul on GitHub (Jan 26, 2020). # Environment ``` Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] ``` > Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0 ``` Windows Terminal version (if applicable): ``` > Version: 0.8.10091.0 # Steps to reproduce 1. Create an SSH key with passphrase set and use this SSH key to ssh to a remote machine, in WSL. When prompted for the passphrase, mistype something, press `Ctrl+u` key combination and type the correct password. 2. Alternatively, in WSL, attempt to `su` to an account which has a password, or perform a command with `sudo` and when prompted for the password, mistype, press `ctrl+u` and type the correct password. # Expected behavior 1. The SSH key should be decrypted correctly and you should be connected via SSH to the remote machine. 2. The password should be accepted and the account switched or the sudo command performed. # Actual behavior 1. Reprompted for the password. Type it in correctly and this just works. 2. Reprompted for the password. Type it in correctly and this just works. --- I don't actually know or understand what's going on in the background here but this is a fairly frequently used shortcut with reasonably long&/complex passwords. I added `{ "command": null, "keys": ["ctrl+u"] },` to my profile.json without improvement.
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 00:31:06 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 26, 2020):

Sorry, what is ctrl+u supposed to do when it’s working?

@DHowett-MSFT commented on GitHub (Jan 26, 2020): Sorry, what is ctrl+u supposed to do when it’s working?
Author
Owner

@richardnpaul commented on GitHub (Jan 26, 2020):

Sorry, what is ctrl+u supposed to do when it’s working?

Terribly sorry, it's supposed to clear to the left of the cursor. You can this this working in WSL by typing something into the terminal and then using the ctrl+u combo. ctrl+k instead of ctrl+u clears to the right.

@richardnpaul commented on GitHub (Jan 26, 2020): > Sorry, what is ctrl+u supposed to do when it’s working? Terribly sorry, it's supposed to clear to the left of the cursor. You can this this working in WSL by typing something into the terminal and then using the `ctrl+u` combo. `ctrl+k` instead of `ctrl+u` clears to the right.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 26, 2020):

Wow, this is actually kinda crazy. It looks like ^U is handled by the tty itself. A compliant terminal emulator must send U+0015 NAK (␕), and it's up to the thing on the other end to handle it properly.

Unfortunately, that makes this a WSL issue (and not something Terminal can really help with) -- its tty implementation isn't handling NAK as kill-line.

Sorry!

@DHowett-MSFT commented on GitHub (Jan 26, 2020): Wow, this is actually kinda crazy. It looks like `^U` is handled _by the tty itself_. A compliant terminal emulator must send `U+0015 NAK` (␕), and it's up to the thing on the other end to handle it properly. Unfortunately, that makes this a WSL issue (and not something Terminal can really help with) -- its tty implementation isn't handling NAK as kill-line. Sorry!
Author
Owner

@richardnpaul commented on GitHub (Jan 26, 2020):

Wow, this is actually kinda crazy. It looks like ^U is handled by the tty itself. A compliant terminal emulator must send U+0015 NAK (␕), and it's up to the thing on the other end to handle it properly.

Unfortunately, that makes this a WSL issue (and not something Terminal can really help with) -- its tty implementation isn't handling NAK as kill-line.

Sorry!

I suspected as much. Thanks for checking this though. Is there some way to get this resolved in WSL do you know? Nevermind, I found the WSL repo for reporting issues

@richardnpaul commented on GitHub (Jan 26, 2020): > > > Wow, this is actually kinda crazy. It looks like `^U` is handled _by the tty itself_. A compliant terminal emulator must send `U+0015 NAK` (␕), and it's up to the thing on the other end to handle it properly. > > Unfortunately, that makes this a WSL issue (and not something Terminal can really help with) -- its tty implementation isn't handling NAK as kill-line. > > Sorry! I suspected as much. Thanks for checking this though. ~Is there some way to get this resolved in WSL do you know?~ Nevermind, I found the WSL repo for reporting issues
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 26, 2020):

(I bet this will work in WSL2, since it actually uses the Linux kernel (and therefore a good tty driver!))

@DHowett-MSFT commented on GitHub (Jan 26, 2020): (I bet this will work in WSL2, since it actually uses the Linux kernel (and therefore a good tty driver!))
Author
Owner

@richardnpaul commented on GitHub (Jan 26, 2020):

(I bet this will work in WSL2, since it actually uses the Linux kernel (and therefore a good tty driver!))

Spot on it does indeed work correctly in WSL2

@richardnpaul commented on GitHub (Jan 26, 2020): > (I bet this will work in WSL2, since it actually uses the Linux kernel (and therefore a good tty driver!)) Spot on it does indeed work correctly in WSL2
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6151