From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Whatson 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, 13 Jan 2023 11:11:18 +1000 Message-ID: <83e7661b7b89afbe406184b3c12a0310@tailcall.au> References: Reply-To: Andrew Whatson Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18520"; mail-complaints-to="usenet@ciao.gmane.io" To: 52835@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Fri Jan 13 09:28:37 2023 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 1pGFQR-0004cq-RL for guile-bugs@m.gmane-mx.org; Fri, 13 Jan 2023 09:28:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGFPy-0001vf-Jp; Fri, 13 Jan 2023 03:28:06 -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 1pGFPu-0001v0-Qa for bug-guile@gnu.org; Fri, 13 Jan 2023 03:28:03 -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 1pGFPu-0001Wp-FI for bug-guile@gnu.org; Fri, 13 Jan 2023 03:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGFPu-0001MT-Af for bug-guile@gnu.org; Fri, 13 Jan 2023 03:28:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 13 Jan 2023 08:28: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.16735984485166 (code B ref 52835); Fri, 13 Jan 2023 08:28:02 +0000 Original-Received: (at 52835) by debbugs.gnu.org; 13 Jan 2023 08:27:28 +0000 Original-Received: from localhost ([127.0.0.1]:49466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGFPK-0001LE-Ql for submit@debbugs.gnu.org; Fri, 13 Jan 2023 03:27:28 -0500 Original-Received: from dandenongnorth.hosting-cloud.net ([103.146.113.52]:47457) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG8bX-0000mb-HH for 52835@debbugs.gnu.org; Thu, 12 Jan 2023 20:11:39 -0500 X-Mailborder-Info: host=console.hosting-cloud.net, gmt_time=1673572291, scan_time=6.44s X-Mailborder-Spam-Score: -0.1 X-Mailborder-Spam-Report: ALL_TRUSTED, BAYES_00, MC_QUOATION, URIBL_DBL_BLOCKED_OPENDNS, URIBL_ZEN_BLOCKED_OPENDNS, SPF_FAIL, DKIM_SIGNED, MB_DMARC_FAIL, DKIM_INVALID, Original-Received: from cp61.hosting-cloud.net (unknown [103.119.110.239]) by smtp.hosting-cloud.net (Postfix) with ESMTPSA id 66F8980221 for <52835@debbugs.gnu.org>; Fri, 13 Jan 2023 12:11:18 +1100 (AEDT) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.hosting-cloud.net 66F8980221 Authentication-Results: console.hosting-cloud.net; dmarc=fail (p=quarantine dis=none) header.from=tailcall.au Authentication-Results: console.hosting-cloud.net; spf=fail smtp.mailfrom=whatson@tailcall.au DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.hosting-cloud.net 66F8980221 Authentication-Results: smtp.hosting-cloud.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=tailcall.au header.i=@tailcall.au header.b="luYmesCw"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tailcall.au ; s=x; h=Content-Transfer-Encoding:Content-Type:Message-ID:Subject:To:From: Date:MIME-Version:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Md8Qzrn6mtpnINrvKt1LmbSKjE2zM0WcL6u/T2cmKlg=; b=luYmesCwgRdsl+uPY1dw2ojZkY HI0j27jOhW0xGvUyeh158mwpN0hiNAT7OwCOzoHwFNTrOvAm7z6IpEw9YCXKk3bs3Hi5slBjTg7RB 0JiYlw4rd3veixPSodFj8pMuIGXvfHHcmw2F7GQ+M0EvXv/9FKgXyr1KDYGIelWvPIi+pbY6PfqGY SYkGFjyMzP02iCms4eMKceSQwT+7VfKRGe0P1RYLiwvcY+BUWb9/wefxnqBPdrEEXfJB0MfVVcKDq meoVYk29OXvQgtgfVIDWS3vse3a7R6YelF/o/FBTo/ovX5TRH+/p/6i4VxUoIiioarpQNuG534+th XaF6fWQg==; Original-Received: from localhost ([127.0.0.1] helo=cp61.hosting-cloud.net) by cp61.hosting-cloud.net with esmtpa (Exim 4.96) (envelope-from ) id 1pG8bG-0057X2-1M for 52835@debbugs.gnu.org; Fri, 13 Jan 2023 12:11:18 +1100 X-Sender: whatson@tailcall.au X-AuthUser: whatson@tailcall.au X-Mailman-Approved-At: Fri, 13 Jan 2023 03:27:24 -0500 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:10508 Archived-At: Hello Josselin & Ludo, Thanks for your work on this, posix_spawn is a nice improvement! My comments on the changes in the wip-posix-spawn branch follow. In doc/ref/posix.texi: > @quotation Note > If you are only looking to fork+exec with some pipes set up, using > pipes > or the more @code{spawn} procedure described below will be more robust > (in particular in multi-threaded contexts), more portable, and usually > more efficient. > @end quotation Should be "... the more primitive @code{spawn} procedure". > @deffn {Scheme Procedure} spawn @var{program} @var{arguments} @ > [#:environment=(environ)] @ > [#:input=(current-input-port)] @ > [#:output=(current-output-port)] @ > [#:error=(current-error-port)] @ > [#:search-path?=#t] > Spawn a new child process executing @var{program} with the > given @var{arguments}, a list of one or more strings, and > return its PID. Raise a @code{system-error} exception if > @var{program} could not be found or could not be executed. The description of arguments as "a list of one or more strings" is surprising, I think some users might expect to be able to pass zero arguments, but we don't explain what the single argument should be. An earlier version of the docs for this function clarified this with "(which must include the name of the executable as a first element)". The manual for exec(3) says "the first argument, by convention, should point to the filename associated with the file being executed." Maybe we could clarify in a second paragraph: "By convention, the first element of @var{arguments} should be the name of the program being executed. If calling a C program, for example, this will be passed as the value for @code{argv[0]}." In libguile/posix.c, piped_process, around line 1565: > if (*pid == -1) > switch (errno_save) > { > /* Errors that seemingly come from fork. */ > case EAGAIN: > case ENOMEM: > case ENOSYS: > errno = err; > free (exec_file); > SCM_SYSERROR; > break; > > default: /* ENOENT, etc. */ > /* Create a dummy process that exits with value 127. */ > dprintf (err, "In execvp of %s: %s\n", exec_file, > strerror (errno_save)); > } The "dummy process" comment here is misleading, this function simply returns the error code. Its callers 'scm_piped_process' and 'scm_system_star' are responsible for simulating exit code 127, and are already well commented. Probably just remove this redundant comment. Otherwise, looks good to me :) Thanks again! Cheers, Andrew