From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: Re: [PATCH] gnu: Mark /gnu/store as needed for boot. Date: Mon, 16 Jan 2017 13:46:17 +0100 Message-ID: <20170116124617.GB16013@jocasta.intra> References: <1484164902-10160-1-git-send-email-jmd@gnu.org> <877f5xjpmk.fsf@gnu.org> <20170115063226.GA20478@jocasta.intra> <87shokdkrl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/WwmFnJnmDyWGHa4" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cT6g6-0002sa-KC for guix-devel@gnu.org; Mon, 16 Jan 2017 07:46:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cT6g5-0003Gc-Jb for guix-devel@gnu.org; Mon, 16 Jan 2017 07:46:26 -0500 Content-Disposition: inline In-Reply-To: <87shokdkrl.fsf@gnu.org> 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: Ludovic Court??s Cc: guix-devel@gnu.org, John Darrington --/WwmFnJnmDyWGHa4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 15, 2017 at 11:24:30PM +0100, Ludovic Court??s wrote: =20 Then maybe this: =20 (define (file-system-needed-for-boot? fs) (or (%file-system-needed-for-boot? fs) (and (file-prefix? (file-system-needed-for-boot? fs) (%store-directory)) (not (memq 'bind-mount (file-system-flags fs)))))) =20 with: =20 --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define (file-prefix? file1 file2) (define not-slash (char-set-complement (char-set #\/))) (and (string-prefix? "/" file1) (let loop ((file1 (string-tokenize file1 not-slash)) (file2 (string-tokenize file2 not-slash))) (match file1 (() #t) ((head1 tail1 ...) (match file2 ((head2 tail2 ...) (and (string=3D? head1 head2) (loop tail1 tail2))) (() #f))))))) scheme@(guile-user)> (file-prefix? "/gn" "/gnu/store") $13 =3D #f scheme@(guile-user)> (file-prefix? "/gnu/store/foo" "/gnu/store") $14 =3D #f scheme@(guile-user)> (file-prefix? "/gnu/store" "/gnu/store") $15 =3D #t scheme@(guile-user)> (file-prefix? "/gnu" "/gnu/store") $16 =3D #t scheme@(guile-user)> (file-prefix? "/" "/gnu/store") $17 =3D #t --8<---------------cut here---------------end--------------->8--- =20 This seems more natural to me than computing the set of prefixes like ???all-subpaths??? does. =20 WDYT? =20 If that???s fine with you I can commit this. =20 It looks fine to me. I haven't tested it .... J' --=20 Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3=20 fingerprint =3D 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. --/WwmFnJnmDyWGHa4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlh8wJgACgkQimdxnC3oJ7Mz9QCeOreiydLDd58MsbplXfYmbgRU /tYAn39TOI+ra7D8lGokpJHcOTL+p9Kz =50bE -----END PGP SIGNATURE----- --/WwmFnJnmDyWGHa4--