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

Re: Remaining zsh3.0-pre2 bugs



On Jul 6,  3:59pm, Huy Le wrote:
} Subject: Remaining zsh3.0-pre2 bugs
}
} Here are some bugs that I've reported but still remain in the latest
} version of zsh.
} The apply for both HP-UX 9.01 and IRIX 5.3
} 
} 3. tty bug #2
} When tty output of "less" or "more" is suspended because it's in the
} background, after "fg"ing my tty settings are reset to default.
} This problem is hard because on HP-UX it is intermittent; happens more
} regularly on IRIX. [...]
} 
} acro% stty -a
} speed 38400 baud; line = 1;
} intr = ^C; quit = ^@; erase = DEL; kill = ^U; eof = ^D; eol = ^@; old-swtch = ^Z; susp = ^@
}     [other stty output snipped]
} [less pauses after one page-full; I hit 'q']
} acro% stty -a
} speed 38400 baud; line = 1;
} intr = ^C; quit = ^@; erase = DEL; kill = ^U; eof = ^A; eol = ^@; old-swtch = ^@; susp = ^@
} [other stty output snipped]

I've described this problem before, and the solution as well.  If
you look at <termio.h> or <termios.h> for the indices into the c_cc[]
array in the struct termio or termios, you'll discover that some of
the array positions are overloaded.  In particular, VEOF is the same
as VMIN, and VEOL is the same as VTIME.  Thus you can't use the same
struct termios to set/get the VMIN and VTIME values as well as the
TTY driver characters; you have to set and get VMIN and VTIME with
a separate structure and a separate ioctl() or tcsetattr() call.

The rule is, when (c_lflag & ICANON) then c_cc[VEOF] and c_cc[VEOL]
are valid, otherwise c_cc[VMIN] and c_cc[VTIME] are valid.

Zsh is still trying to get by with a single struct termios, which is
OK most of the time because the global shttyinfo always has ICANON,
and functions like setcbreak() and setterm() are careful to change
only a local copy of shttyinfo when setting VMIN and VTIME, so that
the right characters are restored later.  However, this can cause a
bit of confusion when what looks like a perfectly valid operation
turns out to do something unexpected.

See if this patch fixes the above bug.

*** Src/zle_main.c.orig	Fri Jul  5 10:57:47 1996
--- Src/zle_main.c	Sat Jul  6 22:04:29 1996
***************
*** 276,282 ****
  #  endif
  	    r = read(SHTTY, &cc, 1);
  #  ifdef HAVE_TERMIOS_H
! 	    tcsetattr(SHTTY, TCSANOW, &ti.tio);
  #  else
  	    ioctl(SHTTY, TCSETA, &shttyinfo.tio);
  #  endif
--- 276,282 ----
  #  endif
  	    r = read(SHTTY, &cc, 1);
  #  ifdef HAVE_TERMIOS_H
! 	    tcsetattr(SHTTY, TCSANOW, &shttyinfo.tio);
  #  else
  	    ioctl(SHTTY, TCSETA, &shttyinfo.tio);
  #  endif

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"




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