From ef5ddb0e1715328713c2c9edad897f9a27de692f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 26 Aug 2020 15:30:04 +0200 Subject: services: mcron: Validate jobs even in the presence of #:user. Fixes a bug in 949672c923b6a3953471c446e0b19f30be335572 whereby jobs specifying a #:user not available in the build environment would fail validation. Reported by Maxim Cournoyer. * gnu/services/mcron.scm (job-files)[validated-file]: Add "prologue" file and pass it to 'mcron --schedule'. --- gnu/services/mcron.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 045d6e2fe8..bd4e6e7410 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -67,12 +67,21 @@ #~(begin (use-modules (guix build utils)) + (call-with-output-file "prologue" + (lambda (port) + ;; This prologue allows 'mcron --schedule' to + ;; proceed no matter what #:user option is passed + ;; to 'job'. + (write '(set! getpw + (const (getpwuid (getuid)))) + port))) + (call-with-output-file "job" (lambda (port) (write '#$job port))) (invoke #+(file-append mcron "/bin/mcron") - "--schedule=20" "job") + "--schedule=20" "prologue" "job") (copy-file "job" #$output))) #:options '(#:env-vars (("COLUMNS" . "150"))))) -- cgit 1.4.1