From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.bugs Subject: bug#18988: select failure with EINTR in guile-2.0.11 Date: Mon, 17 Nov 2014 18:11:06 +0000 Message-ID: <20141117181106.7deb8e59@bother.homenet> References: <20141107171809.5ff33de4@bother.homenet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1416247959 28141 80.91.229.3 (17 Nov 2014 18:12:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2014 18:12:39 +0000 (UTC) To: 18988@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Nov 17 19:12:28 2014 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XqQmm-0003BQ-Uq for guile-bugs@m.gmane.org; Mon, 17 Nov 2014 19:12:25 +0100 Original-Received: from localhost ([::1]:49571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQmm-0001MR-GC for guile-bugs@m.gmane.org; Mon, 17 Nov 2014 13:12:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQmc-0001Ar-NH for bug-guile@gnu.org; Mon, 17 Nov 2014 13:12:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqQmQ-0004Of-Q8 for bug-guile@gnu.org; Mon, 17 Nov 2014 13:12:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqQmQ-0004OY-NN for bug-guile@gnu.org; Mon, 17 Nov 2014 13:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XqQmQ-0001Hl-7X for bug-guile@gnu.org; Mon, 17 Nov 2014 13:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Chris Vine Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 17 Nov 2014 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18988 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 18988-submit@debbugs.gnu.org id=B18988.14162478734794 (code B ref 18988); Mon, 17 Nov 2014 18:12:02 +0000 Original-Received: (at 18988) by debbugs.gnu.org; 17 Nov 2014 18:11:13 +0000 Original-Received: from localhost ([127.0.0.1]:36562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqQlc-0001FE-Bz for submit@debbugs.gnu.org; Mon, 17 Nov 2014 13:11:12 -0500 Original-Received: from smtpout3.wanadoo.co.uk ([80.12.242.59]:33299 helo=smtpout.wanadoo.co.uk) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XqQlY-0001Et-An for 18988@debbugs.gnu.org; Mon, 17 Nov 2014 13:11:10 -0500 Original-Received: from bother.homenet ([95.146.110.34]) by mwinf5d41 with ME id GiB61p0010kaQNv03iB6my; Mon, 17 Nov 2014 19:11:06 +0100 X-ME-Helo: bother.homenet X-ME-Date: Mon, 17 Nov 2014 19:11:06 +0100 X-ME-IP: 95.146.110.34 Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id CBF528B1C7 for <18988@debbugs.gnu.org>; Mon, 17 Nov 2014 18:11:06 +0000 (GMT) In-Reply-To: <20141107171809.5ff33de4@bother.homenet> X-Mailer: Claws Mail 3.10.0 (GTK+ 2.24.25; i686-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7640 Archived-At: On looking at the code in filesys.c, it is evident that EINTR is not handled by select as described in the documentation, and that there are three solutions to this: 1. To do what the documentation says, and to handle EINTR by returning rather than by throwing a system-error exception ("[select] also returns if interrupted by a signal"). Pros: it probably matches what people have been coding to since that is what is currently (but wrongly) documented as happening; and it still provides an opportunity for a program relying on a timeout to decide what to do if the system call returns prematurely. Cons: It is very difficult for user code to restart the call with an appropriately reduced new timeout period representing the residue of the timeout period - but that is something users of select must expect anyway because a file descriptor becoming ready will have the same effect (and there is always the SA_RESTART flag). 2. To restart with an appropriately reduced timeout representing the residue of the timeout period. Pros: EINTR is handled seamlessly as if by SA_RESTART. Cons: Although linux modifies the timeout argument on returning to indicate the unexpired period of a timeout, I believe the BSDs do not (I have no idea what windows does). For OSs that do not provide this information, there are two sub-choices - behave as in 1 above, or to just restart and accept that the timeout might be much delayed in the presence of interrupts by wrapping the select call with SCM_SYSCALL (in theory, on a long timeout with many interrupts, the timeout may never occur at all). 3. To correct the documentation but leave select throwing an exception on an interrupt occuring, by saying in the documentation that rather than select returning, it throws a system-error exception with errno set to EINTR. On balance I would go for 1 above. I am happy to submit a patch, but won't do so unless I know that that is the behaviour that is wanted.