Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#226 seg. fault in linemode when resizing terminal

None
closed-works-for-me
Neil Horman
None
5
2013-09-09
2008-02-12
Jiyong Jung
No

I always use cscope with vim.
cscope is executed with following command. (checked with 'ps')
cscope -dl -f cscope.out

It always happens when I resize my terminal(putty).

Backtrace ----
(gdb) where
#0 0x000000353022ca9f in ungetch (ch=410) at ../../ncurses/base/lib_ungetch.c:63
#1 <signal handler called>
#2 0x0000003c355b9a92 in __read_nocancel () from /lib64/tls/libc.so.6
#3 0x0000003c35565422 in _IO_file_read_internal () from /lib64/tls/libc.so.6
#4 0x0000003c355646fd in _IO_new_file_underflow () from /lib64/tls/libc.so.6
#5 0x0000003c3556652e in _IO_default_uflow_internal () from /lib64/tls/libc.so.6
#6 0x0000003c3555bd1d in _IO_getline_info_internal () from /lib64/tls/libc.so.6
#7 0x0000003c3555ab43 in fgets () from /lib64/tls/libc.so.6
#8 0x0000000000412d2c in main (argc=5681232, argv=0x51) at main.c:610

I think that WINCH signal handling is the problem. No seg. fault occured after I moved following code, which sets WINCH signal handling, into the "if (linemode == NO) {" block in main.c.

----
#if defined(KEY_RESIZE) && !defined(__DJGPP__)
winch_action.sa_sigaction = sigwinch_handler;
sigemptyset(&winch_action.sa_mask);
winch_action.sa_flags = SA_SIGINFO;
sigaction(SIGWINCH,&winch_action,NULL);
#endif
----

I use cscope-15.6 / vim-7.1 / CentOS 4.5.

Discussion

  • Neil Horman
    Neil Horman
    2008-02-14

    Logged In: YES
    user_id=827328
    Originator: NO

    Its not so much a problem with WINCH signal handling. It appears to be a problem with your ncurses library. You cll the WINCH signal handler whenever you resize a window, and the handler calls ungetch to push a resize event onto the input stream, so that the cscope code will redraw itself in the new window. This stack pretty clarly shows that youre inside the ncurses library when the crash happens. My guess would be that your ncurses library has a bug somewhere in ungetch. What version is it? You might try seeing if an update is available from CentOS, or, barring that, looking at getting an updated package from Fedora (Or just rebuilding the latest source from Red Hat), if CentOS hasn't kept up with RHEL4 updates

     
  • Neil Horman
    Neil Horman
    2008-04-10

    • assigned_to: nobody --> nhorman
     
  • hi there,

    as a workaround you can "set cscopeprg=setsid\ cscope" in vim. then cscope is invoked in a new session and does not receive the SIGWINCH when the vim window is resized.

    regards,
    chressie

     
  • Neil Horman
    Neil Horman
    2013-09-09

    • status: open --> closed-works-for-me
    • Group: -->
     
  • Neil Horman
    Neil Horman
    2013-09-09

    No response, closing...