summary refs log tree commit diff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-05-18 10:08:55 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-20 10:17:10 +0200
commit51fe9cd38d4d64b5fade8a899d5323da0e217d5c (patch)
tree27dd58ab42b8517bb2a0805dff813bec40b9a060 /gnu/tests
parentf3f8938fe0c07d221ebccdf5a9a0029fda01f036 (diff)
downloadguix-51fe9cd38d4d64b5fade8a899d5323da0e217d5c.tar.gz
services: user-homes: Do not create home directories marked as no-create.
Fixes a bug whereby GuixSD would create the /nonexistent directory, from
user 'nobody', even though it has 'create-home-directory?' set to #f.

* gnu/build/activation.scm (activate-users+groups): Add comment for
\#:create-home?.
(activate-user-home)[ensure-user-home]: Skip when CREATE-HOME? is #f or
SYSTEM? is #t.
* gnu/tests/base.scm (run-basic-test)["no extra home directories"]: New
tests.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 37aab8ef67..e5ac320b74 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -199,6 +199,28 @@ info --version")
                          ',users+homes))
                marionette)))
 
+          (test-equal "no extra home directories"
+            '()
+
+            ;; Make sure the home directories that are not supposed to be
+            ;; created are indeed not created.
+            (let ((nonexistent
+                   '#$(filter-map (lambda (user)
+                                    (and (not
+                                          (user-account-create-home-directory?
+                                           user))
+                                         (user-account-home-directory user)))
+                                  (operating-system-user-accounts os))))
+              (marionette-eval
+               `(begin
+                  (use-modules (srfi srfi-1))
+
+                  ;; Note: Do not flag "/var/empty".
+                  (filter file-exists?
+                          ',(remove (cut string-prefix? "/var/" <>)
+                                    nonexistent)))
+               marionette)))
+
           (test-equal "login on tty1"
             "root\n"
             (begin