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

bash shell does not echo typed characters #1503

Closed
2 tasks done
mthuurne opened this issue Oct 26, 2019 · 8 comments
Closed
2 tasks done

bash shell does not echo typed characters #1503

mthuurne opened this issue Oct 26, 2019 · 8 comments
Labels
kind/bug Something isn't working as expected
Milestone

Comments

@mthuurne
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • openSUSE Linux 15.1
  • Poetry 1.0.0b3

Issue

The poetry shell command worked fine on my machine for Poetry 0.12.17, but after upgrading to Poetry 1.0.0b3, when I get the shell prompt after running the poetry shell command, the terminal output is broken. The most striking problem is that characters I type are not echoed, but there are other output glitches as well:

poetry@hyperion:~/retroasm> poetry shell
/home/poetry/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)
The currently activated Python version 2.7.14 is not supported by the project (^3.6).
Trying to find and use a compatible version. 
Using python3 (3.6.5)
Spawning shell within /home/poetry/.cache/pypoetry/virtualenvs/retroasm-MmrMfn3P-py3.6
poetry@hyperion:~/retroasm> (retroasm-MmrMfn3P-py3.6) poetry@hyperion:~/retroasm

At this point, I can type commands and they are executed, but I don't see any of the characters I type echoed after the prompt. After running reset my typed input is echoed again.

Note the missing newline at end: that is not a copy-paste error, that actually happens in the terminal. When I execute a command like ls -1, the newline from typing the command does not appear, but the newlines printed by ls do:

(retroasm-MmrMfn3P-py3.6) poetry@hyperion:~/retroasm> LICENSE
README.md
checkdef.py
(snip)

I thought the problem might have to do with the ANSI codes used to produce colors, but while poetry shell --no-ansi does suppress the color output, it doesn't fix the problem.

The problem is specific to bash: if I start a different shell, it works fine:

poetry@hyperion:~/retroasm> SHELL=ksh poetry shell
/home/poetry/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)
The currently activated Python version 2.7.14 is not supported by the project (^3.6).
Trying to find and use a compatible version. 
Using python3 (3.6.5)
Spawning shell within /home/poetry/.cache/pypoetry/virtualenvs/retroasm-MmrMfn3P-py3.6
$ . /home/poetry/.cache/pypoetry/virtualenvs/retroasm-MmrMfn3P-py3.6/bin/activate
(retroasm-MmrMfn3P-py3.6) $ ls -1
LICENSE
README.md
(snip)

I have a git prompt and several completions configured for bash on my normal developer account, so to rule out that those are causing problems I created a new user account and disabled the systemwide bash configurations by renaming the /etc/aliases.d, /etc/bash_completion.d and /etc/profile.d directories. That didn't fix the problem.

I tried changing the TERM environment variable from xterm-256color to just xterm and to vt100, but that didn't fix the problem either.

At this point I'm out of ideas for what else I could be trying to diagnose this problem. If anyone has a clue, please comment.

@mthuurne mthuurne added the kind/bug Something isn't working as expected label Oct 26, 2019
@dmarinuswoodwing
Copy link

I have the same problem, it seems to be introduced in Poetry 1.0.0b2

I can workaround it by blindly typing reset after entering the shell.

@Toruitas
Copy link

Toruitas commented Oct 30, 2019

Thirding this problem. The bug is present in various Bash terminals, including the PyCharm one. Poetry 1.0.0b3 on Ubuntu 18. I can confirm the reset workaround, as well.

@daphtdazz
Copy link

daphtdazz commented Nov 1, 2019

Did a bit of debugging... seems like a timing issue. In poetry/utils/shell.py Shell.activate() we call

c = pexpect.spawn(
                self._path, ["-i"], dimensions=(terminal.height, terminal.width)
            )
...
c.setecho(False)

Removing c.setecho(False) fixes it, but also putting a sleep of one second in before c.setecho(False) also fixes it. Not sure what the purpose of the code is here so can't really offer a fix but I guess some implicit assumption about how long it would take to spawn the shell is being violated.

Edit: I'm running poetry 1.0.0b3 on macOS 10.14.6 Mojave

@HacKanCuBa
Copy link

Ping @sdispater about removing that sentence or delaying its execution a bit.

@JakeSummers
Copy link

Also experiencing this problem with:

$ poetry --version
Poetry version 1.0.0b3

$ bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

@joaonsantos
Copy link

Also experiencing this with:

$ poetry --version
Poetry version 1.0.0b4

$ bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 19.10
Release:	19.10
Codename:	eoan

@mthuurne
Copy link
Author

The problem no longer occurs for me with Poetry 1.0.0b8, so it looks like the fix is working.

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

8 participants