guix-devel
[Top][All Lists]
Advanced

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

[PATCH shepherd] support: Ignore errors on parent directories in mkdir-p


From: David Michael
Subject: [PATCH shepherd] support: Ignore errors on parent directories in mkdir-p.
Date: Tue, 02 Feb 2016 11:24:17 -0500

* modules/shepherd/support.scm (mkdir-p): Don't throw errors when
  mkdir fails and there are more subdirectory components to try.
---

Hi,

My use case for this is that I have a crazy Hurd setup that boots a
read-only root file system with a passive tmpfs translator on /run.
When mkdir-p runs with "/run/shepherd", it tries to mkdir "/run".  On
Hurd, mkdir first tests for a read-only file system, so mkdir-p catches
and throws EROFS instead of catching and ignoring EEXIST.  The init
process then dies when it tries to stat the non-existent /run/shepherd.

This patch ignores all errors from parent directories, assuming we only
really care about the status of creating the final path component.

Another possibility could be to try to change Hurd's error ordering
instead, but it seems to be acceptably standard behavior:

    If more than one error occurs in processing a function call, any one
    of the possible errors may be returned, as the order of detection is
    undefined.[0]

Can this be applied, or do you prefer another option?

Thanks.

David

[0] http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_03.html

 modules/shepherd/support.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 9bc5f5d..3106212 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -172,7 +172,7 @@ output port, and PROC's result is returned."
                  (mkdir path))
              (loop tail path))
            (lambda args
-             (if (= EEXIST (system-error-errno args))
+             (if (or (not (null? tail)) (= EEXIST (system-error-errno args)))
                  (loop tail path)
                  (apply throw args))))))
       (() #t))))
-- 
2.5.0




reply via email to

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