On 2013-06-05 11:23 +0200, Thomas Dickey wrote:

> On Wed, Jun 05, 2013 at 12:57:52AM +0200, Adam Borowski wrote:
>> Package: libtinfo5
>> Version: 5.9+20130504-1
>> Severity: normal
>> 
>> 
>> If you run a program that uses tgetent() -- at least bash and gdb, with
>
> They both use readline, which has its own problems :-)
>
>> TERM=KBtin, it will segfault on startup.  Its terminfo definition can be
>> found in package "kbtin", or by tic-ing:
>
> A traceback would be helpful.

Here you go:

,----
| (gdb) bt full
| #0  0xf7fa7683 in tgetent (
|     bufp=0x815c008 '\337' <repeats 199 times>, <incomplete sequence \337>..., 
|     name=0x8143e28 "kbtin")
|     at 
/build/buildd-ncurses_5.9+20130504-1-i386-jLNieE/ncurses-5.9+20130504/ncurses/tinfo/lib_termcap.c:166
|         rc = 1
|         n = <optimized out>
| #1  0x080f912e in _rl_init_terminal_io (terminal_name=0x0)
|     at ../../../bash/lib/readline/terminal.c:452
|         term = 0x8143e28 "kbtin"
|         buffer = 0x8150008 '\337' <repeats 199 times>, <incomplete sequence 
\337>...
|         tty = 0
|         tgetent_ret = 0
| #2  0x080f8f08 in _rl_set_screen_size (rows=40, cols=100)
|     at ../../../bash/lib/readline/terminal.c:312
| No locals.
| #3  0x080f8f73 in rl_set_screen_size (rows=40, cols=100)
|     at ../../../bash/lib/readline/terminal.c:331
| No locals.
| #4  0x080e0179 in get_new_window_size (from_sig=0, rp=0x0, cp=0x0)
|     at ../../../bash/lib/sh/winsize.c:88
|         win = {ws_row = 40, ws_col = 100, ws_xpixel = 915, ws_ypixel = 604}
|         tty = 255
| #5  0x08088be8 in get_tty_state () at ../bash/jobs.c:2030
|         tty = 255
| #6  0x0805f395 in main (argc=1, argv=0xffffd494, env=0xffffd49c) at 
../bash/shell.c:739
|         i = -134668300
|         code = 0
|         old_errexit_flag = 0
|         saverst = 0
|         locally_skip_execution = 0
|         arg_index = 1
|         top_level_arg_index = 1
| (gdb) 
`----

On 2013-06-05 00:57 +0200, Adam Borowski wrote:

> I haven't excluded the possibility something else it to blame, but debugging
> through tinfo's code is a pain: it's layers upon layers of macros.  At
> least, at the time of segfault, the values in cur_term are bogus.

Same here:

,----
| (gdb) print cur_term->type
| $8 = {term_names = 0xcfcfcfcf <Address 0xcfcfcfcf out of bounds>, 
|   str_table = 0xcfcfcfcf <Address 0xcfcfcfcf out of bounds>, 
|   Booleans = 0xcfcfcfcf <Address 0xcfcfcfcf out of bounds>, Numbers = 
0xcfcfcfcf, 
|   Strings = 0xcfcfcfcf, ext_str_table = 0xcfcfcfcf <Address 0xcfcfcfcf out of 
bounds>, 
|   ext_Names = 0xcfcfcfcf, num_Booleans = 53199, num_Numbers = 53199, 
num_Strings = 53199, 
|   ext_Booleans = 53199, ext_Numbers = 53199, ext_Strings = 53199}
| (gdb)
`----

Looking at the offending line 166 in ncurses/tinfo/lib_termcap.c, it
tries to read cursor_left which is #defined to cur_term->type.Strings[14]:

,----
| (gdb) print cur_term->type.Strings[14]
| Cannot access memory at address 0xcfcfd007
| (gdb)
`----

No wonder that it segfaults, but why cur_term has these bogus values…
you're the expert. :-)

Cheers,
       Sven


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to