From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:38225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4WmN-0006xh-4H for guix-patches@gnu.org; Thu, 14 Mar 2019 16:16:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4WXI-0008EO-30 for guix-patches@gnu.org; Thu, 14 Mar 2019 16:01:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58779) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h4WXH-0008Da-0F for guix-patches@gnu.org; Thu, 14 Mar 2019 16:01:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h4WXG-00007G-S8 for guix-patches@gnu.org; Thu, 14 Mar 2019 16:01:02 -0400 Subject: [bug#34638] [PATCH 2/4] linux-container: Add 'start-child-in-container'. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190224161855.2632-1-mail@cbaines.net> <20190224161855.2632-2-mail@cbaines.net> Date: Thu, 14 Mar 2019 19:17:43 +0100 In-Reply-To: <20190224161855.2632-2-mail@cbaines.net> (Christopher Baines's message of "Sun, 24 Feb 2019 16:18:53 +0000") Message-ID: <87lg1hiam0.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Baines Cc: 34638@debbugs.gnu.org Hello! Christopher Baines skribis: > This new procedure is similar to open-pipe* in (ice-9 popen), but using > run-container from (gnu build linux-container). > > * gnu/build/linux-container.scm (start-child-in-container): New procedure. [...] +(define* (start-child-in-container command > + #:key read? write? > + (root 'temporary) > + (mounts '()) > + (namespaces %namespaces) > + (host-uids 1) > + (extra-environment-variables '())) We could even call that =E2=80=98open-pipe/container=E2=80=99, for clarity. > + (define (with-root-directory f) > + (if (eq? root 'temporary) > + (call-with-temporary-directory f) > + (f root))) > + > + ;; (ice-9 popen) internals > + (define make-rw-port (@@ (ice-9 popen) make-rw-port)) > + (define pipe-guardian (@@ (ice-9 popen) pipe-guardian)) > + (define make-pipe-info (@@ (ice-9 popen) make-pipe-info)) So this is the funky part. ;-) What if we did something like: (call-with-container mounts (lambda () ;; Somehow act as a proxy between the output process ;; and the one spawned by =E2=80=98open-pipe*=E2=80=99. (open-pipe* =E2=80=A6))) ? Would that work? That=E2=80=99s create an extra process, but if it works, it=E2=80=99s proba= bly safer and a lesser maintenance burden. Now, I think that Guile should expose some of the popen internals somehow so we can do things like you did, but that=E2=80=99s another story. Ludo=E2=80=99.