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

zsh 4.3.9: Interrupted "tcsetattr" call problem, tiling-wm related

Hi everybody, I haven't subscribed to this list so please include me
in Cc in your replies.

I think I have spotted a bug related to this one:

Basically, *sometimes* I get an unusable prompt when I start a new
terminal, if I type <TAB> I get a litteral tab, if I type "key up" I
get ^[[A etc...

A strace told me the problem is that the terminal bufferizes the
output line by line, i.e. is in ICANON termios mode.

A couple of grep and dirty fprintf in the source code later, I think
I've found the root of the problem at Src/utils.c line 1440:

1440          tcsetattr(SHTTY, TCSADRAIN, &ti->tio);
1441      /* if (tcsetattr(SHTTY, TCSADRAIN, &ti->tio) == -1) */

(It's interresting that the bugfix is almost already there :).

Indeed, the problem seems to be that I use a tiling WM (stumpwm) that
resizes the term as soon as it's created, sending (I'm just guessing
there) the SIGWINCH signal to zsh interrupting the tcsetattr.

If I add some debug code:

  while (tcsetattr(SHTTY, TCSADRAIN, &ti->tio) == -1)
     FILE *f = fopen("/tmp/fail.out", "a");
     fprintf(f, "tcsetattr failed: %s\n", strerror(errno));

I do get: "tcsetattr failed: Interrupted system call"

If I change the call to:

  while (tcsetattr(SHTTY, TCSADRAIN, &ti->tio) == -1 && errno == EINTR);

It fixes the problem.

I hope this helps.

(Thank to ft on freenode's #zsh for his help).

Lionel Flandrin

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