0 Replies Latest reply: Aug 19, 2010 4:37 PM by 807567 RSS

    Python crashes.  Core dump inside xcurses2/tgetent(): cur_term is nil

    807567
      I tried to build latest Python sources with Sun C compiler on Solaris snv_145 (sparc or x86)
      There is no issue to build the binary, but then Python's
      harness runs it as: 'python -E ./setup.py build' it core dumps.
      Actually, Python's version and Sun compiler versions are not essential.
      I tried viariety of them, and all produce the same core dump.

      I ran dbx with this and pinpointed the place:

      At some moment python binary calls rlinit_terminal_io() from
      open source readline.so library, which in turn invokes kernel's tgetent()
      function from libcurses.so.2. That tgetent() function crashes on the
      following line where cur_term is nil:

      if (strcmp(cur_term->_term, name) == 0)

      The top of crashed stack looks like this:

      ========================
      t@1 (l@1) signal SEGV (no mapping at the fault address) in tgetent at line 65 in file "tgetent.c"
      65      if (strcmp(cur_term->_term, name) == 0)
      (dbx) print name
      name = 0x8047a4d "sun-cmd"
      (dbx) print cur_term
      cur_term = (nil)
      (dbx) where
      current thread: t@1
      =>[1] tgetent(buffer = 0x8786dd0 "", name = 0x8047a4d "sun-cmd"), line 65 in "tgetent.c"
      [2] rlinit_terminal_io(terminal_name = 0x8047a4d "sun-cmd"), line 460 in "terminal.c"
      [3] readline_initialize_everything(), line 1066 in "readline.c"
      [4] rl_initialize(), line 968 in "readline.c"
      [5] setup_readline(), line 884 in "readline.c"
      [6] PyInit_readline(), line 1133 in "readline.c"
      [7] PyImportLoadDynamicModule(name = 0x8747698 "readline", pathname = 0x8656e38 "build/lib.solaris-2.11-i86pc-3.2-pydebug/readline.so", fp = (nil)), line 57 in "importdl.c"
      ......
      ===================


      May be to prevent this crash I need to define some
      environment variable which ultimately will initialize 'cur_term' global?

      Please advise.