bug-mcron
[Top][All Lists]
Advanced

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

[PATCH] Handle nonexistent user home directories.


From: Maxim Cournoyer
Subject: [PATCH] Handle nonexistent user home directories.
Date: Mon, 09 Aug 2021 11:51:58 -0400

Hello mcron,

This patch adds error handling so that a job run as a user with a
nonexistent home directory doesn't fail; this is the case when using the
"nobody" user on a Guix System for example, which has its (nonexistent)
home directory set to /nonexistent.

I ran the test suite, removing the workaround "/nonexistent" directory I
had been carrying and reconfigured my Guix System with the following
diff applied to it:

--8<---------------cut here---------------start------------->8---
modified   guix/hurd.scm
@@ -2,7 +2,14 @@
 ;;; RAID-1c3 storage bay.
 (use-modules (gnu)
              (guix modules)
-             (srfi srfi-1))
+             (srfi srfi-1)
+             ;; for mcron experiment
+             (gnu packages autotools)
+             (gnu packages guile-xyz)
+             (gnu packages man)
+             (gnu packages texinfo)
+             (guix git)
+             (guix packages))
 
 (use-service-modules admin desktop docker linux mail mcron networking nfs nix
                      spice ssh sysctl telephony virtualization vpn xorg)
@@ -196,6 +203,15 @@
         (pam-limits-entry "@realtime" 'both 'memlock 'unlimited)))
       (service mcron-service-type
                (mcron-configuration
+                (mcron (package/inherit mcron
+                         (source (git-checkout
+                                  (url "file:///home/maxim/src/mcron")))
+                         (native-inputs (append
+                                         `(("autoconf" ,autoconf)
+                                           ("automake" ,automake)
+                                           ("help2man" ,help2man)
+                                           ("texinfo" ,texinfo))
+                                         (package-native-inputs mcron)))))
                 (jobs (list duckdns-job
                             backup-home-job
                             updatedb-job
@@ -205,11 +221,6 @@
                (libvirt-configuration
                 (unix-sock-group "libvirt")))
       (service virtlog-service-type)
-      ;; FIXME: Prevent mcron from attempting (chdir "/nonexistent")
-      ;; in non-existent directory ($HOME).
-      (extra-special-file "/nonexistent" (computed-file "nonexistent"
-                                                        #~(begin
-                                                            (mkdir #$output))))
       (service wireguard-service-type
                (wireguard-configuration
                 (addresses '("10.0.1.1/32"))
--8<---------------cut here---------------end--------------->8---

Mcron seems to be running happily with the job running as the "nobody"
user firing happily.

Thank you,

Maxim

Attachment: 0001-base-Handle-nonexistent-user-home-directories.patch
Description: Text Data


reply via email to

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