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

Curses sometimes fails to initialize terminal #46909

Closed
ferperez mannequin opened this issue Apr 18, 2008 · 4 comments
Closed

Curses sometimes fails to initialize terminal #46909

ferperez mannequin opened this issue Apr 18, 2008 · 4 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@ferperez
Copy link
Mannequin

ferperez mannequin commented Apr 18, 2008

BPO 2657
Nosy @akuchling, @terryjreedy
Files
  • cursesbug.py: Simple test to see if the bug is present (it can't cause it though)
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-03-30.21:03:58.463>
    created_at = <Date 2008-04-18.22:51:07.592>
    labels = ['extension-modules', 'type-bug']
    title = 'Curses sometimes fails to initialize terminal'
    updated_at = <Date 2011-03-30.21:03:58.462>
    user = 'https://bugs.python.org/ferperez'

    bugs.python.org fields:

    activity = <Date 2011-03-30.21:03:58.462>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-03-30.21:03:58.463>
    closer = 'terry.reedy'
    components = ['Extension Modules']
    creation = <Date 2008-04-18.22:51:07.592>
    creator = 'fer_perez'
    dependencies = []
    files = ['10059']
    hgrepos = []
    issue_num = 2657
    keywords = []
    message_count = 4.0
    messages = ['65626', '67898', '107431', '121080']
    nosy_count = 3.0
    nosy_names = ['akuchling', 'terry.reedy', 'fer_perez']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue2657'
    versions = ['Python 2.5']

    @ferperez
    Copy link
    Mannequin Author

    ferperez mannequin commented Apr 18, 2008

    Curses sometimes fails to correctly initialize the terminal.
    Unfortunately I don't know how to reproduce the problem, it was reported
    multiple times by ipython users, but I have no idea what causes it. I
    finally found a workaround by making a termios call that at least
    restores terminal state (see attachment), but it's just a workaround,
    not a real fix.

    The issue manifests itself as follows: at some point (I don't know why),
    a call to curses.initscr() doesn't actually set the terminal in the
    usual mode where input isn't accepted, but instead the terminal
    continues accepting normal input, issuing newlines, etc. The only sign
    that curses is active is that in a modern terminal, the scrollbar
    changes to fill the screen. After this, calling curses.endwin(),
    instead of restoring terminal state, leaves the terminal in the mode
    that typically initscr() would put it in: no input is displayed,
    printouts swallow end-of-line characters, etc.

    When this happened in ipython sessions, we'd just suggest users call
    !reset (the system command), which would restore terminal state. But
    the problem is obviously in curses itself, because once this problem
    appeared, running the attached script would always print 'False' for the
    state condition checked there.

    For now in IPython we have a workaround, but perhaps with this little
    description/example, someone who knows the curses code might be able to
    actually fix the real problem. If I find a reliable way to trigger the
    bug, I'll add comments here indicating so.

    @ferperez ferperez mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Apr 18, 2008
    @akuchling akuchling self-assigned this Apr 25, 2008
    @akuchling akuchling changed the title curses Curses sometimes fails to initialize terminal Apr 25, 2008
    @ferperez
    Copy link
    Mannequin Author

    ferperez mannequin commented Jun 10, 2008

    As reported by Ondrej Certik on the IPython mailing list:

    Here is how to reliably (100%) reproduce it in ipython 0.8.2 (the bug
    indeed goes away in 0.8.4):

    http://code.google.com/p/sympy/issues/detail?id=822

    together with a screenshot how the terminal looks like (see the
    comment #6 for the exact sympy revision to use). Maybe you could use
    it to track the bug down in curses, as your patch only seems to be a
    workaround (albeit working).

    Ondrej

    /quote

    While unfortunately right now I don't have the time to try and whittle
    this down to a smaller, self-contained example, it's great to at least
    have a guaranteed reproducible way of triggering the bug. It requires
    installing specific versions of both ipython and sympy, but that's very
    straightforward to do, as both are pure-python projects with no
    dependencies outside the stdlib.

    @terryjreedy
    Copy link
    Member

    Is this an issue with 2.7 or 3.1?

    @akuchling akuchling removed their assignment Nov 12, 2010
    @terryjreedy
    Copy link
    Member

    That should be, for 2.7 or 3.2, as 3.1 is nearly finished.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants