[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/17: services: user-homes: Do not create home directories marked as no
From: |
Ludovic Courtès |
Subject: |
11/17: services: user-homes: Do not create home directories marked as no-create. |
Date: |
Sat, 20 May 2017 04:24:05 -0400 (EDT) |
civodul pushed a commit to branch version-0.13.0
in repository guix.
commit 51fe9cd38d4d64b5fade8a899d5323da0e217d5c
Author: Ludovic Courtès <address@hidden>
Date: Thu May 18 10:08:55 2017 +0200
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.
---
gnu/build/activation.scm | 9 ++++++++-
gnu/tests/base.scm | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index beee56d..a1d2a9c 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)))
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 37aab8e..e5ac320 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
- branch version-0.13.0 updated (920803f -> 03119da), Ludovic Courtès, 2017/05/20
- 04/17: profiles: Add elapsed time to manual-database hook to output message., Ludovic Courtès, 2017/05/20
- 01/17: gnu: tor: Update to 0.3.0.7., Ludovic Courtès, 2017/05/20
- 02/17: gnu: glibc/hurd: Use modify-phases syntax., Ludovic Courtès, 2017/05/20
- 03/17: gnu: glibc/hurd: Do not apply i686 patch., Ludovic Courtès, 2017/05/20
- 06/17: build: Compile stackage only if 'guile-json' is available., Ludovic Courtès, 2017/05/20
- 09/17: services: openssh: Don't depend on networking., Ludovic Courtès, 2017/05/20
- 11/17: services: user-homes: Do not create home directories marked as no-create.,
Ludovic Courtès <=
- 10/17: install: Enable SSH in installation image., Ludovic Courtès, 2017/05/20
- 15/17: gnu: guile-ssh: Fix potential double-free/use-after-free issue., Ludovic Courtès, 2017/05/20
- 07/17: gnu: aspell: 'dict-dir' set to ~/.guix-profile/lib/aspell or $ASPELL_DICT_DIR., Ludovic Courtès, 2017/05/20
- 14/17: modules: Add more source-less modules., Ludovic Courtès, 2017/05/20
- 12/17: union: Gracefully handle dangling symlinks in the input., Ludovic Courtès, 2017/05/20
- 13/17: publish: Fix narinfo rendering for already-compressed items., Ludovic Courtès, 2017/05/20
- 17/17: vm: Support creating FAT partitions., Ludovic Courtès, 2017/05/20
- 05/17: gnu: qemu: Fix CVE-2017-7493., Ludovic Courtès, 2017/05/20
- 08/17: maint: The 'release' target builds a VM image., Ludovic Courtès, 2017/05/20
- 16/17: vm: Support arbitrary partition flags., Ludovic Courtès, 2017/05/20