PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Arch Linux: Interrupted Tab Completion Hangs the Shell

Open SchrodingerZhu opened this issue 4 years ago • 6 comments

This is an issue migrated from https://github.com/PowerShell/PowerShell/issues/12475.

Steps to reproduce

On linux, type anything that may show the candidates list and then press tab and Ctrl-C

syst<tab>
🕙[ 10:22:44 ] λ systemctl
systemctl                       systemd-hwdb                    systemd-run
systemd-analyze                 systemd-id128                   systemd-socket-activate
systemd-ask-password            systemd-inhibit                 systemd-stdio-bridge
systemd-cat                     systemd-machine-id-setup        systemd-sysusers
systemd-cgls                    systemd-mount                   systemd-tmpfiles
systemd-cgtop                   systemd-notify                  systemd-tty-ask-password-agent
systemd-delta                   systemd-nspawn                  systemd-umount
systemd-detect-virt             systemd-path                    systemmonitor
systemd-escape                  systemd-repart                  systemsettings5
systemd-firstboot               systemd-resolve                 systool

/usr/bin/systemctl

Then the candidates list disappears (which is expected) but the whole shell hangs.

version

PowerShell 7.1.0-preview.1 and PowerShell 7.1.0-preview.2

profile

# Shows navigable menu of all options when hitting Tab 

Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

 # Autocompletion for arrow keys

Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward 
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

Notice

Original issue mentioned about starship, but the problem can be reproduced without it, hence I removed descriptions about starship.

SchrodingerZhu avatar Apr 24 '20 02:04 SchrodingerZhu

any update?

SchrodingerZhu avatar Apr 28 '20 12:04 SchrodingerZhu

@SchrodingerZhu I cannot reproduce this on Ubuntu 16.04 with either PowerShell 7.0.0 (2.0.0 PSReadLine) or PowerShell 7.1.0-preview.2 (2.1.0-beta1 PSReadLine). Which Linux distro were you using?

norepro

daxian-dbw avatar May 01 '20 23:05 daxian-dbw

Arch Linux with latest zen kernel

Linux <HOST> 5.6.8-zen1-1-zen #1 ZEN SMP PREEMPT Wed, 29 Apr 2020 16:23:00 +0000 x86_64 GNU/Linux

Tested again, with both konsole and alacritty

SchrodingerZhu avatar May 02 '20 00:05 SchrodingerZhu

Thanks for the additional information. Please note that Arch Linux is maintained by the community and not officially supported by Microsoft, so it will be a low priority for us to investigate this issue. Just want to set the correct expectation :)

daxian-dbw avatar May 10 '20 23:05 daxian-dbw

It seems like this issue is alive and well; using Ubuntu 23.04, Powershell 7.3.6 installed via the Microsoft apt repository, I freeze pwsh deterministically with the following:

  1. install pnp.powershell module (lots of commands)
  2. set PSReadLineKeyHandler completion for key Tab to MenuComplete
  3. type pnp-get[tab] (make sure the terminal has enough display space to offer all 200+ options and therefore navigation)
  4. navigate down in the list twice
  5. navigate back up once
  6. hit CTRL-C --> pwsh becomes unresponsive and irrecoverable

Reproduced with terminal hosts Kitty and gnome-terminal, also using Powershell Remoting over SSH.

Being used to CTRL-C to abort, I've been facing a repeatedly hanging shell and lots of frustration.

jfpoirier-x2o avatar Sep 09 '23 14:09 jfpoirier-x2o

Seems to be somewhat fixed on the pre-release. Now, it leaves the cursor in the original position but leaves the completed text there. I'm not sure if that's the intended behavior

emi0x7d1 avatar Apr 29 '24 20:04 emi0x7d1