From f92151133da4b98f98e755ce0996e8be59acac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 25 Sep 2024 16:30:09 +0200 Subject: [PATCH] =?UTF-8?q?services:=20cleanup:=20Reintroduce=20explicit?= =?UTF-8?q?=20=E2=80=98chmod=E2=80=99=20calls.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e74d05db53fdf02956ccee0950896c6ca9f10573. * gnu/services.scm (cleanup-gexp): Introduce explicit ‘chmod’ calls after ‘mkdir’ calls. * gnu/tests/base.scm (run-basic-test)[test]("permissions on /tmp"): New test. Reported-by: Hilton Chain Change-Id: I1e14dbe52eac526d2ed4ec1dd9c6fd9036f96a63 --- gnu/services.scm | 7 ++++++- gnu/tests/base.scm | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gnu/services.scm b/gnu/services.scm index 9b7f2641b7..8a4002e072 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -665,9 +665,14 @@ (define (cleanup-gexp _) (delete-file-recursively "/var/run") (delete-file-recursively "/run") + ;; Note: The second argument to 'mkdir' is and'ed with umask, + ;; hence the 'chmod' calls. (mkdir "/tmp" #o1777) + (chmod "/tmp" #o1777) (mkdir "/var/run" #o755) - (mkdir "/run" #o755)))))) + (chmod "/var/run" #o755) + (mkdir "/run" #o755) + (chmod "/var/run" #o755)))))) (define cleanup-service-type ;; Service that cleans things up in /tmp and similar. diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 715b9036f9..e1a676ecd4 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -296,6 +296,10 @@ (define (user-owned? file) (operating-system-user-accounts os)))) (stat:perms (marionette-eval `(stat ,root-home) marionette)))) + (test-equal "permissions on /tmp" + #o1777 + (stat:perms (marionette-eval '(lstat "/tmp") marionette))) + (test-equal "ownership and permissions of /var/empty" '(0 0 #o555) (let ((st (marionette-eval `(stat "/var/empty") marionette)))