zsh-workers
 help / color / mirror / code / Atom feed
* zsh 4.3.9: Interrupted "tcsetattr" call problem, tiling-wm related
@ 2009-02-27 16:20 Lionel Flandrin
  2009-03-02 10:23 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Lionel Flandrin @ 2009-02-27 16:20 UTC (permalink / raw)
  To: zsh-workers

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:
http://www.zsh.org/mla/workers/2007/msg01121.html

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));
     fclose(f);
  }

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-02 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-27 16:20 zsh 4.3.9: Interrupted "tcsetattr" call problem, tiling-wm related Lionel Flandrin
2009-03-02 10:23 ` Peter Stephenson
2009-03-02 16:01   ` Bart Schaefer
2009-03-02 16:15     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).