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

Re: up-arrow no longer works right



On Fri, 20 Mar 2009 20:52:12 +0300
Andrey Borzenkov <arvidjaar@xxxxxxxxx> wrote:
> Actually zsh explicitly contains code to retry failed system call:
> 
> # ifdef HAVE_TCGETATTR
> #  ifndef TCSADRAIN
> #   define TCSADRAIN 1  /* XXX Princeton's include files are screwed up 
> */
> #  endif
>         tcsetattr(SHTTY, TCSADRAIN, &ti->tio);
>         while (tcsetattr(SHTTY, TCSADRAIN, &ti->tio) == -1 && errno == 
> EINTR)
>             ;
> # else
>         ioctl(SHTTY, TCSETS, &ti->tio);
>         while (ioctl(SHTTY, TCSETS, &ti->tio) == -1 && errno == EINTR)
> # endif
>         /*      zerr("settyinfo: %e",errno)*/ ;
> 
> (looks like somewhat misplaced `;' but this should not be the reason).

This was a fairly recent change, however.  I'm not sure why the
tcsettattr() occurs twice, now I look again, but it's not occurring
twice in Vincent's trace, as it would with the new code.  Older code
would print the message "bad tcgets", though.

2009-03-02  Peter Stephenson  <pws@xxxxxxx>

	* Lionel Flandrin: 26625: Src/utils.c: inopportune interrupt
	could wreck terminal set up.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.214
diff -u -r1.214 utils.c
--- Src/utils.c	15 Mar 2009 01:04:51 -0000	1.214
+++ Src/utils.c	20 Mar 2009 20:27:57 -0000
@@ -1442,14 +1442,13 @@
 #  ifndef TCSADRAIN
 #   define TCSADRAIN 1	/* XXX Princeton's include files are screwed up */
 #  endif
-	tcsetattr(SHTTY, TCSADRAIN, &ti->tio);
 	while (tcsetattr(SHTTY, TCSADRAIN, &ti->tio) == -1 && errno == EINTR)
 	    ;
 # else
-	ioctl(SHTTY, TCSETS, &ti->tio);
 	while (ioctl(SHTTY, TCSETS, &ti->tio) == -1 && errno == EINTR)
+	    ;
 # endif
-	/*	zerr("settyinfo: %e",errno)*/ ;
+	/*	zerr("settyinfo: %e",errno);*/
 #else
 # ifdef HAVE_TERMIO_H
 	ioctl(SHTTY, TCSETA, &ti->tio);


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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