Share

zsh

Tracker: Bugs

5 zsh exits when pressing up/down arrow keys very fast - ID: 2808797
Last Update: Comment added ( blufox )

zsh exits if I press the up/down arrow and hold it there (or do that very
fast for some 100 lines)

zsh --version
zsh 4.3.10 (i386-pc-solaris2.10)

|uname -a
SunOS webstack 5.10 Generic_127128-11 i86pc i386 i86pc

My history contains about 150 commands
|cat ~/.zsh_history.webstack | wc -l
148


Rahul G Nair ( blufox ) - 2009-06-19 04:44

5

Open

None

Nobody/Anonymous

Core shell

None

Public


Comment ( 1 )




Date: 2009-06-19 04:49
Sender: blufox

Running a dtrace on it gives me this output,

6 -> getkeycmd
6 -> getkeymapcmd
6 -> getkeybuf
6 -> getbyte
6 -> raw_getbyte
6 -> calc_timeout
6 <- calc_timeout
6 <- raw_getbyte
6 -> zexit
6 -> killrunjobs
6 <- killrunjobs
6 -> saveandpophiststack
6 <- saveandpophiststack
6 -> savehistfile

Since I do not get any errors before exiting, I assume this portion is to
blame, (And my OS is SunOS)

/**/
mod_export int
getbyte(long do_keytmout, int *timeout)
{
char cc;
unsigned int ret;
int die = 0, r, icnt = 0;
int old_errno = errno, obreaks = breaks;

if (timeout)
*timeout = 0;

#ifdef MULTIBYTE_SUPPORT
/*
* Reading a single byte always invalidates the status
* of lastchar_wide. We may fix this up in getrestchar
* if this is the last byte of a wide character.
*/
lastchar_wide_valid = 0;
#endif

if (kungetct)
ret = STOUC(kungetbuf[--kungetct]);
else {
#ifdef FIONREAD
if (delayzsetterm) {
int val;
ioctl(SHTTY, FIONREAD, (char *)&val);
if (!val)
zsetterm();
}
#endif
for (;;) {
int q = queue_signal_level();
dont_queue_signals();
r = raw_getbyte(do_keytmout, &cc);
restore_queue_signals(q);
if (r == -2) {
/* timeout */
if (timeout)
*timeout = 1;
return lastchar = EOF;
}
if (r == 1)
break;
if (r == 0) {
/* The test for IGNOREEOF was added to make zsh ignore ^Ds
that were typed while commands are running. Unfortuantely
this caused trouble under at least one system (SunOS 4.1).
Here shells that lost their xterm (e.g. if it was killed
with -9) didn't fail to read from the terminal but instead
happily continued to read EOFs, so that the above read
returned with 0, and, with IGNOREEOF set, this caused
an infinite loop. The simple way around this was to add
the counter (icnt) so that this happens 20 times and than
the shell gives up (yes, this is a bit dirty...). */
if ((zlereadflags & ZLRF_IGNOREEOF) && icnt++ < 20)
continue;
stopmsg = 1;
=====>zexit(1, 0);
}
icnt = 0;
if (errno == EINTR) {
die = 0;
if (!errflag && !retflag && !breaks)
continue;
errflag = 0;
breaks = obreaks;
errno = old_errno;
return lastchar = EOF;
} else if (errno == EWOULDBLOCK) {
fcntl(0, F_SETFL, 0);
} else if (errno == EIO && !die) {
ret = opts[MONITOR];
opts[MONITOR] = 1;
attachtty(mypgrp);
zrefresh(); /* kludge! */
opts[MONITOR] = ret;
die = 1;
} else if (errno != 0) {
zerr("error on TTY read: %e", errno);
stopmsg = 1;
zexit(1, 0);
}
}



Log in to comment.

Attached File ( 1 )

Filename Description Download
out truss output when the exit happened Download

Change ( 1 )

Field Old Value Date By
File Added 331529: out 2009-06-19 04:45 blufox