guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: services: mcron: Validate jobs even in the presen


From: guix-commits
Subject: branch master updated: services: mcron: Validate jobs even in the presence of #:user.
Date: Wed, 26 Aug 2020 09:35:06 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new ef5ddb0  services: mcron: Validate jobs even in the presence of #:user.
ef5ddb0 is described below

commit ef5ddb0e1715328713c2c9edad897f9a27de692f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Aug 26 15:30:04 2020 +0200

    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 045d6e2..bd4e6e7 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")))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]