From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Michael Subject: [PATCH shepherd] support: Ignore errors on parent directories in mkdir-p. Date: Tue, 02 Feb 2016 11:24:17 -0500 Message-ID: <8760y7axn2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQdkZ-0004kK-KR for guix-devel@gnu.org; Tue, 02 Feb 2016 11:24:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQdkY-0008Fa-FP for guix-devel@gnu.org; Tue, 02 Feb 2016 11:24:19 -0500 Received: from mail-qg0-x243.google.com ([2607:f8b0:400d:c04::243]:34535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQdkY-0008FR-Ae for guix-devel@gnu.org; Tue, 02 Feb 2016 11:24:18 -0500 Received: by mail-qg0-x243.google.com with SMTP id 94so11963783qgt.1 for ; Tue, 02 Feb 2016 08:24:18 -0800 (PST) Received: from callisto ([2607:f470:2:1:22c9:d0ff:fe29:dfc8]) by smtp.gmail.com with ESMTPSA id 197sm943235qhr.36.2016.02.02.08.24.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 08:24:17 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * 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