Subject: Re: lib/36702: vi crashes on window resizes due to bug in curses
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Julian Coleman <jdc@coris.org.uk>
List: netbsd-bugs
Date: 08/02/2007 12:10:03
The following reply was made to PR lib/36702; it has been noted by GNATS.

From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@NetBSD.org, erh@swapsimple.com
Cc: 
Subject: Re: lib/36702: vi crashes on window resizes due to bug in curses
Date: Thu, 2 Aug 2007 13:09:40 +0100

 > When resizing the window (xterm) vi occasionally crashes.  It doesn't
 > happen very often, but is fairly easy to reproduce by quicking and
 > repeatedly making the window larger.
 
 I'm having some difficulty reproducing the crash.  If you could gather some
 more information, that would be helpful.
 
 > I also get (non-fatal) errors that look like 
 > "Error: move: l(35) c(0) o(0)"
 > when shrinking the screen, but I don't know if those are related.
 
 This is from vi (src/usr.bin/vi/cl/cl_funcs.c).  I guess that it is caused
 by two screen resizes that occur too quickly.  I also see this sometimes.
 
 Thanks for the useful debug information:
 
 > (gdb) print bot
 > $2 = 41
 
 'bot' is set from '__virtscr->maxy' on line 1219.  So, I assume that this
 has the value 41.  However, I'm puzzled that curscr->maxy is 39 ...
 
 > (gdb) print *curscr
 > $6 = {nextp = 0x8092280, orig = 0x0, begy = 0, begx = 0, cury = 0, curx = 0,
 >   maxy = 39, maxx = 85, reqy = 39, reqx = 85, ch_off = 0, lines = 0x80d1200,
 
 ... as src/lib/libcurses/resize.c:resizeterm() should loop through all the
 windows (see loop starting at resize.c:122).
 
 If you could set the environment variables:
 
   CURSES_TRACE_FILE=__curses.out
   CURSES_TRACE_MASK=0x14
 
 and make it crash again, the output might be useful (see ctrace.c and
 curses_private.h for the use of CURSES_TRACE_*).
 
 One guess is that curscr is being resized independently of __virtscr -
 if the terminal shrinks, that might cause this.  Hopefully, the debug from
 the functions in resize.c might give more of a clue.
 
 Thanks,
 
 J
 
 -- 
   My other computer also runs NetBSD    /        Sailing at Newbiggin
         http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/