From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Josselin Poiret via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" Newsgroups: gmane.lisp.guile.bugs Subject: bug#52835: [PATCH 0/2] Fix spawning a child not setting standard fds properly Date: Tue, 28 Dec 2021 18:25:03 +0100 Message-ID: <87lf04fxqo.fsf@jpoiret.xyz> References: <8735mcu4a5.fsf@ngyro.com> Reply-To: Josselin Poiret Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30699"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52835@debbugs.gnu.org To: Timothy Sample Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Tue Dec 28 18:26:29 2021 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n2GF3-0007j4-2S for guile-bugs@m.gmane-mx.org; Tue, 28 Dec 2021 18:26:29 +0100 Original-Received: from localhost ([::1]:53998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2GF2-0002Ta-6o for guile-bugs@m.gmane-mx.org; Tue, 28 Dec 2021 12:26:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2GEm-0002TH-Vk for bug-guile@gnu.org; Tue, 28 Dec 2021 12:26:13 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2GEb-0003sX-Ko for bug-guile@gnu.org; Tue, 28 Dec 2021 12:26:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2GEb-0003dL-I7 for bug-guile@gnu.org; Tue, 28 Dec 2021 12:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 28 Dec 2021 17:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52835 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 52835-submit@debbugs.gnu.org id=B52835.164071230813892 (code B ref 52835); Tue, 28 Dec 2021 17:26:01 +0000 Original-Received: (at 52835) by debbugs.gnu.org; 28 Dec 2021 17:25:08 +0000 Original-Received: from localhost ([127.0.0.1]:47324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2GDk-0003c0-HW for submit@debbugs.gnu.org; Tue, 28 Dec 2021 12:25:08 -0500 Original-Received: from jpoiret.xyz ([206.189.101.64]:41796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2GDi-0003bp-Uu for 52835@debbugs.gnu.org; Tue, 28 Dec 2021 12:25:07 -0500 Original-Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id B7A51184CCF; Tue, 28 Dec 2021 17:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1640712305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g38hw+70E2/b7MCh5o9fyLFdhX8ue4AGYsqBWCz6rmE=; b=hccswQshMGiCzSlQmHZP8bXyt97J2alkR9ST2Rdm6EB8LwnKtjWt9jHheUOMVADmVLgkT4 nBgi81DwuVgHGDE60svg/oO36D6l/u8Zbp2d/8zlnccjc2PxffBKYx0cAO/PzEVOvrhfVp 3TOSfGZ5bshbvBKxzNsKn4xbpIKwxKWcH45N+QpzFKxuberIztWnr9EByFdSfP7+NRpd65 YCF8UMkL3joAuTRYTrafzC+oZ6PLRo8XDUeN9l9oSlCTZRsqyku43Jo+9JtLvfWebGtU7B aV4CbozRjQg0mxrV8QGcJrlryfJ1I+xFYuJ7Vpe6woaKBZsef4uHbSahCMfqiA== In-Reply-To: <8735mcu4a5.fsf@ngyro.com> X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10233 Archived-At: Hello Timothy, Timothy Sample writes: > One thing that =E2=80=98renumber_file_descriptor=E2=80=99 does that we se= em to be losing > here is error checking. To my eye, the old code will try and warn the > user if they run out of file descriptors, but the new code will not. I may have been too hasty on that front, you're right that we should check for errors when dup'ing. Note though that we should not run out of fds, as we close all of them except for in/out/err right before using it, but still, here are the interesting error codes: * EINTR, although OpenBSD and Linux will never set that error from my light research; * EBUSY, not POSIX though, only Linux, so should we? * EMFILE, if we run out of fds; * EBADF if either of the fds are invalid. As for error reporting, should we keep the parent's stderr fd open while we do all of this, just to be able to report an error in case it happens? The old code used to try reporting the errors to the new `err` fd instead, but it might be clearer to use stderr. WDYT? --=20 Josselin Poiret