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 library in python 2.4.3 broken #43155

Closed
vnainar mannequin opened this issue Apr 4, 2006 · 24 comments
Closed

curses library in python 2.4.3 broken #43155

vnainar mannequin opened this issue Apr 4, 2006 · 24 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@vnainar
Copy link
Mannequin

vnainar mannequin commented Apr 4, 2006

BPO 1464056
Nosy @loewis, @akuchling
Files
  • panelw.diff
  • 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 = 'https://github.com/akuchling'
    closed_at = <Date 2006-08-07.00:39:31.000>
    created_at = <Date 2006-04-04.08:47:30.000>
    labels = ['library']
    title = 'curses library in python 2.4.3 broken'
    updated_at = <Date 2006-08-07.00:39:31.000>
    user = 'https://bugs.python.org/vnainar'

    bugs.python.org fields:

    activity = <Date 2006-08-07.00:39:31.000>
    actor = 'akuchling'
    assignee = 'akuchling'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2006-04-04.08:47:30.000>
    creator = 'vnainar'
    dependencies = []
    files = ['1948']
    hgrepos = []
    issue_num = 1464056
    keywords = []
    message_count = 24.0
    messages = ['28038', '28039', '28040', '28041', '28042', '28043', '28044', '28045', '28046', '28047', '28048', '28049', '28050', '28051', '28052', '28053', '28054', '28055', '28056', '28057', '28058', '28059', '28060', '28061']
    nosy_count = 8.0
    nosy_names = ['loewis', 'akuchling', 'nnorwitz', 'anthonybaxter', 'splitscreen', 'vnainar', 'atler_', 'psmedley']
    pr_nums = []
    priority = 'critical'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1464056'
    versions = ['Python 2.4']

    @vnainar
    Copy link
    Mannequin Author

    vnainar mannequin commented Apr 4, 2006

    My python programs using curses library do not work
    with version 2.4.3.Even the 'ncurses.py ' demo program
    in the Demo/curses directory does not work correctly.
    The problem seems to be in the 'panels' library

    @vnainar vnainar mannequin closed this as completed Apr 4, 2006
    @vnainar vnainar mannequin assigned akuchling Apr 4, 2006
    @vnainar vnainar mannequin added the stdlib Python modules in the Lib dir label Apr 4, 2006
    @vnainar vnainar mannequin closed this as completed Apr 4, 2006
    @vnainar vnainar mannequin assigned akuchling Apr 4, 2006
    @vnainar vnainar mannequin added the stdlib Python modules in the Lib dir label Apr 4, 2006
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 4, 2006

    Logged In: YES
    user_id=21627

    What do you mean by "do not work"? What operating system and
    what curses implementation are you using?

    @vnainar
    Copy link
    Mannequin Author

    vnainar mannequin commented Apr 6, 2006

    Logged In: YES
    user_id=1493752

    Sorry my original post was incomplete. I am running
    slackware 10.2 (linux kernel 2.6).The python library was
    tested with ncurses 5.4 and ncurses 5.5( the latest
    release). All programs run OK with 2.4.1.As I said ,the
    curses demo that comes with the Python distributions runs OK
    with 2.4.1 but
    not with 2.4.3 - I have both on my machine

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=1497957

    I confirm the problem. Every program using curses library
    segfaults and there's only one error before it happens:

    ...
    import curses # directory /usr/share/python2.4/curses
    import curses # precompiled from
    /usr/share/python2.4/curses/__init__.pyc
    dlopen("/usr/lib/python2.4/lib-dynload/_curses.so", 2);
    import _curses # dynamically loaded from
    /usr/lib/python2.4/lib-dynload/_curses.so
    import curses.wrapper # precompiled from
    /usr/share/python2.4/curses/wrapper.pyc
    import curses.panel # precompiled from
    /usr/share/python2.4/curses/panel.pyc
    dlopen("/usr/lib/python2.4/lib-dynload/_curses_panel.so", 2);
    import _curses_panel # dynamically loaded from
    /usr/lib/python2.4/lib-dynload/_curses_panel.so
    Traceback (most recent call last):
      File "ncurses.py", line 273, in ?
        curses.wrapper(demo_panels)
      File "/usr/share/python2.4/curses/wrapper.py", line 49, in
    wrapper
    _curses.error: nocbreak() returned ERR

    I'm running Linux (PLD) with Python 2.4.3 and ncurses 5.5.
    With Python 2.4.2 everything worked fine.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=21627

    I can't reproduce any of this on Debian;
    Demo/curses/ncurses.py runs fine. Can you please

    1. run ldd on _curses.so, and report the output, and
    2. edit setup.py, removing the lines that deal with ncursesw,
    3. atler_: produce a gdb backtrace on the time of the crash,
      4: vnainar: please report what you mean by "does not work".
      Does it erase your hard disk? turn off the machine? Paint
      things blue instead of red?

    @splitscreen
    Copy link
    Mannequin

    splitscreen mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=1126061

    Cannot reproduce on Gentoo. All the files in the Demo/curses
    directory run fine.

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=1497957

    $ ldd /usr/lib/python2.4/lib-dynload/_curses.so
            libncursesw.so.5 => /usr/lib/libncursesw.so.5
    (0x7004c000)
            libpthread.so.0 => /lib/libpthread.so.0 (0x70080000)
            libc.so.6 => /lib/libc.so.6 (0x700e4000)
            libdl.so.2 => /lib/libdl.so.2 (0x70228000)
            libtinfow.so.5 => /usr/lib/libtinfow.so.5 (0x7023c000)
            /lib/ld-linux.so.2 (0x70000000)

    ...
    Program received signal SIGSEGV, Segmentation fault.
    0x7063947c in hide_panel () from /usr/lib/libpanel.so.5
    gdb) bt
    #0 0x7063947c in hide_panel () from /usr/lib/libpanel.so.5
    #1 0x706254b8 in ?? () from
    /usr/lib/python2.4/lib-dynload/_curses_panel.so
    #2 0x706254b8 in ?? () from
    /usr/lib/python2.4/lib-dynload/_curses_panel.so
    Previous frame identical to this frame (corrupt stack?)

    It seems that only programs using panel library cause
    segfaults (all other demos run fine except ncurses.py),
    sorry for a mistake in a last post.

    loewis: I'm not sure I understand second point. What excatly
    should be changed in setup.py?

    @anthonybaxter
    Copy link
    Mannequin

    anthonybaxter mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=29957

    The buildbot boxes don't show this problem.

    You might need to rebuild a Python with -g and unstripped to
    get a useful backtrace.

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=1497957

    More complete backtrace, I hope it will help:
    http://pastebin.com/649445

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 9, 2006

    Logged In: YES
    user_id=21627

    atler_: around line 427, you find

            if self.compiler.find_library_file(lib_dirs,
                                                 'ncursesw'):
                readline_libs.append('ncursesw')
            elif self.compiler.find_library_file(lib_dirs,
                                                 'ncurses'):
    

    Replace that with

            if self.compiler.find_library_file(lib_dirs,
                                                 'ncurses'):
    

    (i.e. dropping the ncursesw part), and rebuild.

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 10, 2006

    Logged In: YES
    user_id=1497957

    loewis: removing lines refering to ncursesw solves the
    problem. ncurses.py runs fine as well as other programs.

    What is actual problem then? Something with ncursesw or
    with python?

    Anyway, Thanks for your help.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 10, 2006

    Logged In: YES
    user_id=21627

    That's hard to tell. Somebody would have to debug ncurses to
    find out why it crashes. Notice that it crashes only on some
    installations, so it is likely rather a problem with your
    ncurses installation, than with Python (or even with ncurses
    itself).

    @vnainar
    Copy link
    Mannequin Author

    vnainar mannequin commented Apr 11, 2006

    Logged In: YES
    user_id=1493752

    Removing 'ncursesw' (there are two references to it in
    'setup.py') seems to solve the problem. I noticed one more
    oddity. Even before the above recompilation , it ran fine
    on an Xterm !

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 11, 2006

    Logged In: YES
    user_id=21627

    Ah, ok. vnainar, atler_: What terminal had you been using to
    make it crash? What is your locale? Any other conditions
    that might be relevant (e.g. dimension of the terminal)?

    @vnainar
    Copy link
    Mannequin Author

    vnainar mannequin commented Apr 13, 2006

    Logged In: YES
    user_id=1493752

    Well , it is the linux console (in VGA mode ).
    The local is en_US.The size of the console is
    100X37.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 15, 2006

    Logged In: YES
    user_id=21627

    I couldn't reproduce the problem on a Linux console
    (although my console had a different size); so it remains
    unreproducable for me.

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 15, 2006

    Logged In: YES
    user_id=1497957

    Half day of debugging and it seems that I found an answer...
    just by accident ;).

    When curses module is linked against ncursesw it seems that
    it also should be linked against panelw not plain panel.
    After changing this in setup.py, ncurses.py demo finally
    runs fine.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 15, 2006

    Logged In: YES
    user_id=21627

    Good spotting! Can everybody please confirm that the
    attached patch fixes the problem?

    @atler
    Copy link
    Mannequin

    atler mannequin commented Apr 17, 2006

    Logged In: YES
    user_id=1497957

    /me confirms

    @psmedley
    Copy link
    Mannequin

    psmedley mannequin commented May 21, 2006

    Logged In: YES
    user_id=1359962

    I have a similar problem on OS/2.  When running any script
    that uses curses I get:
    [U:\dev\Python-2.4.3\PC\os2emx]python test_curses.py
    Traceback (most recent call last):
      File "test_curses.py", line 242, in ?
        curses.wrapper(main)
      File "U:/DEV/PYTHON-2.4.3/Lib/curses/wrapper.py", line 49,
    in wrapper
        curses.nocbreak()
    _curses.error: nocbreak() returned ERR

    If I remove the reference to nocbreak() from wrapper.py, I
    get the same error but in endwin(), removing endwin() from
    wrapper.py, I get an error in cbreak(), removing cbreak()
    then some scripts work.

    For example, from the demo folder, all work exceptlife.py &
    xmas.py, which both return an error "_curses.error:
    nocbreak() returned ERR" on various line numbers.

    Seems certain curses functions are working correctly, others
    aren't.

    The patch in this bug does NOT make any difference here.

    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Aug 3, 2006

    Logged In: YES
    user_id=33168

    Andrew, could you apply this after the freeze is over?

    @akuchling
    Copy link
    Member

    Logged In: YES
    user_id=11375

    Sure.

    @akuchling
    Copy link
    Member

    Logged In: YES
    user_id=11375

    Committed to the trunk in rev. 51134.

    @akuchling
    Copy link
    Member

    Logged In: YES
    user_id=11375

    Committed to 2.4 branch in rev.51136.

    @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
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant