Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

bodgy COLUMNS coredump



Heyla,
  to get zsh to coredump on command.
% COLUMNS=1

Here's a patch, though I'm not very happy with it.  It provides more of a 
kludge than a clean fix.  Testing this also unveiled another bug (coredump) in
hist.c:620  hbegin->zsfree->zfree  which I haven't looked at yet.  I got this
by taking my xterm window down to 1 or 2 columns.
One interesting thing that happened to me was gdb coredumped while loading up
zsh & zsh.core :-)
I won't have much time in the next couple of weeks to look at this, but if
someone hasn't cleaned it up by then, I'll see what I can do then.



*** zsh.h	1996/08/15 16:41:25	2.44
--- zsh.h	1996/08/23 04:12:14
***************
*** 1246,1252 ****
  #define txtchangeisset(X)	(txtchange & (X))
  #define txtchangeset(X, Y)	(txtchange |= (X), txtchange &= ~(Y))
  
! #define COLUMNS      (columns < 1 ? 80 : columns)
  
  /****************************************/
  /* Definitions for the %_ prompt escape */
--- 1246,1252 ----
  #define txtchangeisset(X)	(txtchange & (X))
  #define txtchangeset(X, Y)	(txtchange |= (X), txtchange &= ~(Y))
  
! #define COLUMNS      (columns < 2 ? 80 : columns)
  
  /****************************************/
  /* Definitions for the %_ prompt escape */

*** init.c	1996/08/13 20:36:44	2.39
--- init.c	1996/08/23 03:59:53
***************
*** 541,546 ****
--- 541,547 ----
      columns = 80;
      lines = 24;
  #endif
+     columns = COLUMNS;		/* sanity */
  
      /* The following variable assignments cause zsh to behave more *
       * like Bourne and Korn shells when invoked as "sh" or "ksh".  *

*** utils.c	1996/08/14 16:21:47	2.51
--- utils.c	1996/08/23 04:00:09
***************
*** 841,846 ****
--- 841,847 ----
      ioctl(SHTTY, TIOCGWINSZ, (char *)&shttyinfo.winsize);
      if (shttyinfo.winsize.ws_col)
  	columns = shttyinfo.winsize.ws_col;
+     columns = COLUMNS;		/* sanity */
      if (shttyinfo.winsize.ws_row)
  	lines = shttyinfo.winsize.ws_row;
      if (oldcols != columns) {

*** zle_refresh.c	1996/08/12 01:39:05	2.13
--- zle_refresh.c	1996/08/23 04:17:41
***************
*** 66,72 ****
      int ln;
      static int lwinw = -1, lwinh = -1;	/* last window width & height */
   
!     winw = COLUMNS;  /* terminal width */
      if (isset(SINGLELINEZLE) || termok != TERM_OK)
  	winh = 1;
      else
--- 66,73 ----
      int ln;
      static int lwinw = -1, lwinh = -1;	/* last window width & height */
   
!     columns = COLUMNS;		/* sanity */
!     winw = COLUMNS; 		/* terminal width */
      if (isset(SINGLELINEZLE) || termok != TERM_OK)
  	winh = 1;
      else
***************
*** 247,253 ****
  	    moveto(0, pptw);
  	}
  	clearf = clearflag;
!     } else if (winw != COLUMNS)
  	resetvideo();
  
  /* now winw equals columns; now all width comparisons can be made to winw */
--- 248,254 ----
  	    moveto(0, pptw);
  	}
  	clearf = clearflag;
!     } else if (winw != columns)
  	resetvideo();
  
  /* now winw equals columns; now all width comparisons can be made to winw */
***************
*** 546,562 ****
      if (hasam && vcs == winw) {
  	vln++, vcs = 1;
  	putc(*nbuf[vln], shout);
! 	nl++;
! 	if (*ol)
! 	    ol++;
! 	ccs = 1;
      }
  
  /* 3: main display loop - write out the buffer using whatever tricks we can */
  
      for (;;) {
! 	if (*nl && nl[1] == ol[1])	/* skip only if second chars match */
! 	/* skip past all matching characters */
  	    for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
  
  	if (!*nl) {
--- 547,565 ----
      if (hasam && vcs == winw) {
  	vln++, vcs = 1;
  	putc(*nbuf[vln], shout);
! 	if (!*ol) {
! 	    ol = halloc(2);
! 	    *ol = *nl;
! 	    ol[1] = '\0';
! 	}
      }
  
  /* 3: main display loop - write out the buffer using whatever tricks we can */
  
      for (;;) {
! 	if (*nl && *ol && (nl[1] == ol[1] || (ccs + 1 == vcs)))
! 	/* if second characters match or the cursor is on the second character
! 	   skip past all matching characters */
  	    for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
  
  	if (!*nl) {

-- 
Geoff Wing [mason@xxxxxxxxxxxxxxx]   PrimeNet - Internet Consultancy
  Web: http://www.primenet.com.au/   Facsimile: +61-3-9819 3788



Messages sorted by: Reverse Date, Date, Thread, Author