From unknown Fri Jun 20 05:35:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30368 <30368@debbugs.gnu.org> To: bug#30368 <30368@debbugs.gnu.org> Subject: Status: =?UTF-8?Q?=E2=80=98select=E2=80=99?= returns non-empty sets upon EINTR or EAGAIN Reply-To: bug#30368 <30368@debbugs.gnu.org> Date: Fri, 20 Jun 2025 12:35:36 +0000 retitle 30368 =E2=80=98select=E2=80=99 returns non-empty sets upon EINTR or= EAGAIN reassign 30368 guile submitter 30368 ludo@gnu.org (Ludovic Court=C3=A8s) severity 30368 important thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 06 05:39:47 2018 Received: (at submit) by debbugs.gnu.org; 6 Feb 2018 10:39:47 +0000 Received: from localhost ([127.0.0.1]:59565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ej0fC-0006EE-W1 for submit@debbugs.gnu.org; Tue, 06 Feb 2018 05:39:47 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ej0fB-0006E0-HN for submit@debbugs.gnu.org; Tue, 06 Feb 2018 05:39:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej0f5-00012f-6c for submit@debbugs.gnu.org; Tue, 06 Feb 2018 05:39:40 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej0f5-00012Y-2g for submit@debbugs.gnu.org; Tue, 06 Feb 2018 05:39:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej0f3-0001kb-Tm for bug-guile@gnu.org; Tue, 06 Feb 2018 05:39:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej0ey-0000yu-WD for bug-guile@gnu.org; Tue, 06 Feb 2018 05:39:37 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:33734) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej0ey-0000yI-Na for bug-guile@gnu.org; Tue, 06 Feb 2018 05:39:32 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 369589EF4 for ; Tue, 6 Feb 2018 11:39:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NUI8GNhcuEBr for ; Tue, 6 Feb 2018 11:39:30 +0100 (CET) Received: from ribbon (unknown [193.50.110.200]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7A5CC6FF0 for ; Tue, 6 Feb 2018 11:39:30 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: bug-guile@gnu.org Subject: =?utf-8?B?4oCYc2VsZWN04oCZ?= returns non-empty sets upon EINTR or EAGAIN X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 18 =?utf-8?Q?Pluvi=C3=B4se?= an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 06 Feb 2018 11:39:30 +0100 Message-ID: <87y3k67671.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, As of Guile 2.2.3, the Scheme-level =E2=80=98select=E2=80=99 can return non= -empty sets when the C-level =E2=80=98select=E2=80=99 returns EINTR or EAGAIN. The pro= gram below illustrates this: --8<---------------cut here---------------start------------->8--- (use-modules (ice-9 match)) (sigaction SIGINT (lambda args (pk 'signal! args))) (let ((target (getpid))) (match (primitive-fork) ((? zero?) (sleep 4) (kill target SIGINT) (primitive-exit 0)) (_ #t))) (match (select (list (current-input-port)) '() '()) (((port) () ()) (pk 'reading-from port) (read-char port)) (lst (pk 'done lst))) --8<---------------cut here---------------end--------------->8--- On 2.2.3, it prints: --8<---------------cut here---------------start------------->8--- $ guile select.scm ;;; (signal! (2)) ;;; (reading-from #) --8<---------------cut here---------------end--------------->8--- >From there on it=E2=80=99s stuck in a read(0, =E2=80=A6) call. The attached patch fixes it by clearing the returned FD sets on EINTR/EAGAIN. (Besides it seems that select(2) never returns EAGAIN.) I=E2=80=99m not sure how to write a test for this; the one above is timing-sensitive, which wouldn=E2=80=99t be great. Thoughts? Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/libguile/filesys.c b/libguile/filesys.c index e39dc4a0d..05dd2bd16 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -1,5 +1,5 @@ /* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, - * 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Free Software Foundation, Inc. + * 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2018 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -900,10 +900,20 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0, int rv = scm_std_select (max_fd + 1, &read_set, &write_set, &except_set, time_ptr); - /* Let EINTR / EAGAIN cause a return to the user and let them loop - to run any asyncs that might be pending. */ - if (rv < 0 && errno != EINTR && errno != EAGAIN) - SCM_SYSERROR; + if (rv < 0) + { + /* Let EINTR / EAGAIN cause a return to the user and let them + loop to run any asyncs that might be pending. */ + if (errno != EINTR && errno != EAGAIN) + SCM_SYSERROR; + else + { + /* Return empty sets. */ + FD_ZERO (&read_set); + FD_ZERO (&write_set); + FD_ZERO (&except_set); + } + } } return scm_list_3 (retrieve_select_type (&read_set, read_ports_ready, reads), --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 07 08:30:45 2018 Received: (at control) by debbugs.gnu.org; 7 Feb 2018 13:30:46 +0000 Received: from localhost ([127.0.0.1]:60952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejPoD-0007oG-Ml for submit@debbugs.gnu.org; Wed, 07 Feb 2018 08:30:45 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:35572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejPoB-0007o6-WB for control@debbugs.gnu.org; Wed, 07 Feb 2018 08:30:44 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F35071072C for ; Wed, 7 Feb 2018 14:30:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aKpbplVUE0SK for ; Wed, 7 Feb 2018 14:30:42 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 207D010434 for ; Wed, 7 Feb 2018 14:30:42 +0100 (CET) Date: Wed, 07 Feb 2018 14:30:41 +0100 Message-Id: <87372d0vwe.fsf@gnu.org> To: control@debbugs.gnu.org From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: control message for bug #30368 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) severity 30368 important From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 07 08:34:02 2018 Received: (at 30368) by debbugs.gnu.org; 7 Feb 2018 13:34:02 +0000 Received: from localhost ([127.0.0.1]:60956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejPrO-0007ti-5K for submit@debbugs.gnu.org; Wed, 07 Feb 2018 08:34:02 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:35590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejPrM-0007tJ-E0 for 30368@debbugs.gnu.org; Wed, 07 Feb 2018 08:34:00 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D47581075C for <30368@debbugs.gnu.org>; Wed, 7 Feb 2018 14:33:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TvIw4roFN__Z for <30368@debbugs.gnu.org>; Wed, 7 Feb 2018 14:33:59 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E73C910434 for <30368@debbugs.gnu.org>; Wed, 7 Feb 2018 14:33:58 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: 30368@debbugs.gnu.org Subject: Re: bug#30368: =?utf-8?B?4oCYc2VsZWN04oCZ?= returns non-empty sets upon EINTR or EAGAIN References: <87y3k67671.fsf@gnu.org> Date: Wed, 07 Feb 2018 14:33:58 +0100 In-Reply-To: <87y3k67671.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 06 Feb 2018 11:39:30 +0100") Message-ID: <87y3k4zzy1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30368 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > On 2.2.3, it prints: > > $ guile select.scm > > > ;;; (signal! (2)) > ;;; (reading-from #) > >>>From there on it=E2=80=99s stuck in a read(0, =E2=80=A6) call. > > The attached patch fixes it by clearing the returned FD sets on > EINTR/EAGAIN. There=E2=80=99s a case where we can get a =E2=80=9Cfake=E2=80=9D EINTR that= doesn=E2=80=99t come from the underlying select(2) call: when the =E2=80=98scm_i_prepare_to_wait_on_f= d=E2=80=99 call in =E2=80=98scm_std_select=E2=80=99 returns 1, which happens when new = asyncs have been queued. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 16 09:33:07 2018 Received: (at 30368-done) by debbugs.gnu.org; 16 Feb 2018 14:33:07 +0000 Received: from localhost ([127.0.0.1]:45834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emh4V-0004Uu-3S for submit@debbugs.gnu.org; Fri, 16 Feb 2018 09:33:07 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:35130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emh4T-0004Un-GK for 30368-done@debbugs.gnu.org; Fri, 16 Feb 2018 09:33:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0A10B115E1 for <30368-done@debbugs.gnu.org>; Fri, 16 Feb 2018 15:33:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lxDPebN1QLYB for <30368-done@debbugs.gnu.org>; Fri, 16 Feb 2018 15:33:04 +0100 (CET) Received: from ribbon (unknown [193.50.110.160]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 66A12115AC for <30368-done@debbugs.gnu.org>; Fri, 16 Feb 2018 15:33:04 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: 30368-done@debbugs.gnu.org Subject: Re: bug#30368: =?utf-8?B?4oCYc2VsZWN04oCZ?= returns non-empty sets upon EINTR or EAGAIN References: <87y3k67671.fsf@gnu.org> Date: Fri, 16 Feb 2018 15:33:04 +0100 In-Reply-To: <87y3k67671.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 06 Feb 2018 11:39:30 +0100") Message-ID: <878tbtngwv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30368-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > The attached patch fixes it by clearing the returned FD sets on > EINTR/EAGAIN. Pushed as f390afa0cc84eb84ed2cb3e03f542b991d4bb080. Ludo=E2=80=99. From unknown Fri Jun 20 05:35:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 17 Mar 2018 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator