unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH shepherd] support: Ignore errors on parent directories in mkdir-p.
@ 2016-02-02 16:24 David Michael
  2016-02-04 16:47 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: David Michael @ 2016-02-02 16:24 UTC (permalink / raw)
  To: guix-devel

* 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-06 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 16:24 [PATCH shepherd] support: Ignore errors on parent directories in mkdir-p David Michael
2016-02-04 16:47 ` Ludovic Courtès
2016-02-05 18:22   ` David Michael
2016-02-06 13:14     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).