From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: bug#31560: Commit 47a60325c broke tests/pack.scm Date: Fri, 01 Jun 2018 00:45:34 -0700 Message-ID: <87zi0f9cgx.fsf@gmail.com> References: <87bmd6zyvd.fsf@gmail.com> <87lgca3jd0.fsf@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]:32832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOelC-0000T6-3B for bug-guix@gnu.org; Fri, 01 Jun 2018 03:46:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOel8-0004yA-Eq for bug-guix@gnu.org; Fri, 01 Jun 2018 03:46:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48742) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOel8-0004xz-AK for bug-guix@gnu.org; Fri, 01 Jun 2018 03:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fOel8-0004Rz-0P for bug-guix@gnu.org; Fri, 01 Jun 2018 03:46:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87lgca3jd0.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 23 May 2018 09:46:03 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 31560@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, I believe the attached patches fix the issue when applied to the master branch. The failing test now passes (along with all the other "make check" tests). What do you think? If you approve, then I'll commit it to the master branch. ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Chris Marusich skribis: > >> It seems that tests/pack.scm began to fail at commit >> 47a60325ca650e8fc1a291c8655b4297f4de8deb. This commit made the >> following change in guix/scripts/pack.scm: >> >> (define symlink->directives >> ;; Return "populate directives" to make the given symlink a= nd its >> ;; parent directories. >> (match-lambda >> ((source '-> target) >> (let ((target (string-append #$profile "/" target))) >> `((directory ,(dirname source)) >> - (,source -> ,target)))))) >> + (,source >> + -> ,(relative-file-name (dirname source) target))))= ))) >> >> It seems this causes the test to fail because it calls >> relative-file-name like this in the test: >> >> (relative-file-name "/bin" >> "/home/marusich/guix-upgrade-gnucash/test-tmp/store/3j3mrl1sf3bcx4fzlz65= 5mzsp4bir54j-profile/bin/guile") >> >> ... > > Oooh, sorry about that. No worries! Hopefully the fix is as simple as I think it is. > However what happens here is more something like: > > (relative-file-name > "/home/marusich/guix-upgrade-gnucash/test-tmp/store/3j3mrl1sf3bcx4fzl= z655mzsp4bir54j-profile/bin" > "/home/marusich/guix-upgrade-gnucash/test-tmp/store/3j3mrl1sf3bcx4fzl= z655mzsp4bir54j-profile/bin/guile") > > No? Hmm not sure=E2=80=A6 On my system, when I ran the test (tests/pack.scm) just now, the variables in symlink->directives had the following values (I used pk to view their values - if you know of a better way, I'd love to know!): source =3D "/bin/Guile" target =3D "/home/marusich/guix/test-tmp/store/p8y0nby1mybh5h75hi4hd1x0x3= 6insnd-profile/bin/guile" parent =3D "/bin" I believe the issue here was that we were not distinguishing between the "source parent" and the "target parent" directories. When calling relative-file-name, I think we need to pass in the "target parent", which I've done in the attached patches. > I suppose the test should ensure we get an appropriate relative >symlink. Well, the test did catch the problem, so I think the test is OK as currently written. >> What is the purpose of calling relative-file-name here? > > The goal is to create only relative symlinks so that the tarball is > relocatable: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31360 > > $ ./pre-inst-env guix pack bash-static -S /bin/B=3Dbin/bash > /gnu/store/7dks90572s5i8nnziippsskm7f4iyqhg-tarball-pack.tar.gz > $ tar tvf /gnu/store/7dks90572s5i8nnziippsskm7f4iyqhg-tarball-pack.tar.gz= |grep bin/B > lrwxrwxrwx root/root 0 1970-01-01 01:00 ./bin/B -> ../gnu/store/x= qgyj976y375wv8gaqh5mz0ysbfdk7f6-profile/bin/bash > hrwxrwxrwx root/root 0 1970-01-01 01:00 ./bin/B link to ./bin/B > > (The =E2=80=9Clink to=E2=80=9D line really shouldn=E2=80=99t be here but = let=E2=80=99s ignore it.) Understood! Thank you for clarifying the intent. I figured it was something like that. I just wanted to be certain. =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-tests-Call-self-contained-tarball-correctly.patch Content-Transfer-Encoding: quoted-printable From=2086b15bdf4b3eb0a8105e7f456c8ba90331dd7cae Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Fri, 1 Jun 2018 00:13:31 -0700 Subject: [PATCH 1/2] tests: Call self-contained-tarball correctly. * tests/pack.scm ("self-contained-tarball"): Call the self-contained-tarball procedure with keyword argument #:archiver instead of #:tar. This argument was renamed in commit 5ffac538aa604b71814ac74579626f0d3110b96e. =2D-- tests/pack.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pack.scm b/tests/pack.scm index 3bce71507..cd7de7800 100644 =2D-- a/tests/pack.scm +++ b/tests/pack.scm @@ -61,7 +61,7 @@ #:symlinks '(("/bin/Guile" -> "bin/guile")) #:compressor %gzip-compressor =2D #:tar %tar-bootstrap)) + #:archiver %tar-bootstrap)) (check (gexp->derivation "check-tarball" #~(let ((guile (string-append "." #$profile "/bin"))) =2D-=20 2.17.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-pack-Create-the-populate-directives-correctly.patch Content-Transfer-Encoding: quoted-printable From=2027478e3b9d01c073542a0a53635b248af63562f7 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Thu, 31 May 2018 23:52:20 -0700 Subject: [PATCH 2/2] pack: Create the "populate directives" correctly. * guix/scripts/pack.scm (self-contained-tarball)[build](symlink->directives= ): Discriminate between "source" and "target" parent directories. =2D-- guix/scripts/pack.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 35b8a7e72..e3a759e66 100644 =2D-- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -123,19 +123,19 @@ added to the pack." (match-lambda ((source '-> target) (let ((target (string-append #$profile "/" target)) =2D (parent (dirname source))) + (source-parent (dirname source)) + (target-parent (dirname target))) ;; Never add a 'directory' directive for "/" so as to ;; preserve its ownnership when extracting the archive (s= ee ;; below), and also because this would lead to adding the ;; same entries twice in the tarball. =2D `(,@(if (string=3D? parent "/") + `(,@(if (string=3D? source-parent "/") '() =2D `((directory ,parent))) + `((directory ,source-parent))) (,source =2D -> ,(relative-file-name parent target))))))) + -> ,(relative-file-name target-parent target))))))) =20 (define directives =2D ;; Fully-qualified symlinks. (append-map symlink->directives '#$symlinks)) =20 ;; The --sort option was added to GNU tar in version 1.28, relea= sed =2D-=20 2.17.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlsQ+Z4ACgkQ3UCaFdgi Rp3Mgg//a9xU2EV1xYPUToeoJIojvhVUQBNeznrCzyv99CuXvFYhg6G+pDe2gibu 8TDjrWtpf1OWOH1RWUGyXubFXvofq0en9/AR6UR6pGyU7pExZDJuhRh7q2DWtqsg R1IFVuAiNLwHF4Mq5AGO+xYxtXuhWctbDbM6/KEDgiFcLr7/wVCkhp4gLz8ST7IG WUSSgtXnrvKHMpQimnZ1hjUVZa/JhRoM9Sh31TUAkqagOJ8GnKXWIQq/0RZIpEqZ 3g97yeNT2UdEn3Qe+LKImOf21D0G5ZhK7kzt7UJ3AYJFfAEIQVYvrAqupopYiDqs ssbOde95PIZloC2SAGKQssjWS+d4j+cBY+sMng9i8yNNbV9/B5julDf3/DaSlohc uQkPhR5eiLn6mFttiiQPBPCUo+2p7Rc1fdo3ZmIl2Y2AFgaSdMqLX53RuxoORHfX RTuCjyp2/YiElRsP88Q8tUoqu6Fymt6LCm1UPFpnxLUGFMLdtqlwf0QONme9Gnyk Th7KV33RwABuIjR4s/5coQAoucvzyOfco5+RDpeIqiaLuSRcdVEsRm9Exrr2I8Pi NG34iPErVEuIIcbtv0xKyZ/FGQ09bdz29D5p+/s35X/ke1U/WGTBbYTMeF14LVup ZRcCH0x7odF8D4R3lAo5ItMsjqNYgRQhzPJ8I4DnxRMaH0puU2g= =jOy2 -----END PGP SIGNATURE----- --==-=-=--