GNU bug report logs - #34638
[PATCH 0/4] Isolated inferiors.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Christopher Baines <mail@HIDDEN>; Keywords: patch; dated Sun, 24 Feb 2019 16:13:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 19 Apr 2019 14:16:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 10:16:51 2019
Received: from localhost ([127.0.0.1]:44433 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHUJu-0002k2-O0
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:16:51 -0400
Received: from mira.cbaines.net ([212.71.252.8]:48084)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1hHUJp-0002jq-3f
 for 34638 <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:16:47 -0400
Received: from localhost (71.38.6.51.dyn.plus.net [51.6.38.71])
 by mira.cbaines.net (Postfix) with ESMTPSA id 6E17E16EC9;
 Fri, 19 Apr 2019 15:16:43 +0100 (BST)
Received: from phact (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id a08e1cda;
 Fri, 19 Apr 2019 14:16:43 +0000 (UTC)
References: <20190224161855.2632-1-mail@HIDDEN>
 <20190224161855.2632-2-mail@HIDDEN> <87lg1hiam0.fsf@HIDDEN>
User-agent: mu4e 1.0; emacs 26.1
From: Christopher Baines <mail@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#34638] [PATCH 2/4] linux-container: Add
 'start-child-in-container'.
In-reply-to: <87lg1hiam0.fsf@HIDDEN>
Date: Fri, 19 Apr 2019 15:16:40 +0100
Message-ID: <87pnpit707.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
Cc: 34638 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hello!
>
> Christopher Baines <mail@HIDDEN> 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 procedur=
e.
>
> [...]
>
>  +(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 clarit=
y.

I've made some changes (see below) that move this a little further away
from open-pipe in terms of behaviour now.

>> +  (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 pro=
bably 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 stor=
y.

I'm hesitant to try that, as the additional process in the middle seems
a bit awkward to me.

I've made another pass over the code, removed all the uses of (ice-9
popen) internals, and sent another set of patches. For the make-rw-port
function, I just copied that over. The pipe-guardian isn't being used
now, and instead of returning a <pipe-info> record, the port and pid are
returned instead. This works with the inferior use case, as the close
function provided to port->inferior does the right thing, closing the
port and then waiting for the child process to exit, just like popen.

I'm still more interested in getting something working than it being
perfect in any particular way, but let me know what you think.

Thanks,

Chris

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAly52EhfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XfZTw/6A8MgyDllG42QeJT5f/qXG9mee6q8edCLQHBTytq9Mzv3RRr20uJ4jIoz
xc8AYRsTO8niCgU6CquAIbz1eR/koz4xo753qlo1grQYj/M71VpI5lQkukyPhcX6
ZcCZPDXWxrz/wiYlbhVB813B6rP8DLo7wxK9StB3ybQk4kkI8+lR9b69nteyXa/B
YoV3L8CG+jiuvyRokTcNytpj3GJjv+Xiy9hOVPe9B1Oken76kIpqmc14kV2341Ih
8o+T29vuHS+0dlTz5ovVtvGp5QIK5tKBR0jZingiN60tSCqgrY7AouEGMAM+V1S4
Z+QLGqk+boLKhFIZgseT3Tn66OIiO12J7SPPyLhyBLU8dUa3r8oYFVlmQFWVsiK7
RDLTot0C2+MDOooCtA+Kam33IAppD1DZY3AImbMut7ZzXVwTOMdaCgzRLP8acn3X
lZlURvieJkzAiQFDIKYnicbqnDFdXoH8tm997tb98giu8Ruf7YiaT1aHM5u2iGsT
Hh1uFEWnlaW+Y09fLFdsPhJBH4ovoESvT1TuxZqbYF3FtRTdhlQ4daUYx49Zf04+
5fNdzX79mFPUXygc0PZ+v8+mQ4vwOUQS02giBS63igBWseb6ObzR/gA/mjLwRJ+w
qYb7A9gUURe9aXC47AoL92lxFL+xfmTAPDFyi4LAMS1WQFtaEuk=
=0lHn
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 19 Apr 2019 14:04:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 10:04:32 2019
Received: from localhost ([127.0.0.1]:44420 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHU80-0002RF-3N
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:32 -0400
Received: from mira.cbaines.net ([212.71.252.8]:48054)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1hHU7x-0002QV-2Y
 for 34638 <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:30 -0400
Received: from localhost (71.38.6.51.dyn.plus.net [51.6.38.71])
 by mira.cbaines.net (Postfix) with ESMTPSA id DC9EF16ED3
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 15:04:27 +0100 (BST)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 12551412
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 14:04:27 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH v2 4/4] inferior: Add 'open-inferior/container'.
Date: Fri, 19 Apr 2019 15:04:27 +0100
Message-Id: <20190419140427.15183-4-mail@HIDDEN>
X-Mailer: git-send-email 2.21.0
In-Reply-To: <20190419140427.15183-1-mail@HIDDEN>
References: <20190419140427.15183-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

---
 guix/inferior.scm | 76 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 6d18ab90e9..8238c7fb38 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -19,6 +19,7 @@
 (define-module (guix inferior)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-9 gnu)
+  #:use-module (srfi srfi-11)
   #:use-module ((guix utils)
                 #:select (%current-system
                           source-properties->location
@@ -40,6 +41,9 @@
   #:use-module (guix store)
   #:use-module (guix derivations)
   #:use-module (guix base32)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu build linux-container)
+  #:use-module (guix build syscalls)
   #:use-module (gcrypt hash)
   #:autoload   (guix cache) (maybe-remove-expired-cache-entries)
   #:autoload   (guix ui) (show-what-to-build*)
@@ -54,6 +58,7 @@
   #:use-module ((rnrs bytevectors) #:select (string->utf8))
   #:export (inferior?
             open-inferior
+            open-inferior/container
             port->inferior
             close-inferior
             inferior-eval
@@ -137,6 +142,77 @@ it's an old Guix."
                           ((@ (guix scripts repl) machine-repl))))))
         pipe)))
 
+(define* (open-inferior/container store guix-store-item
+                                  #:key
+                                  (command "bin/guix")
+                                  (share-host-network? #f)
+                                  (extra-shared-directories '())
+                                  (extra-environment-variables '()))
+  (define requisite-store-items
+    (requisites store (list guix-store-item)))
+
+  (define shared-directory
+    (mkdtemp! (string-append (or (getenv "TMPDIR") "/tmp")
+                             "/guix-inferior.XXXXXX")))
+
+  (define mappings
+    (append
+     (map (lambda (dir)
+            (file-system-mapping
+             (source dir)
+             (target dir)
+             (writable? #f)))
+          `(;; Share a directory, used in inferior-eval-with-store
+            ,shared-directory
+            ,@requisite-store-items
+            ,@extra-shared-directories))
+     (if share-host-network?
+         %network-file-mappings
+         '())))
+
+  (define mounts
+    (append %container-file-systems
+            (map file-system-mapping->bind-mount
+                 mappings)))
+
+  (define (inferior-pipe/container store
+                                   guix-store-item
+                                   shared-directory
+                                   command)
+    (start-child-in-container
+     (list (string-append guix-store-item "/bin/guix")
+           ;; TODO I'm not sure why "repl" is duplicated in the following
+           ;; command
+           "repl" "repl" "-t" "machine")
+     #:read? #t
+     #:write? #t
+     #:mounts mounts
+     #:namespaces (if share-host-network?
+                      (delq 'net %namespaces)
+                      %namespaces)
+     #:extra-environment-variables
+     `(;; Set HOME, so that the (guix profiles) module can be loaded, without it
+       ;; trying to read from /etc/passwd
+       "HOME=/tmp"
+       ,@extra-environment-variables)))
+
+  (let*-values
+      (((pipe pid)
+        (inferior-pipe/container store
+                                 guix-store-item
+                                 shared-directory
+                                 command))
+       ((close-inferior-pipe)
+        (lambda (pipe*)
+          (unless (eq? pipe pipe*)
+            (error "wrong pipe being closed"))
+          (close-port pipe)
+          (cdr (waitpid pid)))))
+
+      (port->inferior pipe
+                      shared-directory
+                      close-inferior-pipe)))
+
 (define* (port->inferior pipe shared-directory #:optional (close close-port))
   "Given PIPE, an input/output port, return an inferior that talks over PIPE.
 PIPE is closed with CLOSE when 'close-inferior' is called on the returned
-- 
2.21.0





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 19 Apr 2019 14:04:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 10:04:32 2019
Received: from localhost ([127.0.0.1]:44418 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHU7z-0002R8-R6
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:32 -0400
Received: from mira.cbaines.net ([212.71.252.8]:48056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1hHU7x-0002QW-0b
 for 34638 <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:30 -0400
Received: from localhost (71.38.6.51.dyn.plus.net [51.6.38.71])
 by mira.cbaines.net (Postfix) with ESMTPSA id 5FE7A16ECF
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 15:04:27 +0100 (BST)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id d0bf4640
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 14:04:27 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH v2 1/4] utils: Add #:base-directory to
 call-with-temporary-directory.
Date: Fri, 19 Apr 2019 15:04:24 +0100
Message-Id: <20190419140427.15183-1-mail@HIDDEN>
X-Mailer: git-send-email 2.21.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This allows more easily creating temporary directories within a specific
directory. This is motivated by using this in inferior-eval-with-store.

* guix/utils.scm (call-with-temporary-directory): Add optional keyword
argument, base-directory.
---
 guix/utils.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index ed1a418cca..abeb156f40 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -620,10 +620,10 @@ call."
         (false-if-exception (close out))
         (false-if-exception (delete-file template))))))
 
-(define (call-with-temporary-directory proc)
+(define* (call-with-temporary-directory proc #:key base-directory)
   "Call PROC with a name of a temporary directory; close the directory and
 delete it when leaving the dynamic extent of this call."
-  (let* ((directory (or (getenv "TMPDIR") "/tmp"))
+  (let* ((directory (or base-directory (getenv "TMPDIR") "/tmp"))
          (template  (string-append directory "/guix-directory.XXXXXX"))
          (tmp-dir   (mkdtemp! template)))
     (dynamic-wind
-- 
2.21.0





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 19 Apr 2019 14:04:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 10:04:31 2019
Received: from localhost ([127.0.0.1]:44416 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHU7z-0002R1-D2
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:31 -0400
Received: from mira.cbaines.net ([212.71.252.8]:48050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1hHU7w-0002QT-TL
 for 34638 <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:29 -0400
Received: from localhost (71.38.6.51.dyn.plus.net [51.6.38.71])
 by mira.cbaines.net (Postfix) with ESMTPSA id 8AF7116ED1
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 15:04:27 +0100 (BST)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id ba0d485d
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 14:04:27 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH v2 2/4] linux-container: Add 'start-child-in-container'.
Date: Fri, 19 Apr 2019 15:04:25 +0100
Message-Id: <20190419140427.15183-2-mail@HIDDEN>
X-Mailer: git-send-email 2.21.0
In-Reply-To: <20190419140427.15183-1-mail@HIDDEN>
References: <20190419140427.15183-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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.
---
 gnu/build/linux-container.scm | 83 +++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 3d7b52f098..88b00e00f6 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -32,6 +32,7 @@
             setgroups-supported?
             %namespaces
             run-container
+            start-child-in-container
             call-with-container
             container-excursion
             container-excursion*))
@@ -213,6 +214,88 @@ corresponds to the symbols in NAMESPACES."
                ('net  CLONE_NEWNET))
               namespaces)))
 
+(define* (start-child-in-container command
+                                   #:key read? write?
+                                   (root 'temporary)
+                                   (mounts '())
+                                   (namespaces %namespaces)
+                                   (host-uids 1)
+                                   (extra-environment-variables '()))
+  (define (with-root-directory f)
+    (if (eq? root 'temporary)
+        (call-with-temporary-directory f)
+        (f root)))
+
+  (define (make-rw-port read-port write-port)
+    (make-soft-port
+     (vector
+      (lambda (c) (write-char c write-port))
+      (lambda (s) (display s write-port))
+      (lambda () (force-output write-port))
+      (lambda () (read-char read-port))
+      (lambda () (close-port read-port) (close-port write-port)))
+     "r+"))
+
+  ;; car is the inport port, cdr is the output port. You write to the output
+  ;; port, and read from the input port.
+  (define child-to-parent-pipe
+    (if read?
+        (pipe)
+        #f))
+
+  (define parent-to-child-pipe
+    (if write?
+        (pipe)
+        #f))
+
+  (define (run-program)
+    (when read?
+      (match child-to-parent-pipe
+        ((input-port . output-port)
+         ;; close the output part of the child-to-parent-pipe, as this is used
+         ;; by the parent process
+         (close-port input-port)
+
+         ;; Make the input part of the child-to-parent-pipe the standard
+         ;; output of this process
+         (dup2 (fileno output-port) 1))))
+
+    (when write?
+      (match parent-to-child-pipe
+        ((input-port . output-port)
+         ;; close the input part of the parent-to-child-pipe, as this is used
+         ;; by the parent processs
+         (close-port output-port)
+
+         ;; Make the output part of the parent-to-child-pipe the standard
+         ;; input of this process
+         (dup2 (fileno input-port) 0))))
+
+    ;; TODO Maybe close all file descriptors, as start_child in Guile does?
+
+    (for-each putenv extra-environment-variables)
+
+    (apply execlp command))
+
+  (with-root-directory
+   (lambda (root)
+     (let ((pid (run-container root mounts namespaces host-uids run-program)))
+       ;; Catch SIGINT and kill the container process.
+       (sigaction SIGINT
+         (lambda (signum)
+           (false-if-exception
+            (kill pid SIGKILL))))
+
+       (let* ((read-port (and=> child-to-parent-pipe car))
+              (write-port (and=> parent-to-child-pipe cdr))
+
+              (port (or (and read-port write-port
+                             (make-rw-port read-port write-port))
+                        read-port
+                        write-port)))
+
+         (values port pid))))))
+
 (define* (run-container root mounts namespaces host-uids thunk
                         #:key (guest-uid 0) (guest-gid 0))
   "Run THUNK in a new container process and return its PID.  ROOT specifies
-- 
2.21.0





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 19 Apr 2019 14:04:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 10:04:31 2019
Received: from localhost ([127.0.0.1]:44414 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHU7z-0002Qy-1D
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:31 -0400
Received: from mira.cbaines.net ([212.71.252.8]:48052)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1hHU7w-0002QU-UD
 for 34638 <at> debbugs.gnu.org; Fri, 19 Apr 2019 10:04:29 -0400
Received: from localhost (71.38.6.51.dyn.plus.net [51.6.38.71])
 by mira.cbaines.net (Postfix) with ESMTPSA id B44D016ED2
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 15:04:27 +0100 (BST)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id e6a8908b
 for <34638 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 14:04:27 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH v2 3/4] inferior: Add a shared-directory field to <inferior>
Date: Fri, 19 Apr 2019 15:04:26 +0100
Message-Id: <20190419140427.15183-3-mail@HIDDEN>
X-Mailer: git-send-email 2.21.0
In-Reply-To: <20190419140427.15183-1-mail@HIDDEN>
References: <20190419140427.15183-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

---
 guix/inferior.scm | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 63c95141d7..6d18ab90e9 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -97,14 +97,15 @@
 
 ;; Inferior Guix process.
 (define-record-type <inferior>
-  (inferior pid socket close version packages table)
+  (inferior pid socket close shared-directory version packages table)
   inferior?
-  (pid      inferior-pid)
-  (socket   inferior-socket)
-  (close    inferior-close-socket)               ;procedure
-  (version  inferior-version)                    ;REPL protocol version
-  (packages inferior-package-promise)            ;promise of inferior packages
-  (table    inferior-package-table))             ;promise of vhash
+  (pid              inferior-pid)
+  (socket           inferior-socket)
+  (close            inferior-close-socket)       ;procedure
+  (shared-directory inferior-shared-directory)
+  (version          inferior-version)            ;REPL protocol version
+  (packages         inferior-package-promise)    ;promise of inferior packages
+  (table            inferior-package-table))     ;promise of vhash
 
 (define (inferior-pipe directory command)
   "Return an input/output pipe on the Guix instance in DIRECTORY.  This runs
@@ -136,7 +137,7 @@ it's an old Guix."
                           ((@ (guix scripts repl) machine-repl))))))
         pipe)))
 
-(define* (port->inferior pipe #:optional (close close-port))
+(define* (port->inferior pipe shared-directory #:optional (close close-port))
   "Given PIPE, an input/output port, return an inferior that talks over PIPE.
 PIPE is closed with CLOSE when 'close-inferior' is called on the returned
 inferior."
@@ -144,7 +145,8 @@ inferior."
 
   (match (read pipe)
     (('repl-version 0 rest ...)
-     (letrec ((result (inferior 'pipe pipe close (cons 0 rest)
+     (letrec ((result (inferior 'pipe pipe close shared-directory
+                                (cons 0 rest)
                                 (delay (%inferior-packages result))
                                 (delay (%inferior-package-table result)))))
        (inferior-eval '(use-modules (guix)) result)
@@ -162,7 +164,7 @@ equivalent.  Return #f if the inferior could not be launched."
   (define pipe
     (inferior-pipe directory command))
 
-  (port->inferior pipe close-pipe))
+  (port->inferior pipe #f close-pipe))
 
 (define (close-inferior inferior)
   "Close INFERIOR."
@@ -479,7 +481,8 @@ thus be the code of a one-argument procedure that accepts a store."
          ((client . address)
           (proxy client (store-connection-socket store))))
        (close-port socket)
-       (read-inferior-response inferior)))))
+       (read-inferior-response inferior)))
+   #:base-directory (inferior-shared-directory inferior)))
 
 (define* (inferior-package-derivation store package
                                       #:optional
-- 
2.21.0





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 14 Mar 2019 20:00:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 14 16:00:18 2019
Received: from localhost ([127.0.0.1]:44089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h4WWY-00005j-J9
	for submit <at> debbugs.gnu.org; Thu, 14 Mar 2019 16:00:18 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48892)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1h4WWW-00005R-Q5
 for 34638 <at> debbugs.gnu.org; Thu, 14 Mar 2019 16:00:17 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44068)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1h4WWN-0007ds-BD; Thu, 14 Mar 2019 16:00:09 -0400
Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=38382 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1h4UvL-0007th-FN; Thu, 14 Mar 2019 14:17:47 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Christopher Baines <mail@HIDDEN>
Subject: Re: [bug#34638] [PATCH 2/4] linux-container: Add
 'start-child-in-container'.
References: <20190224161855.2632-1-mail@HIDDEN>
 <20190224161855.2632-2-mail@HIDDEN>
Date: Thu, 14 Mar 2019 19:17:43 +0100
In-Reply-To: <20190224161855.2632-2-mail@HIDDEN> (Christopher Baines's
 message of "Sun, 24 Feb 2019 16:18:53 +0000")
Message-ID: <87lg1hiam0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34638
Cc: 34638 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello!

Christopher Baines <mail@HIDDEN> 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.




Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 14 Mar 2019 20:00:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 14 16:00:06 2019
Received: from localhost ([127.0.0.1]:44086 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h4WWM-0008Vm-0G
	for submit <at> debbugs.gnu.org; Thu, 14 Mar 2019 16:00:06 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48874)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1h4WWK-0008Uo-8O
 for 34638 <at> debbugs.gnu.org; Thu, 14 Mar 2019 16:00:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44048)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1h4WWC-0007Y6-RD; Thu, 14 Mar 2019 15:59:57 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=40084 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1h4W8z-0001zc-At; Thu, 14 Mar 2019 15:35:57 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Christopher Baines <mail@HIDDEN>
Subject: Re: [bug#34638] [PATCH 0/4] Isolated inferiors.
References: <875zt9go87.fsf@HIDDEN>
Date: Thu, 14 Mar 2019 20:35:53 +0100
In-Reply-To: <875zt9go87.fsf@HIDDEN> (Christopher Baines's message of
 "Sun, 24 Feb 2019 16:12:08 +0000")
Message-ID: <878sxhi6zq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34638
Cc: 34638 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello!

Christopher Baines <mail@HIDDEN> skribis:

> These patches form a prototype for Guix inferiors, that are
> isolated. Access to the inferior Guix is done through running a REPL as
> a separate process. These patches provide a way of launching that REPL
> in an isolated environment through Linux namespaces, providing some
> isolation from the wider system.
>
> These patches should work, at least enough to get the derivations for
> packages within the inferior Guix, as well as doing 'guix pull' within
> the inferior Guix.

This is really cool.

When we do this kind of thing (like also the =E2=80=9CCompute Guix derivati=
on=E2=80=9D
trampoline used by =E2=80=98guix pull=E2=80=99), it reminds me of what the =
Nix people
call =E2=80=9Crecursive Nix=E2=80=9D=E2=80=94the ability for a derivation=
=E2=80=99s build process to
compute other derivation.  If we had that, then basically what you=E2=80=99=
re
doing might just as well be a derivation.

BTW, thinking about it, for the Guix Data Service, would
=E2=80=98gexp->derivation-in-inferior=E2=80=99 be of any use?  This is used=
, for
example, to compute the package cache when running =E2=80=98guix pull=E2=80=
=99.  I
think it=E2=80=99s good enough if all you want is to extract basic file
meta-data, but it=E2=80=99s no good if you also want to extract package
derivations and the likes.

Or we could have a new store back-end that computes derivations in
memory and eventually spits a Nar=E2=80=A6

I=E2=80=99m just thinking out loud!

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 24 Feb 2019 16:19:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 24 11:19:06 2019
Received: from localhost ([127.0.0.1]:50389 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gxwUc-0003EV-2W
	for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:06 -0500
Received: from li622-129.members.linode.com ([212.71.249.129]:52266
 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gxwUU-0003DT-QZ
 for 34638 <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:00 -0500
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 017B616C4B
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:56 +0000 (GMT)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id f8498cad
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:55 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH 2/4] linux-container: Add 'start-child-in-container'.
Date: Sun, 24 Feb 2019 16:18:53 +0000
Message-Id: <20190224161855.2632-2-mail@HIDDEN>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190224161855.2632-1-mail@HIDDEN>
References: <20190224161855.2632-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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.
---
 gnu/build/linux-container.scm | 82 +++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 65e1325577..63c83902e4 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -32,6 +32,7 @@
             setgroups-supported?
             %namespaces
             run-container
+            start-child-in-container
             call-with-container
             container-excursion
             container-excursion*))
@@ -210,6 +211,87 @@ corresponds to the symbols in NAMESPACES."
                ('net  CLONE_NEWNET))
               namespaces)))
 
+(define* (start-child-in-container command
+                                   #:key read? write?
+                                   (root 'temporary)
+                                   (mounts '())
+                                   (namespaces %namespaces)
+                                   (host-uids 1)
+                                   (extra-environment-variables '()))
+  (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))
+
+  ;; car is the inport port, cdr is the output port. You write to the output
+  ;; port, and read from the input port.
+  (define child-to-parent-pipe
+    (if read?
+        (pipe)
+        #f))
+
+  (define parent-to-child-pipe
+    (if write?
+        (pipe)
+        #f))
+
+  (define (run-program)
+    (when read?
+      (match child-to-parent-pipe
+        ((input-port . output-port)
+         ;; close the output part of the child-to-parent-pipe, as this is used
+         ;; by the parent process
+         (close-port input-port)
+
+         ;; Make the input part of the child-to-parent-pipe the standard
+         ;; output of this process
+         (dup2 (fileno output-port) 1))))
+
+    (when write?
+      (match parent-to-child-pipe
+        ((input-port . output-port)
+         ;; close the input part of the parent-to-child-pipe, as this is used
+         ;; by the parent processs
+         (close-port output-port)
+
+         ;; Make the output part of the parent-to-child-pipe the standard
+         ;; input of this process
+         (dup2 (fileno input-port) 0))))
+
+    ;; TODO Maybe close all file descriptors, as start_child in Guile does?
+
+    (for-each putenv extra-environment-variables)
+
+    (apply execlp command))
+
+  (with-root-directory
+   (lambda (root)
+     (let ((pid (run-container root mounts namespaces host-uids run-program)))
+       ;; Catch SIGINT and kill the container process.
+       (sigaction SIGINT
+         (lambda (signum)
+           (false-if-exception
+            (kill pid SIGKILL))))
+
+       (let* ((read-port (and=> child-to-parent-pipe car))
+              (write-port (and=> parent-to-child-pipe cdr))
+
+              (port (or (and read-port write-port
+                             (make-rw-port read-port write-port))
+                        read-port
+                        write-port))
+              (pipe-info (make-pipe-info pid)))
+
+         (pipe-guardian pipe-info)
+         (%set-port-property! port 'popen-pipe-info pipe-info)
+
+         port)))))
+
 (define (run-container root mounts namespaces host-uids thunk)
   "Run THUNK in a new container process and return its PID.  ROOT specifies
 the root directory for the container.  MOUNTS is a list of <file-system>
-- 
2.20.1





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 24 Feb 2019 16:19:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 24 11:19:06 2019
Received: from localhost ([127.0.0.1]:50387 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gxwUb-0003ET-P5
	for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:06 -0500
Received: from li622-129.members.linode.com ([212.71.249.129]:52262
 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gxwUU-0003DQ-O0
 for 34638 <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:00 -0500
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 9449B16C97
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:57 +0000 (GMT)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 510293e9
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:55 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH 4/4] inferior: Add 'open-inferior/container'.
Date: Sun, 24 Feb 2019 16:18:55 +0000
Message-Id: <20190224161855.2632-4-mail@HIDDEN>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190224161855.2632-1-mail@HIDDEN>
References: <20190224161855.2632-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

---
 guix/inferior.scm | 65 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index cf72454426..a5f773c147 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -40,6 +40,9 @@
   #:use-module (guix store)
   #:use-module (guix derivations)
   #:use-module (guix base32)
+  #:use-module (gnu system file-systems)
+  #:use-module (gnu build linux-container)
+  #:use-module (guix build syscalls)
   #:use-module (gcrypt hash)
   #:autoload   (guix cache) (maybe-remove-expired-cache-entries)
   #:autoload   (guix ui) (show-what-to-build*)
@@ -54,6 +57,7 @@
   #:use-module ((rnrs bytevectors) #:select (string->utf8))
   #:export (inferior?
             open-inferior
+            open-inferior/container
             port->inferior
             close-inferior
             inferior-eval
@@ -137,6 +141,67 @@ it's an old Guix."
                           ((@ (guix scripts repl) machine-repl))))))
         pipe)))
 
+(define* (open-inferior/container store guix-store-item
+                                  #:key
+                                  (command "bin/guix")
+                                  (share-host-network? #f)
+                                  (extra-shared-directories '())
+                                  (extra-environment-variables '()))
+  (define requisite-store-items
+    (requisites store (list guix-store-item)))
+
+  (define shared-directory
+    (mkdtemp! (string-append (or (getenv "TMPDIR") "/tmp")
+                             "/guix-inferior.XXXXXX")))
+
+  (define mappings
+    (append
+     (map (lambda (dir)
+            (file-system-mapping
+             (source dir)
+             (target dir)
+             (writable? #f)))
+          `(;; Share a directory, used in inferior-eval-with-store
+            ,shared-directory
+            ,@requisite-store-items
+            ,@extra-shared-directories))
+     (if share-host-network?
+         %network-file-mappings
+         '())))
+
+  (define mounts
+    (append %container-file-systems
+            (map file-system-mapping->bind-mount
+                 mappings)))
+
+  (define (inferior-pipe/container store
+                                   guix-store-item
+                                   shared-directory
+                                   command)
+    (start-child-in-container
+     (list (string-append guix-store-item "/bin/guix")
+           ;; TODO I'm not sure why "repl" is duplicated in the following
+           ;; command
+           "repl" "repl" "-t" "machine")
+     #:read? #t
+     #:write? #t
+     #:mounts mounts
+     #:namespaces (if share-host-network?
+                      (delq 'net %namespaces)
+                      %namespaces)
+     #:extra-environment-variables
+     `(;; Set HOME, so that the (guix profiles) module can be loaded, without it
+       ;; trying to read from /etc/passwd
+       "HOME=/tmp"
+       ,@extra-environment-variables)))
+
+  (port->inferior (inferior-pipe/container store
+                                           guix-store-item
+                                           shared-directory
+                                           command)
+                  shared-directory
+                  close-pipe))
+
 (define* (port->inferior pipe shared-directory #:optional (close close-port))
   "Given PIPE, an input/output port, return an inferior that talks over PIPE.
 PIPE is closed with CLOSE when 'close-inferior' is called on the returned
-- 
2.20.1





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 24 Feb 2019 16:19:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 24 11:19:01 2019
Received: from localhost ([127.0.0.1]:50385 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gxwUX-0003E1-C8
	for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:01 -0500
Received: from li622-129.members.linode.com ([212.71.249.129]:52264
 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gxwUU-0003DS-O2
 for 34638 <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:18:59 -0500
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 49ABE16C96
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:57 +0000 (GMT)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id ccada29c
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:55 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH 3/4] inferior: Add a shared-directory field to <inferior>
Date: Sun, 24 Feb 2019 16:18:54 +0000
Message-Id: <20190224161855.2632-3-mail@HIDDEN>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190224161855.2632-1-mail@HIDDEN>
References: <20190224161855.2632-1-mail@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

---
 guix/inferior.scm | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 027418a98d..cf72454426 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -97,14 +97,15 @@
 
 ;; Inferior Guix process.
 (define-record-type <inferior>
-  (inferior pid socket close version packages table)
+  (inferior pid socket close shared-directory version packages table)
   inferior?
-  (pid      inferior-pid)
-  (socket   inferior-socket)
-  (close    inferior-close-socket)               ;procedure
-  (version  inferior-version)                    ;REPL protocol version
-  (packages inferior-package-promise)            ;promise of inferior packages
-  (table    inferior-package-table))             ;promise of vhash
+  (pid              inferior-pid)
+  (socket           inferior-socket)
+  (close            inferior-close-socket)       ;procedure
+  (shared-directory inferior-shared-directory)
+  (version          inferior-version)            ;REPL protocol version
+  (packages         inferior-package-promise)    ;promise of inferior packages
+  (table            inferior-package-table))     ;promise of vhash
 
 (define (inferior-pipe directory command)
   "Return an input/output pipe on the Guix instance in DIRECTORY.  This runs
@@ -136,7 +137,7 @@ it's an old Guix."
                           ((@ (guix scripts repl) machine-repl))))))
         pipe)))
 
-(define* (port->inferior pipe #:optional (close close-port))
+(define* (port->inferior pipe shared-directory #:optional (close close-port))
   "Given PIPE, an input/output port, return an inferior that talks over PIPE.
 PIPE is closed with CLOSE when 'close-inferior' is called on the returned
 inferior."
@@ -144,7 +145,8 @@ inferior."
 
   (match (read pipe)
     (('repl-version 0 rest ...)
-     (letrec ((result (inferior 'pipe pipe close (cons 0 rest)
+     (letrec ((result (inferior 'pipe pipe close shared-directory
+                                (cons 0 rest)
                                 (delay (%inferior-packages result))
                                 (delay (%inferior-package-table result)))))
        (inferior-eval '(use-modules (guix)) result)
@@ -162,7 +164,7 @@ equivalent.  Return #f if the inferior could not be launched."
   (define pipe
     (inferior-pipe directory command))
 
-  (port->inferior pipe close-pipe))
+  (port->inferior pipe #f close-pipe))
 
 (define (close-inferior inferior)
   "Close INFERIOR."
@@ -479,7 +481,8 @@ thus be the code of a one-argument procedure that accepts a store."
          ((client . address)
           (proxy client (store-connection-socket store))))
        (close-port socket)
-       (read-inferior-response inferior)))))
+       (read-inferior-response inferior)))
+   #:base-directory (inferior-shared-directory inferior)))
 
 (define* (inferior-package-derivation store package
                                       #:optional
-- 
2.20.1





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at 34638 <at> debbugs.gnu.org:


Received: (at 34638) by debbugs.gnu.org; 24 Feb 2019 16:19:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 24 11:19:01 2019
Received: from localhost ([127.0.0.1]:50383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gxwUX-0003Dt-0u
	for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:19:01 -0500
Received: from li622-129.members.linode.com ([212.71.249.129]:52268
 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gxwUU-0003DU-Qd
 for 34638 <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:18:59 -0500
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 88ADB16C20
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:56 +0000 (GMT)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id bddd0a77
 for <34638 <at> debbugs.gnu.org>; Sun, 24 Feb 2019 16:18:55 +0000 (UTC)
From: Christopher Baines <mail@HIDDEN>
To: 34638 <at> debbugs.gnu.org
Subject: [PATCH 1/4] utils: Add #:base-directory to
 call-with-temporary-directory.
Date: Sun, 24 Feb 2019 16:18:52 +0000
Message-Id: <20190224161855.2632-1-mail@HIDDEN>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 34638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This allows more easily creating temporary directories within a specific
directory. This is motivated by using this in inferior-eval-with-store.

* guix/utils.scm (call-with-temporary-directory): Add optional keyword
argument, base-directory.
---
 guix/utils.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index ed1a418cca..abeb156f40 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -620,10 +620,10 @@ call."
         (false-if-exception (close out))
         (false-if-exception (delete-file template))))))
 
-(define (call-with-temporary-directory proc)
+(define* (call-with-temporary-directory proc #:key base-directory)
   "Call PROC with a name of a temporary directory; close the directory and
 delete it when leaving the dynamic extent of this call."
-  (let* ((directory (or (getenv "TMPDIR") "/tmp"))
+  (let* ((directory (or base-directory (getenv "TMPDIR") "/tmp"))
          (template  (string-append directory "/guix-directory.XXXXXX"))
          (tmp-dir   (mkdtemp! template)))
     (dynamic-wind
-- 
2.20.1





Information forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Feb 2019 16:12:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 24 11:12:26 2019
Received: from localhost ([127.0.0.1]:50375 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gxwOA-000342-7U
	for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:12:26 -0500
Received: from eggs.gnu.org ([209.51.188.92]:48891)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1gxwO7-00033p-4Z
 for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:12:23 -0500
Received: from lists.gnu.org ([209.51.188.17]:38777)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mail@HIDDEN>) id 1gxwO2-00040a-1X
 for submit <at> debbugs.gnu.org; Sun, 24 Feb 2019 11:12:18 -0500
Received: from eggs.gnu.org ([209.51.188.92]:35038)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gxwO1-0000IC-57
 for guix-patches@HIDDEN; Sun, 24 Feb 2019 11:12:17 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gxwO0-0003wj-12
 for guix-patches@HIDDEN; Sun, 24 Feb 2019 11:12:17 -0500
Received: from mira.cbaines.net ([2a01:7e00::f03c:91ff:fe69:8da9]:34030)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mail@HIDDEN>) id 1gxwNz-0003sH-PE
 for guix-patches@HIDDEN; Sun, 24 Feb 2019 11:12:15 -0500
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 63DED16C20
 for <guix-patches@HIDDEN>; Sun, 24 Feb 2019 16:12:11 +0000 (GMT)
Received: from capella (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 5a94c0be
 for <guix-patches@HIDDEN>; Sun, 24 Feb 2019 16:12:11 +0000 (UTC)
User-agent: mu4e 1.0; emacs 26.1
From: Christopher Baines <mail@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/4] Isolated inferiors.
Date: Sun, 24 Feb 2019 16:12:08 +0000
Message-ID: <875zt9go87.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a01:7e00::f03c:91ff:fe69:8da9
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

These patches form a prototype for Guix inferiors, that are
isolated. Access to the inferior Guix is done through running a REPL as
a separate process. These patches provide a way of launching that REPL
in an isolated environment through Linux namespaces, providing some
isolation from the wider system.

These patches should work, at least enough to get the derivations for
packages within the inferior Guix, as well as doing 'guix pull' within
the inferior Guix.

They're not ready to be merged just yet though. I think some of the
approaches are a little odd (e.g. using (ice-9 popen) internals) and
I've got no idea if the isolation is actually working properly.


Christopher Baines (4):
  utils: Add #:base-directory to call-with-temporary-directory.
  linux-container: Add 'start-child-in-container'.
  inferior: Add a shared-directory field to <inferior>
  inferior: Add 'open-inferior/container'.

 gnu/build/linux-container.scm | 82 +++++++++++++++++++++++++++++++
 guix/inferior.scm             | 90 ++++++++++++++++++++++++++++++-----
 guix/utils.scm                |  4 +-
 3 files changed, 163 insertions(+), 13 deletions(-)

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlxywlhfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XfDjg//W/v3E1k3KSBgq/cbEB3eDzShPBdOfQjXsm+8NtdZUtmifuzomzQPbSRb
MdtFZzv1u91baWGc7OcArUujtDb7BJJFOdPLbaU+X5ypEsvdNHdndJTuPSefQS4V
rAmbJFLi7vdgqguO8kp5UqT/mHoLDqNPcvCMYQFrlpF6hu1nIHGxtKyTX7TmGVOD
amLBFkHr1IF47Fy8+gahkz50jvW5bvc2kyUwXGFUU4xfB/shgKHuq7tZQDHbZwrz
IwHEBT2Db4g6bJYb5XP0MpqBLaN9CSCCjaNUTo7Y4rxDxCiiOfkwLZtdugt1ghH7
RnYApd9SMNf90VSjVJithX8Y/FtTCOsh+DVqPwEW0fVIDM0XZJ1a7V7JE3WKAy9+
sNMX0AF4o9VxSSJXupAYb/vqXD3DhctY17VszZDVimkuyAvb3IAipdMiRe5rbQ0O
8SSFXxmvQ+eQsSQ5YF5oq462DZmJ9yhkEXApIS3bwhWXqZw9gzxX8IPUWfAobVtc
CpSYhsNDwyz5h0Iult+9rovwDBWu4DtsmRs7L1tykbvSNWOWhgFAqpTf+lx2V6J/
F/XQe6dFuy26c3vH0xVbjSZsWRiqhBXBsRyHtiijI8ctZ5w2fbkzKH3F04st3yRv
ARqN+r66Zi207Y5HiSVGxZiYReFoS9i+RL9IJWcxdcMsPJDm0Dk=
=PrMq
-----END PGP SIGNATURE-----
--=-=-=--




Acknowledgement sent to Christopher Baines <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#34638; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.