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: Fri, 23 Dec 2022 18:15:03 +0100 Message-ID: <87v8m2jb3c.fsf@jpoiret.xyz> References: <87iligyyh9.fsf@gnu.org> <87y1qyz909.fsf_-_@gnu.org> 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="2595"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52835@debbugs.gnu.org, Timothy Sample To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Fri Dec 23 18:16:33 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 1p8lep-0000St-Rg for guile-bugs@m.gmane-mx.org; Fri, 23 Dec 2022 18:16:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8leU-0007nI-2X; Fri, 23 Dec 2022 12:16: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 1p8leN-0007mk-E5 for bug-guile@gnu.org; Fri, 23 Dec 2022 12:16: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 1p8leN-0002Ms-5R for bug-guile@gnu.org; Fri, 23 Dec 2022 12:16:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8leM-0007Tm-Hc for bug-guile@gnu.org; Fri, 23 Dec 2022 12:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 23 Dec 2022 17:16: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.167181570828708 (code B ref 52835); Fri, 23 Dec 2022 17:16:02 +0000 Original-Received: (at 52835) by debbugs.gnu.org; 23 Dec 2022 17:15:08 +0000 Original-Received: from localhost ([127.0.0.1]:37837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ldU-0007Sy-64 for submit@debbugs.gnu.org; Fri, 23 Dec 2022 12:15:08 -0500 Original-Received: from jpoiret.xyz ([206.189.101.64]:45090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8ldS-0007Ss-Bh for 52835@debbugs.gnu.org; Fri, 23 Dec 2022 12:15:06 -0500 Original-Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 584AD184D6B; Fri, 23 Dec 2022 17:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1671815704; 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=+rE6qyxo7X0e8NZffIm9MP0HhW9dHLS9+F/SSC46OMA=; b=ELdA5GMBq+/H+qwP7pJA+/hxnwNsbebfIEhdOYv8mxt0fbhBw9ILRtBnJ4iOv9/912I+eX 1GwgXpjcI3y3Pi04PXFMaEXL06dDQg6tJkf00Z8SzIJCGZvEpwGfOhL1ZVBvY2oVKDZDd8 xaOl66vNrWOtPB2PXGvYUk4RzSgtCkt2kYhYhYtoyno0Aq1+zADsbHn9WBiK4SGSWuZf1C UkXdudDpMwS8qsZ0z1W0E4JWhGUuvQjh9RtZxDrgmkYaEwqXnG7/oTcystOoqHIiTmrmK6 E7wECO9+Tc5I7kX+Zvs8mj1eQseZOpBmhjr2BXIg74r/7PWKr1d6IGilXYnhNQ== In-Reply-To: <87y1qyz909.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:10487 Archived-At: Hi Ludo, thanks for the quick review and fixes. > I pushed it to =E2=80=98wip-posix-spawn=E2=80=99 along with fixups I=E2= =80=99m proposing, mostly > along the lines of what I suggested in > : Nice but also see below. > I also added Andrew Whatson=E2=80=99s patch from > . Great, hadn't see that one go by! > If that=E2=80=99s fine with you, I can squash the =E2=80=9Cfixup!=E2=80= =9D commits and merge the > branch. Let me know! > > Earlier we agreed it=E2=80=99d be nice to expose =E2=80=98spawn*=E2=80=99= /=E2=80=98primitive-spawn=E2=80=99. I > still think it=E2=80=99s a good idea, but the interface would need some w= ork IMO > to be more generally useful. In essence, we could provide something > similar to =E2=80=98fork+exec-command=E2=80=99 in the Shepherd, where one= can pass > environment variables, stdin/stdout/stderr, etc., all that with keyword > arguments and reasonable defaults. I've just polished it up a bit: the `spawn*` procedure defined in C now takes another argument, a list of environment variables. I think this interface is good enough to cover most use cases, if anyone needs something more complicated they should go through their own C code. I've added a convenience module (ice-9 spawn) with a `spawn` procedure in it, which takes an optional argument list which defaults to just the executable, and optional environment variables as well as in, out and err ports. I also think everything in (ice-9 popen) should be migrated on the next major release, as well as being re-implemented in terms of `spawn` purely, so that the change is immediately noticeable. We're reaching the bike-shedding time now, but IMHO having such a `spawn*` exposed to the user seems fine, it's a pretty simple "raw" interface with fdes, and there is a convenience `spawn` function that is nicer for users. Do we need to add a documentation page as well? Best, --=20 Josselin Poiret