From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH shepherd] support: Ignore errors on parent directories in mkdir-p. Date: Thu, 04 Feb 2016 17:47:07 +0100 Message-ID: <87d1scbeyc.fsf@gnu.org> References: <8760y7axn2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRN3q-0005vM-Ee for guix-devel@gnu.org; Thu, 04 Feb 2016 11:47:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRN3n-00048m-5x for guix-devel@gnu.org; Thu, 04 Feb 2016 11:47:14 -0500 In-Reply-To: <8760y7axn2.fsf@gmail.com> (David Michael's message of "Tue, 02 Feb 2016 11:24:17 -0500") 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: David Michael Cc: guix-devel@gnu.org David Michael skribis: > 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] Interesting! I think that it=E2=80=99s a case where it would be beneficial for the Hurd = to follow what Linux does, which is to return EEXIST. How does Coreutils=E2=80=99 =E2=80=98mkdir -p=E2=80=99 behave in this situa= tion? (I=E2=80=99ve looked at mkdir-p.c in Gnulib but it=E2=80=99s a bit complicated=E2=80=A6) > Can this be applied, or do you prefer another option? I would prefer not to hide the initial error like the proposed patch does. OTOH, it=E2=80=99s no big deal, so if it turns out to be too much of a prob= lem or adds too much latency to wait for the Hurd fix, we could apply this patch. WDYT? Ludo=E2=80=99.