From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id lbY9FNUjUmSYWgEASxT56A (envelope-from ) for ; Wed, 03 May 2023 11:05:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QMEgC9UjUmQYEAAA9RJhRA (envelope-from ) for ; Wed, 03 May 2023 11:05:25 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BB052DC5E for ; Wed, 3 May 2023 11:05:24 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pu8Q4-0000S2-5z; Wed, 03 May 2023 05:05:04 -0400 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 1pu8Q2-0000Ri-Fr for bug-guix@gnu.org; Wed, 03 May 2023 05:05:02 -0400 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 1pu8Q2-0001LD-5J for bug-guix@gnu.org; Wed, 03 May 2023 05:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pu8Q1-0001UR-U7 for bug-guix@gnu.org; Wed, 03 May 2023 05:05:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#62334: bug#63024: Crash during `guix import pypi -r' Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 03 May 2023 09:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62334 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Josselin Poiret Cc: 63024@debbugs.gnu.org, 62334@debbugs.gnu.org, Greg Hogan , Simon Tournier Received: via spool by 62334-submit@debbugs.gnu.org id=B62334.16831046675673 (code B ref 62334); Wed, 03 May 2023 09:05:01 +0000 Received: (at 62334) by debbugs.gnu.org; 3 May 2023 09:04:27 +0000 Received: from localhost ([127.0.0.1]:45553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pu8PS-0001TO-HD for submit@debbugs.gnu.org; Wed, 03 May 2023 05:04:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pu8PO-0001T5-Hr; Wed, 03 May 2023 05:04:25 -0400 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 1pu8PI-0001GK-Pb; Wed, 03 May 2023 05:04:16 -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=S3fzsM5rryV3xMI2hyrP/SLarwudO9iP67Zcjq8M5uQ=; b=FxGskAtMIJWahnwnuQJw X/EDpWWhmSEUjZVSwiyn/nAZi819KUKTxsytoDm7WHwMyDZtl+LKpwH1+lHA/ZLdDtCEIXrAxCxDW 2mpCsXFBfMD8Hz83DnaQshH2lciMbPt4KyL7IVYEJ3sEV13rl2L1WfW585gNo+vUv0YfRHs8Yj5B/ CGxxoBE8rNQgrNlSQ+h/+jq/ibHoTN2/mFev3QpRp+c2BUVMBK6ajM/D/gkFSYxL3TFBHcw6juANf m00PbktW375QlKtwGkzV4GyjncgZK3dnFMI64owaO9snCyz3s3OSzOc+V0sLEsRZrMD/Lh3pOmWyz e2FwpMi6Kz+t+A==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pu8PI-0001sY-5u; Wed, 03 May 2023 05:04:16 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87fs8e5rrp.fsf@gnu.org> Date: Wed, 03 May 2023 11:04:14 +0200 In-Reply-To: <87fs8e5rrp.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 02 May 2023 23:48:26 +0200") Message-ID: <87mt2l4whd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683104725; a=rsa-sha256; cv=none; b=WDgvw1hX+hlBQ6Liv01difNX11cLqMDizod9gRUASGIHs7QFNOV6unEDjMVF5tJLkSXHqD 9ecCT8JlhjXVMLR23DBerTCABf7znzihctXa8E2m/bIO9rOYu4LxQC2AtOXwkNX4ObenBP 8pUvm18OhsOYla0PauSc3Fm+qwcum0Z2Nt6IzUos5R2Matf6atMUuAno6RVTwW9qC4O3u9 tlDNR9IxjvWYFNJfTUk3YOr/+BCokVCumgYwjlEMgqZdf9yjiYBPtjy9tbosX7Zkgtetog ne4QfRWAzry2WLtfgyW0lBm+Ri7xmLXt57jLDaG5PNbrZqarSx0fzPocaP4pCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=FxGskAtM; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683104725; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=S3fzsM5rryV3xMI2hyrP/SLarwudO9iP67Zcjq8M5uQ=; b=UG98DX7RwVYlA1cDMkr6QGPhQUHLtpm6W6nkIVu15FNo5o/DJmczMUajtUZrhplvVhRI5V pUnjYuRViuDctVrQ/4jByNx7k2dvqcFz94DR6wj2HX0Z6n1+TWXzdTC65mUFEj9EWDVrH8 gVQ1I87pRJyxsrYVLYT2lgjgXEslc9Y/HN4shKOodFfpcL7JZl6XrhbKkxw1AuGhxcUBhy 0JfkqIzDLQX42EEcueRXFRCX2fZco3nis+xZlnvgTxxJxxgBDYtBQPwawf5UKKlhwXL+9G bDVNsUC3joAGIu5JYxfvBcFShzQJjy4ZZtw8Dz4AdhPF2l4a/HdTTXraaYNr5A== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=FxGskAtM; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.60 X-Spam-Score: -1.60 X-Migadu-Queue-Id: BB052DC5E X-TUID: T12rP4ejgEZZ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hey, Ludovic Court=C3=A8s skribis: > Looks like we shoudn=E2=80=99t dup(4, 1) in the child process, because 4 = is the > other end of our sleep pipe. :-) How about this patch, Josselin? Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/libguile/posix.c b/libguile/posix.c index 3adc743c4..2d55d985c 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1388,11 +1388,27 @@ do_spawn (char *exec_file, char **exec_argv, char **exec_env, } /* Move the fds out of the way, so that duplicate fds or fds equal - to 0, 1, 2 don't trample each other */ + to 0, 1, 2 don't trample each other. Since 'system*' might give + us -1 for IN, OUT, or ERR, open /dev/null when that's the case. */ + + if (in < 0) + posix_spawn_file_actions_addopen (&actions, fd_slot[0], + "/dev/null", O_RDONLY | O_CLOEXEC, 0); + else + posix_spawn_file_actions_adddup2 (&actions, in, fd_slot[0]); + + if (out < 0) + posix_spawn_file_actions_addopen (&actions, fd_slot[1], + "/dev/null", O_WRONLY | O_CLOEXEC, 0); + else + posix_spawn_file_actions_adddup2 (&actions, out, fd_slot[1]); + + if (err < 0) + posix_spawn_file_actions_addopen (&actions, fd_slot[2], + "/dev/null", O_WRONLY | O_CLOEXEC, 0); + else + posix_spawn_file_actions_adddup2 (&actions, err, fd_slot[2]); - posix_spawn_file_actions_adddup2 (&actions, in, fd_slot[0]); - posix_spawn_file_actions_adddup2 (&actions, out, fd_slot[1]); - posix_spawn_file_actions_adddup2 (&actions, err, fd_slot[2]); posix_spawn_file_actions_adddup2 (&actions, fd_slot[0], 0); posix_spawn_file_actions_adddup2 (&actions, fd_slot[1], 1); posix_spawn_file_actions_adddup2 (&actions, fd_slot[2], 2); diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index d5cf47cda..18dad8902 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -374,7 +374,17 @@ (system* "sh" "-c" "echo bong >&2")))))))) (and (zero? (status:exit-val status)) - (call-with-input-file file get-string-all))))) + (call-with-input-file file get-string-all)))) + + (pass-if-equal "https://bugs.gnu.org/63024" + 0 + (if (file-exists? "/proc/self/fd/0") ;on GNU/Linux? + (parameterize ((current-output-port (%make-void-port "w0"))) + (system* "guile" "-c" + (object->string + '(exit (string=? "/dev/null" + (readlink "/proc/self/fd/1")))))) + (throw 'unresolved)))) ;; ;; spawn --=-=-=--