From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#61095: possible misuse of posix_spawn API on non-linux OSes Date: Sun, 02 Apr 2023 15:44:01 +0200 Message-ID: <87zg7qtn4u.fsf@gnu.org> References: <26OIN3L5D4V9L.2M0KM95K0YSNM@venera> <87zg7xgqxz.fsf@gnu.org> <87tty4svpo.fsf@jpoiret.xyz> <87zg7vjimr.fsf@inria.fr> <87ileirnw7.fsf@jpoiret.xyz> <2KFIQJHFVA0GP.2GKMWUIGIVCMU@venera> 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="22093"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: Josselin Poiret , Andrew Whatson , 61095-done@debbugs.gnu.org To: Omar Polo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun Apr 02 15:45:22 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 1piy1J-0005a3-Tj for guile-bugs@m.gmane-mx.org; Sun, 02 Apr 2023 15:45:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piy12-00041W-VR; Sun, 02 Apr 2023 09:45:05 -0400 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 1piy10-000409-KO for bug-guile@gnu.org; Sun, 02 Apr 2023 09:45:02 -0400 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 1piy10-0008GM-Az for bug-guile@gnu.org; Sun, 02 Apr 2023 09:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1piy10-0001C8-7C for bug-guile@gnu.org; Sun, 02 Apr 2023 09:45:02 -0400 Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sun, 02 Apr 2023 13:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61095 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Mail-Followup-To: 61095@debbugs.gnu.org, ludo@gnu.org, op@omarpolo.com Original-Received: via spool by 61095-done@debbugs.gnu.org id=D61095.16804430564448 (code D ref 61095); Sun, 02 Apr 2023 13:45:01 +0000 Original-Received: (at 61095-done) by debbugs.gnu.org; 2 Apr 2023 13:44:16 +0000 Original-Received: from localhost ([127.0.0.1]:39371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piy0G-00019g-3d for submit@debbugs.gnu.org; Sun, 02 Apr 2023 09:44:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piy0D-00019O-7o for 61095-done@debbugs.gnu.org; Sun, 02 Apr 2023 09:44:14 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piy04-0007yy-9I; Sun, 02 Apr 2023 09:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=klFypizrwT6+3SScZ2kp1dW/2+AQPwgYQETQjWstCTw=; b=B9+eCEdI8nRscqAoqj7z ajGMeg5Z/64d5Zb202wceAMm+IRMcm6xt0MGMEuvJY5nEgO9hGYprN9+NvVMyPQx0eKLFm+b07mca gF6aT8TlsM5NKucYU8GhXbAK6EXg3Ta5vtj0MGrIPg1yNGdJxgTqpHFzoSQp6OC3RNhurBfyBNayg cRPLaK2pyaJi5iMxYoBS5eB8h3tEGlXfF3CI4gdGf29HMY+E3ZcCxyPrI1t4zH4gAL2e/ypFZRWVV tsT6LrxjA/RYCELfd42TW8PHjnNalYdbrtsjGKzhW5Iow2sb1yLp9fA6z8DHLjTFU61McW1+Bq6co Sh5goKabDKtZDA==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piy03-000208-Gw; Sun, 02 Apr 2023 09:44:03 -0400 In-Reply-To: <2KFIQJHFVA0GP.2GKMWUIGIVCMU@venera> (Omar Polo's message of "Fri, 31 Mar 2023 19:45:55 +0200") 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:10594 Archived-At: Hi! Omar Polo skribis: > On 2023/03/30 22:21:28 +0200, Josselin Poiret wrote: >> Hi Ludo, >>=20 >> Ludovic Court=C3=A8s writes: >>=20 >> > Coming next is an updated patch series addressing this as proposed >> > above. Let me know what y=E2=80=99all think! >> > >> > I tested the =E2=80=98posix_spawn_file_actions_addclosefrom_np=E2=80= =99 path by building in: >> > >> > guix time-machine --branch=3Dcore-updates -- shell -CP -D -f guix.scm >>=20 >> I didn't test, but this LGTM! Maybe someone on OpenBSD could test this >> patchset? > > % gmake check > > gmake[5]: Entering directory '/home/op/w/guile/test-suite/standalone' > PASS: test-system-cmds > > it seems to work on OpenBSD 7.3 :) Awesome! Pushed as 9cc85a4f52147fcdaa4c52a62bcc87bdb267d0a9. > but note that our libc doesn't have posix_spawn_file_actions_addclosefrom= _np, > so this is using the "racy" code path. Yeah, not great. :-/ I hope that function will be adopted by other libcs, especially since =E2=80=98closefrom=E2=80=99 is already available. > Just for curiosity, as it's outside the scope of the bug, what's the > reason posix_spawn was used instead of a more classic fork() + > closefrom()? There=E2=80=99s a long discussion at: https://issues.guix.gnu.org/52835 Essentially, =E2=80=98fork=E2=80=99 is unusable in multi-threaded context, = in addition to being inefficient. Thanks, Ludo=E2=80=99.