summary refs log tree commit diff
path: root/gnu/build
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-18 10:55:16 +0200
commit41f76ae08a7a830cdeb1eaac271d714cb58fbce3 (patch)
treef43d38cdd14456d698bbd09927e78cb6fe383f30 /gnu/build
parenta20e00ddaf343c8bebc608ebe59c4204deb065d1 (diff)
downloadguix-41f76ae08a7a830cdeb1eaac271d714cb58fbce3.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/build')
-rw-r--r--gnu/build/activation.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index beee56d437..a1d2a9cc7d 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -227,7 +227,11 @@ numeric gid or #f."
                      #:supplementary-groups supplementary-groups
                      #:comment comment
                      #:home home
+
+                     ;; Home directories of non-system accounts are created by
+                     ;; 'activate-user-home'.
                      #:create-home? (and create-home? system?)
+
                      #:shell shell
                      #:password password)
 
@@ -282,7 +286,10 @@ they already exist."
     (match-lambda
       ((name uid group supplementary-groups comment home create-home?
              shell password system?)
-       (unless (or (not home) (directory-exists? home))
+       ;; The home directories of system accounts are created during
+       ;; activation, not here.
+       (unless (or (not home) (not create-home?) system?
+                   (directory-exists? home))
          (let* ((pw  (getpwnam name))
                 (uid (passwd:uid pw))
                 (gid (passwd:gid pw)))