From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +JyvMzMEg18sTAAA0tVLHw (envelope-from ) for ; Sun, 11 Oct 2020 13:10:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QLNuLzMEg1/qKAAA1q6Kng (envelope-from ) for ; Sun, 11 Oct 2020 13:10:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1D89794029C for ; Sun, 11 Oct 2020 13:10:10 +0000 (UTC) Received: from localhost ([::1]:41470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRb73-0002M5-GL for larch@yhetil.org; Sun, 11 Oct 2020 09:10:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRb6w-0002Ly-E7 for bug-guix@gnu.org; Sun, 11 Oct 2020 09:10:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRb6w-0005L4-4C for bug-guix@gnu.org; Sun, 11 Oct 2020 09:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kRb6v-0005WK-Vr for bug-guix@gnu.org; Sun, 11 Oct 2020 09:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#43890: =?UTF-8?Q?=E2=80=98package-input-rewriting/spec=E2=80=99?= can introduce unnecessary variants Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 11 Oct 2020 13:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43890 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 43890@debbugs.gnu.org Received: via spool by 43890-submit@debbugs.gnu.org id=B43890.160242178721195 (code B ref 43890); Sun, 11 Oct 2020 13:10:01 +0000 Received: (at 43890) by debbugs.gnu.org; 11 Oct 2020 13:09:47 +0000 Received: from localhost ([127.0.0.1]:39317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kRb6h-0005Vm-EZ for submit@debbugs.gnu.org; Sun, 11 Oct 2020 09:09:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kRb6f-0005VY-Bi for 43890@debbugs.gnu.org; Sun, 11 Oct 2020 09:09:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52012) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRb6a-0005Hm-5U for 43890@debbugs.gnu.org; Sun, 11 Oct 2020 09:09:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50656 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kRb6Z-0005an-OA for 43890@debbugs.gnu.org; Sun, 11 Oct 2020 09:09:39 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87v9fji2cv.fsf@inria.fr> Date: Sun, 11 Oct 2020 15:09:37 +0200 In-Reply-To: <87v9fji2cv.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 09 Oct 2020 22:14:08 +0200") Message-ID: <87lfgcgb8u.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: Uc0bXwEVqfNm --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s skribis: > $ guix describe > Generacio 162 Oct 01 2020 00:23:38 (nuna) > guix 7607ace > repository URL: https://git.savannah.gnu.org/git/guix.git > branch: master > commit: 7607ace5091aea0157ba5c8a508129cc5fc4f931 > $ guix build inkscape --no-grafts -d > /gnu/store/arjs5hb4wmy6dh5d3y8bbs808ki9abf8-inkscape-1.0.1.drv > $ guix build inkscape --no-grafts -d --with-graft=3Dglib=3Dglib-networking > /gnu/store/zd8mm3w6x9c97anfaly77fz28s5y3i5h-inkscape-1.0.1.drv > $ guix build inkscape --no-grafts -d --with-graft=3Dlibreoffice=3Dabiword > /gnu/store/arjs5hb4wmy6dh5d3y8bbs808ki9abf8-inkscape-1.0.1.drv > > The last one is fine: it has no effect. > > The second one is problematic: since we=E2=80=99re using =E2=80=98--no-gr= afts=E2=80=99, the > =E2=80=98--with-graft=E2=80=99 option should have absolutely no effect; y= et, it yields a > different derivation. > > On closer inspection, we see that the core issue is that > =E2=80=98gobject-introspection=E2=80=99 in the second case ends up with = =E2=80=98libffi=E2=80=99 twice > in its =E2=80=98*-guile-builder=E2=80=99 script, a problem similar to > . (=E2=80=98libffi=E2=80=99 is propag= ated by both > =E2=80=98glib=E2=80=99 and =E2=80=98gobject-introspection=E2=80=99.) Here are test cases for this: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/tests/guix-build.sh b/tests/guix-build.sh index 6dbb53206e..1cfff329f1 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -262,6 +262,12 @@ drv1=`guix build glib -d` drv2=`guix build glib -d --with-input=libreoffice=inkscape` test "$drv1" = "$drv2" +# '--with-graft' should have no effect when using '--no-grafts'. +# See . +drv1=`guix build inkscape -d --no-grafts` +drv2=`guix build inkscape -d --no-grafts --with-graft=glib=glib-networking` +test "$drv1" = "$drv2" + # Rewriting implicit inputs. drv1=`guix build hello -d` drv2=`guix build hello -d --with-input=gcc=gcc-toolchain` diff --git a/tests/packages.scm b/tests/packages.scm index 5d5abcbd76..e7c43b8939 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1419,7 +1419,8 @@ (build-system trivial-build-system) (inputs `(("dep" ,dep1))))) (rewrite (package-input-rewriting/spec - `(("coreutils" . ,(const sed))))) + `(("coreutils" . ,(const sed))) + #:deep? #f)) ;avoid creating circular deps (p1 (rewrite p0))) (match (package-inputs p1) ((("dep" dep)) @@ -1430,6 +1431,49 @@ (derivation-file-name (package-derivation %store coreutils)))))))) +(test-assert "package-input-rewriting/spec, identity" + ;; Make sure that 'package-input-rewriting/spec' doesn't gratuitously + ;; introduce variants. In this case, the LIBFFI propagated input should not + ;; be duplicated when passing GOBJECT through REWRITE. + ;; See . + (let* ((libffi (dummy-package "libffi" + (build-system trivial-build-system))) + (glib (dummy-package "glib" + (build-system trivial-build-system) + (propagated-inputs `(("libffi" ,libffi))))) + (gobject (dummy-package "gobject-introspection" + (build-system trivial-build-system) + (inputs `(("glib" ,glib))) + (propagated-inputs `(("libffi" ,libffi))))) + (rewrite (package-input-rewriting/spec + `(("glib" . ,identity))))) + (and (= (length (package-transitive-inputs gobject)) + (length (package-transitive-inputs (rewrite gobject)))) + (string=? (derivation-file-name + (package-derivation %store (rewrite gobject))) + (derivation-file-name + (package-derivation %store gobject)))))) + +(test-assert "package-input-rewriting, identity" + ;; Similar to the test above, but with 'package-input-rewriting'. + ;; See . + (let* ((libffi (dummy-package "libffi" + (build-system trivial-build-system))) + (glib (dummy-package "glib" + (build-system trivial-build-system) + (propagated-inputs `(("libffi" ,libffi))))) + (gobject (dummy-package "gobject-introspection" + (build-system trivial-build-system) + (inputs `(("glib" ,glib))) + (propagated-inputs `(("libffi" ,libffi))))) + (rewrite (package-input-rewriting `((,glib . ,glib))))) + (and (= (length (package-transitive-inputs gobject)) + (length (package-transitive-inputs (rewrite gobject)))) + (string=? (derivation-file-name + (package-derivation %store (rewrite gobject))) + (derivation-file-name + (package-derivation %store gobject)))))) + (test-equal "package-patched-vulnerabilities" '(("CVE-2015-1234") ("CVE-2016-1234" "CVE-2018-4567") --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Unfortunately it=E2=80=99s again pretty hard to fix. We should rely less on pointer equality (and not break =E2=80=9Cequational reasoning=E2=80=9D), but OTOH (1) we need it for performance reasons, and (= 2) packages are parameterized in arbitrary ways (its thunked fields can depend on (%current-system), etc.) which makes it impossible to define a faithful =E2=80=98package=3D?=E2=80=99 predicate. Ludo=E2=80=99. --=-=-=--