services: cleanup: Reintroduce explicit ‘chmod’ calls.

This reverts commit e74d05db53.

* 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 <hako@ultrarare.space>
Change-Id: I1e14dbe52eac526d2ed4ec1dd9c6fd9036f96a63
This commit is contained in:
Ludovic Courtès 2024-09-25 16:30:09 +02:00
parent a1dc5ac832
commit f92151133d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 10 additions and 1 deletions

View file

@ -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.

View file

@ -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)))