GNU bug report logs - #35851
[PATCH] linux-container: Check if nscd run directory exists when container is run.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Tue, 21 May 2019 20:43:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35851 in the body.
You can then email your comments to 35851 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#35851; Package guix-patches. (Tue, 21 May 2019 20:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 21 May 2019 20:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: guix-patches <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] linux-container: Check if nscd run directory exists when
 container is run.
Date: Wed, 22 May 2019 01:59:27 +0530
* gnu/system/linux-container.scm (containerized-operating-system):
(container-script): Check for existence of the host nscd run directory in the
container script. This check should be run when the container is started, not
when the container script is created.
[network-mappings]: Delete variable.
[nscd-run-directory, nscd-mapping]: New variables.
---
 gnu/system/linux-container.scm | 53 ++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index 16eee7a3cd..c1e963d047 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -109,7 +109,10 @@ containerized OS.  EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
                         (memq (service-kind service)
                               useless-services))
                       (operating-system-user-services os)))
-    (file-systems (append (map mapping->fs mappings)
+    (file-systems (append (map mapping->fs
+                               (if shared-network?
+                                   (append %network-file-mappings mappings)
+                                   mappings))
                           extra-file-systems
                           user-file-systems
 
@@ -124,32 +127,33 @@ containerized OS.  EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
   "Return a derivation of a script that runs OS as a Linux container.
 MAPPINGS is a list of <file-system> objects that specify the files/directories
 that will be shared with the host system."
-  (define network-mappings
-    ;; Files to map if network is to be shared with the host
-    (append %network-file-mappings
-            (let ((nscd-run-directory "/var/run/nscd"))
-              (if (file-exists? nscd-run-directory)
-                  (list (file-system-mapping
-                         (source nscd-run-directory)
-                         (target nscd-run-directory)))
-                  '()))))
+  (define nscd-run-directory "/var/run/nscd")
+
+  (define nscd-mapping
+    (file-system-mapping
+     (source nscd-run-directory)
+     (target nscd-run-directory)))
 
   (define (mountable-file-system? file-system)
     ;; Return #t if FILE-SYSTEM should be mounted in the container.
     (and (not (string=? "/" (file-system-mount-point file-system)))
          (file-system-needed-for-boot? file-system)))
 
-  (let* ((os           (containerized-operating-system
-                        os
-                        (cons %store-mapping
-                              (if shared-network?
-                                  (append network-mappings mappings)
-                                  mappings))
-                        #:shared-network? shared-network?
-                        #:extra-file-systems %container-file-systems))
-         (file-systems (filter mountable-file-system?
-                               (operating-system-file-systems os)))
-         (specs        (map file-system->spec file-systems)))
+  (define (os-file-system-specs os)
+    (map file-system->spec
+         (filter mountable-file-system?
+                 (operating-system-file-systems os))))
+
+  (let* ((os (containerized-operating-system
+              os (cons %store-mapping mappings)
+              #:shared-network? shared-network?
+              #:extra-file-systems %container-file-systems))
+         (nscd-os (containerized-operating-system
+                   os (cons* nscd-mapping %store-mapping mappings)
+                   #:shared-network? shared-network?
+                   #:extra-file-systems %container-file-systems))
+         (specs (os-file-system-specs os))
+         (nscd-specs (os-file-system-specs nscd-os)))
 
     (define script
       (with-imported-modules (source-module-closure
@@ -160,7 +164,12 @@ that will be shared with the host system."
                          (gnu system file-systems) ;spec->file-system
                          (guix build utils))
 
-            (call-with-container (map spec->file-system '#$specs)
+            (call-with-container
+                (map spec->file-system
+                     (if (and #$shared-network?
+                              (file-exists? #$nscd-run-directory))
+                         '#$nscd-specs
+                         '#$specs))
               (lambda ()
                 (setenv "HOME" "/root")
                 (setenv "TMPDIR" "/tmp")
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#35851; Package guix-patches. (Fri, 24 May 2019 16:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 35851 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 35851 <at> debbugs.gnu.org
Subject: Re: [bug#35851] [PATCH] linux-container: Check if nscd run directory
 exists when container is run.
Date: Fri, 24 May 2019 18:02:00 +0200
Hi Arun,

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

> * gnu/system/linux-container.scm (containerized-operating-system):
> (container-script): Check for existence of the host nscd run directory in the
> container script. This check should be run when the container is started, not
> when the container script is created.
> [network-mappings]: Delete variable.
> [nscd-run-directory, nscd-mapping]: New variables.

LGTM, thanks!

Ludo’.




Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Sat, 25 May 2019 06:03:02 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Sat, 25 May 2019 06:03:02 GMT) Full text and rfc822 format available.

Message #13 received at 35851-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35851-done <at> debbugs.gnu.org
Subject: Re: [bug#35851] [PATCH] linux-container: Check if nscd run directory
 exists when container is run.
Date: Sat, 25 May 2019 11:31:57 +0530
[Message part 1 (text/plain, inline)]
> LGTM, thanks!

Pushed, thanks!
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 22 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 302 days ago.

Previous Next


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