From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: [PATCH] gnu: Mark /gnu/store as needed for boot. Date: Fri, 13 Jan 2017 00:59:20 -0800 Message-ID: <87eg07xrmf.fsf@gmail.com> References: <1484164902-10160-1-git-send-email-jmd@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRxhm-0005r8-GM for guix-devel@gnu.org; Fri, 13 Jan 2017 03:59:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRxhl-0003sl-Ju for guix-devel@gnu.org; Fri, 13 Jan 2017 03:59:26 -0500 In-Reply-To: <1484164902-10160-1-git-send-email-jmd@gnu.org> (John Darrington's message of "Wed, 11 Jan 2017 21:01:42 +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" To: John Darrington Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable John Darrington writes: > * gnu/system/file-systems.scm (all-subpaths): New procedure. > (file-system-needed-for-boot?): Use it to check for ancestors > of %store-directory. > --- > gnu/system/file-systems.scm | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > > diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm > index 4cc1221..d42f271 100644 > --- a/gnu/system/file-systems.scm > +++ b/gnu/system/file-systems.scm > @@ -20,6 +20,7 @@ > #:use-module (ice-9 match) > #:use-module (guix records) > #:use-module (guix store) > + #:use-module (guix build utils) > #:use-module ((gnu build file-systems) > #:select (string->uuid uuid->string)) > #:re-export (string->uuid > @@ -95,11 +96,29 @@ > (dependencies file-system-dependencies ; list of > (default '()))) ; or >=20=20 > + > +(define (all-subpaths path) > + "Given a directory PATH return a list of all paths which > +are ancestors of this path, including PATH itself" > + (let loop ((path (string-split path #\/)) > + (ac '())) > + (if (null? path) > + ac > + (loop (cdr path) > + (cons > + (string-append > + (match ac > + (() "/") > + ((x _ . _) (string-append x "/")) > + ((x . _) x)) > + (car path)) > + ac))))) > + Is this procedure supposed to work with relative paths? I get strange results for "foo/bar": =2D-8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (all-subpaths "foo/bar") $4 =3D ("/foobar" "/foo") scheme@(guile-user)> =2D-8<---------------cut here---------------end--------------->8--- > (define-inlinable (file-system-needed-for-boot? fs) > - "Return true if FS has the 'needed-for-boot?' flag set, or if it's the= root > -file system." > + "Return true if FS has the 'needed-for-boot?' flag set, or if it holds > +the store directory." > (or (%file-system-needed-for-boot? fs) > - (string=3D? "/" (file-system-mount-point fs)))) > + (member (file-system-mount-point fs) (all-subpaths (%store-directo= ry))))) It seems to me like we could just use 'string-prefix?' here instead. Am I missing something? Is it really necessary to define an 'all-subpaths' procedure and use 'member' if 'string-prefix?' is good enough? The title of this patch is "Mark /gnu/store as needed for boot." I can see how this change makes that happen. But what is the purpose? I imagine that in some cases, if you don't do this, the initrd might not mount the file system containing the store, which of course would not be good. Do you have a specific problem case in mind? =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlh4lugACgkQ3UCaFdgi Rp0OeQ//cgKpYo/euBPIrxroT2JQVsEtV6LWElEL+mXLEIpyt61xaYyUP8h5wM69 6F9YKT+F82JRtNfURVM2dN+MiowgcSB/r7rX/aqe/5XO+Ri4NM4HDhU58pDoJDk5 XoOmAGPABZEibXR4d6bmoTO20YMuFj+uano0Gmv0/C8fd9O3kIxK4QvXLhbyDVI7 x+1rjKuDsyCvmqqIzL3rrAwY5KUKMI8x0Lc9VBTZmMugCtPyDiumjgNKWWGrQNj9 h2ekbgxeYn2cjMQk/b4B8VyeLK1hACpOy3cvos4NYHEO3c44Tudq73jw97IBBUMk xFvBwpacNqLOCNmnlj6BOPNHA1+/ymnvoWmgtzN79/8KBHk/oCWIlm8gUYy04JxM Bv0Rs+o9koWHNJGeQ+PopXYAzfVEFE8Alu3/L1H8Tdjlg3R2ZLQo42/kb5vwTSPj 7GCl2A3bc5XZtctHi3ABiRFL4Nyuv6XtQtZlikM2HrXYmjG0U9VI697+Xu3mE3N+ Rj9fxgMV5p8WtynnudukVKsqJboTjIBrPOopjjXGWXHYA7gp/fq3+pKz+28Ie8VW 39ncFcgZKxJhxbTtRRi8by62F1KfWUHxiZWOgrhJqg3cCYbDKLSBCQjnuIZBqP/v LwCbYOgtEV865pmoyvcckK28uZT3gnp18klAzXruN4SP9e4hR3I= =RXya -----END PGP SIGNATURE----- --=-=-=--