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 v6 0/3] Move spawning procedures to posix_spawn. Date: Thu, 22 Dec 2022 13:49:07 +0100 Message-ID: References: <87iligyyh9.fsf@gnu.org> Reply-To: Josselin Poiret Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31125"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52835@debbugs.gnu.org, Timothy Sample , Josselin Poiret To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Dec 22 13:50:53 2022 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 1p8L2C-0007tc-Ak for guile-bugs@m.gmane-mx.org; Thu, 22 Dec 2022 13:50:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8L1W-0003td-P1; Thu, 22 Dec 2022 07:50:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8L1O-0003qg-Kz for bug-guile@gnu.org; Thu, 22 Dec 2022 07:50:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p8L1O-0003ZB-9x for bug-guile@gnu.org; Thu, 22 Dec 2022 07:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8L1O-0001cw-5X for bug-guile@gnu.org; Thu, 22 Dec 2022 07:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 22 Dec 2022 12:50:02 +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.16717133746206 (code B ref 52835); Thu, 22 Dec 2022 12:50:02 +0000 Original-Received: (at 52835) by debbugs.gnu.org; 22 Dec 2022 12:49:34 +0000 Original-Received: from localhost ([127.0.0.1]:58189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8L0w-0001bv-82 for submit@debbugs.gnu.org; Thu, 22 Dec 2022 07:49:34 -0500 Original-Received: from jpoiret.xyz ([206.189.101.64]:41520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8L0t-0001bZ-H8 for 52835@debbugs.gnu.org; Thu, 22 Dec 2022 07:49:32 -0500 Original-Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 684B1184B84; Thu, 22 Dec 2022 12:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1671713368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=INGLaZ/y9M1o6HXPSbbKmTyReKP077k344NNj26lGsA=; b=v5b/+LbvbmS/6bsy8sAp0Jdj+wPu1MC9oHIYtbXqAJYnRBui05myz0gB1zIJNTA/S6/k5j BrPEVYx1o+JF/0nVPqvwx9Do64DMzAWkfHXEOxczMlD2pwfWGZqvz34ELWWmED/mWbvolw iAqohPMdTFgNcDjoUJrf0yQeO+K/FQH3TtwXz+yJG6MOcUExk9pRHKe+CUPXHeulKf2HEb 6/Vy5Kd4wnXdalJIHRWHPQoPyycEZw/KIj79TTaNlGINqwCG4p0x/bpTPO/YDQWL4wEOs/ fg1dnTBMYuuasEHK0HD4YdojudsJf1HrRQ53FMEmbBrlrU8+7WQvIHQ1JfF5uA== In-Reply-To: <87iligyyh9.fsf@gnu.org> Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spamd-Bar: ++++ 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-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10483 Archived-At: Hello Ludo, Here is hopefully the last reroll of this patchset. First of all, I did not include the gnulib patch again because it still applies cleanly and it is extremely large, but it should be applied before those 3 patches. The first two patches should be applied on the current major release, while the third one should be applied on the next major release to finish the migration to spawn. The first patch adds the new spawn* procedure, using an internal do_spawn function. The second patch changes system* and piped-process to use this new function, but it still tries to mimick the old behavior of start_child by inspecting the possible errnos, and spawning a dummy child that instantly exits with code 127 in some cases. The third patch gets rid of those special cases, which makes system* and friends throw more exceptions instead of having the child fail with exit code 127 (note that YMMV depending on how spawn is implemented for your system). I've added docstrings to user-facing Guile procedures, and also did the micro-optimization we talked about, since I had already factorized do_spawn. The tests seem to pass both with and without 3. One nice thing I've noticed is that gnulib has posix_spawn for WinNT as well, which means it might be okay to remove the dependency on having fork for system*, among others! WDYT? Josselin Poiret (3): Add spawn*. Make system* and piped-process internally use spawn. Move popen and posix procedures to spawn*. libguile/posix.c | 248 +++++++++++------------------------- libguile/posix.h | 2 + module/ice-9/popen.scm | 87 +++++++++---- test-suite/tests/popen.test | 14 +- test-suite/tests/posix.test | 36 +++--- 5 files changed, 161 insertions(+), 226 deletions(-) base-commit: f3ea8f7fa1d84a559c7bf834fe5b675abe0ae7b8 prerequisite-patch-id: 71184f71260952109165ec62c588c2b646e238f6 -- 2.38.1