Menu

#35 15.1 on HP-UX: SEGV building cross-reference (interactive)

closed-fixed
None
5
2001-06-29
2001-02-09
Nick Dixon
No

HP-UX B.10.20, managed to compile on this platform (see bug 128059) but cscope produces a memory fault when run in interactive mode:

Steps to re-create:
cd src
rm cscope.out
./cscope scanner.c

Building symbol database 20
Memory fault(coredump)

SEGV occurs in progress() [display.c:561] addch(inch());
progress ("Building symbol database", 20, 31)

This only happens when creating or updating the cross-reference in interactive mode;
there's no SEGV in line-mode, or when running with -b, or when making *some* small updates to the cross-ref, eg:

cscope -b scanner.c # okay
cscope lookup.c # BANG!
cscope scanner.c lookup.c # but this works

Discussion

  • Nick Dixon

    Nick Dixon - 2001-02-12

    Oleo uses the same technique to highlight text, so this must be some flakiness in the HP-UX curses library...
    As a workaround, I put #ifdef 0 .. #endif around the "addch(inch))" line; so I won't see a progress bar, but at least it doesn't fall over.

     
  • Hans-Bernhard Broeker

    Logged In: YES
    user_id=27517

    Hmm... disabling the offending line of code altogether seems
    a bit harsh a cure. But upon closer inspection, I think
    that one possible reason could be that addch() and inch()
    both might be macros, which might break in this particular
    type of invocation.

    Can you please test whether replacing the offending line by:

    \{ 
       chtype temp = inch\(\);
       addch\(temp\);
    \}
    

    gets rid of the problem?

     
  • Hans-Bernhard Broeker

    • assigned_to: nobody --> broeker
    • status: open --> open-accepted
     
  • Nick Dixon

    Nick Dixon - 2001-06-27

    Logged In: YES
    user_id=150065

    Can't easily reproduce this now (I trashed my source area ages ago, and can't remember all the steps I did to make it compile on HP-UX - the stuff written here doesn't quite do it) but I do remember trying:

    chtype wibble = inch();
    addch(wibble);

    and seeing that fail too; on the inch(), I think.

    On HPUX 10.20:
    inch() is #defined as winch(stdscr)
    and
    addch(ch) is #defined as waddch(stdscr, ch)

     
  • Nick Dixon

    Nick Dixon - 2001-06-29

    Logged In: YES
    user_id=150065

    Solved this now: inch()/winch() is broken in the HP curses library. A simple test confirms this:

    #include <curses.h>
    void main(int argc, char *argv[])
    {
    WINDOW *w = initscr();
    chtype temp = inch();
    endwin();
    }

    There are "cumulative patches" for HP-UX (10.10, 10.20 & 10.30) which introduce /usr/lib/libHcurses.{a,sl} - if I build cscope with

    CURSES_LIBS = -lHcurses

    I get the progress bar as intended, and no SEGV.

    On HP-UX, the shared library /usr/lib/libcurses.sl is symlinked to libxcurses.1, which is the broken library.

    So the 'configure' script should probably check for libHcurses and modify the CURSES_LIBS setting accordingly.
    (or at least support a --with-hcurses option)

     
  • Hans-Bernhard Broeker

    • status: open-accepted --> closed-fixed
     
  • Hans-Bernhard Broeker

    Logged In: YES
    user_id=27517

    Sigh --- why couldn't they just fix their broken curses for
    good, for heaven's sake?

    HP really sUX as much as I rumour has it, it seems :-(

    I'll put a recommendation into the README or INSTALL
    containing the make CURSES_LIBS=-lHcurses trick, then.

    Bug closed.

     

Log in to post a comment.