From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13676 invoked by alias); 22 Apr 2011 05:53:17 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15985 Received: (qmail 29545 invoked from network); 22 Apr 2011 05:53:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110421225257.ZM14169@torch.brasslantern.com> Date: Thu, 21 Apr 2011 22:52:57 -0700 In-reply-to: <110421200715.ZM12476@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Signal handling/zcurses" (Apr 21, 8:07pm) References: <20110420101911.GA6357@layslair.ath.cx> <110420074048.ZM16389@torch.brasslantern.com> <20110420192234.GB6357@layslair.ath.cx> <110421014823.ZM17325@torch.brasslantern.com> <20110421143145.GC6357@layslair.ath.cx> <110421084717.ZM11635@torch.brasslantern.com> <20110421180801.GD6357@layslair.ath.cx> <110421200715.ZM12476@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Signal handling/zcurses MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 21, 8:07pm, Bart Schaefer wrote: } } Interestingly, I'm able to reproduce your result with the script you } sent -- in spite of the fact that (a) Linux normally has restartable } system calls (b) the doc says that "Under the ncurses implementation, } handled signals never interrupt getch" and (c) my zsh is linked with } -lncursesw so this really should work. This gets odder. If you interrupt "zcurses input" with a handled signal, wget_wch() [and I must assume wgetch()] returns ERR/EINTR. The loop in my patch then calls it again and gets ERR/zero, which causes "zcurses input" to return 1. Run "zcurses input" again immediately, and it again gets ERR/zero without ever calling read(). Run it *again* and not only does wget_wch() block waiting for input, but now it restarts properly after a handled signal! Give it some input so it returns success and the script-level loop in the test goes around and wget_wch() is called a fifth time, and now it has returned to the state where it gets interrupted by handled signals. I was trying all this inside of GDB so I suppose that might have side- effects, but this is damned peculiar.