From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 3/3] support: Rename user-dmddir to %user-shepherd-dir. Date: Mon, 18 Jan 2016 22:08:20 +0100 Message-ID: <87oaci7fzv.fsf@gnu.org> References: <1452982661-17268-1-git-send-email-mthl@gnu.org> <1452982661-17268-4-git-send-email-mthl@gnu.org> <87a8o42tdo.fsf@gnu.org> <877fj8544b.fsf@gnu.org> <87mvs327sw.fsf@gnu.org> 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]:57822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLH2L-0006F1-D6 for guix-devel@gnu.org; Mon, 18 Jan 2016 16:08:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLH2G-0004s8-Ec for guix-devel@gnu.org; Mon, 18 Jan 2016 16:08:29 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLH2G-0004s4-At for guix-devel@gnu.org; Mon, 18 Jan 2016 16:08:24 -0500 In-Reply-To: <87mvs327sw.fsf@gnu.org> (Mathieu Lirzin's message of "Sun, 17 Jan 2016 22:51:59 +0100") 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: Mathieu Lirzin Cc: guix-devel@gnu.org Mathieu Lirzin skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Mathieu Lirzin skribis: >> >>> I have tried to apply this change (add an optional parameter) on top of >>> Guix, but it produces a ton of failures for =E2=80=98make check=E2=80= =99 :). >> >> What=E2=80=99s the failure exactly? > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > GNU Guix 0.9.1: ./test-suite.log > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [...] > ?: 2 [primitive-load "/home/mthl/src/gnu/guix/test-tmp/store/zx9l2f7cg= fwabmslfcxzvli07qaikma1-module-import-builder"] > In srfi/srfi-1.scm: > 619: 1 [for-each # (#)] > In ice-9/eval.scm: > 432: 0 [eval # #] > > ice-9/eval.scm:432:17: In procedure eval: > ice-9/eval.scm:432:17: In procedure mkdir: Permission denied My guess is that we end up creating parent directories that lack the execute or write bits, which prevents =E2=80=98mkdir-p=E2=80=99 from creati= ng the child directories. >>> So my conclusion is that it is not possible to set a default value. So I >>> think it required to do something like: >>> >>> (define* (mkdir-p dir #:optional mode) >>> ... >>> (if mode >>> (mkdir path mode) >>> (mkdir path)) >>> ...) >>> >>> Am I correct? >> >> That would work=E2=80=A6 but why do we need =E2=80=98mode=E2=80=99 in t= he first place? > > Shepherd config user directories are created with #o700 permissions. > Since it is possible to set an arbitrary value in XDG_CONFIG_HOME, my > understanding was that Shepherd is supposed to try to create the > directory composing this directory name if they don't exist. So to > create them It is convenient to have a MODE argument for =E2=80=98mkdir-p= =E2=80=99. Right, it makes sense in this particular case. >> It seems that the semantics are fuzzy, because the result may differ >> depending on which components of DIR already exist when =E2=80=98mkdir-p= =E2=80=99 is >> called, and the user can just set the process=E2=80=99 umask before call= ing it. >> >> WDYT? > > I don't know. mkdir(1) let the users do it, so I guess it makes sense > to handle the case. Yes, but it only applies to the last component: --8<---------------cut here---------------start------------->8--- $ mkdir -p -m 500 a/b/c/d $ ls -ld a a/b a/b/c a/b/c/d drwxr-xr-x 3 ludo users 4096 Jan 18 22:06 a drwxr-xr-x 3 ludo users 4096 Jan 18 22:06 a/b drwxr-xr-x 3 ludo users 4096 Jan 18 22:06 a/b/c dr-x------ 2 ludo users 4096 Jan 18 22:06 a/b/c/d --8<---------------cut here---------------end--------------->8--- Ludo=E2=80=99.