From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Oo+4DTmiMGGvNgEAgWs5BA (envelope-from ) for ; Thu, 02 Sep 2021 12:06:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6A7dCDmiMGEvLwAAB5/wlQ (envelope-from ) for ; Thu, 02 Sep 2021 10:06:49 +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 BB13C4FFE for ; Thu, 2 Sep 2021 12:06:48 +0200 (CEST) Received: from localhost ([::1]:37100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLjcN-0006S5-Ma for larch@yhetil.org; Thu, 02 Sep 2021 06:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLjc4-0006Rv-Vn for guix-devel@gnu.org; Thu, 02 Sep 2021 06:06:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54996) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLjc4-0004eu-B9; Thu, 02 Sep 2021 06:06:28 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=45108 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLjc4-0004xo-1x; Thu, 02 Sep 2021 06:06:28 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: zimoun Subject: Re: Transform options should error on nonexistant targets References: <86pmu1qz2f.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 Fructidor an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 02 Sep 2021 12:06:25 +0200 In-Reply-To: <86pmu1qz2f.fsf@gmail.com> (zimoun's message of "Wed, 25 Aug 2021 18:16:56 +0200") Message-ID: <87a6kv5m1q.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "guix-devel@gnu.org" Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630577208; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=m6ZPrsInY/JhcfVZYppIBKkDpLsuWwD+SOIP0+yoAeA=; b=NNWT5koceaf+mcHNpj34Rs12MxeFm5gy7TUtAoPTmJ70Utbg7I/yWwpxO1PVGg0143qDUf Y3rLdRnw6uTiAcrbo7UeeDABpgCmIXMsmZnazko/YpuXMvH9m7BSKz74IOJ6QEn6eJO5rd nzE6bILPHLTc0r9bhOBvl4mfk+QVx6Bn7Bj6/zAgoJK42orzBMidOezY0BdsJpDJWZn3em ae/uK9iLEQRK5ZKBt+y057Td/K4QZ3zqlqV7iak6ysI+5KEJMpmh+KLzkxjTP/DqVvzfnF SLR0MObfFA/X/XnJ/496f7r8/q33bKN5UTd+Th3c136tr+DM1//vpy/qukfzYQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630577208; a=rsa-sha256; cv=none; b=TO3wOgyBWqe0R0yt03QE8FRyCsdjsenaysx5vQ5X5LXZGw7X0NQP5LiYH5dyEojkoODPlv SAKarxv0QZEoBBgUVvXxkOZzpWkMQOC6O6zentJHgtUk2jZaVUTUOSs73idPP9nzl0d8yd YMnDydoLz005ZcmqJfE4VRL7ioYlzwGbl4ud1HI5csc2ZiLP2elE1lG6KCSLbrkp45OORc h8Avb9a5dadMV5frhbkdbAVwLFu3Pf7X1uN/AsO5qWXTajM5t6NdCNWFqPfWO6GgA0OoZK c4kmwgQ4OFmnlcnYKB0hiKE8Cl+cauBg2RPA7t8gbsq0qP2xx9r/F4WbxzNKwA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: BB13C4FFE X-Spam-Score: -2.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: NZJhuYkDCV81 Hi, zimoun skribis: > On Wed, 18 Aug 2021 at 03:57, Ryan Prior wrote: >> I learned today that Guix will chug happily along applying a transform t= o a nonexistent package. >> >> For example, I can run: >> guix environment --with-latest=3Dnot-exist --ad-hoc which >> >> This shows no warning or errors. I think it would be beneficial to show = an error & bail if the target of a transformation is a package that doesn't= exist, as this is likely indicative of an error. > > Indeed. :-) The issue comes from guix/transformations.scm (options->tran= sformation): > > (let ((new (transform obj))) > (when (eq? new obj) > (warning (G_ "transformation '~a' had no effect on ~a~%= ") > name > (if (package? obj) > (package-full-name obj) > obj))) > new) > > > and the warning is not reach because guix/packages.scm (package-mapping): > > (else > ;; Return a variant of P with PROC applied to P and its expl= icit > ;; dependencies, recursively. Memoize the transformations. = Failing > ;; to do that, we would build a huge object graph with lots = of > ;; duplicates, which in turns prevents us from benefiting fr= om > ;; memoization in 'package-derivation'. > (let ((p (proc p))) > (package > =E2=80=A6 > > > In the case of =E2=80=9Cguix build hello --with-latest=3Dfoo=E2=80=9D, th= en =E2=80=99proc=E2=80=99 has no > effect, i.e., =E2=80=99p=E2=80=99 is identical to =E2=80=99(proc p)=E2=80= =99 but a new package is > allocated which leads that =E2=80=99new=E2=80=99 and =E2=80=99obj=E2=80= =99 are not =E2=80=99eq?=E2=80=99. Indeed. [...] > + (let ((new (proc p))) > + (if (eq? new p) > + p > + (package > + (inherit new) > + (location (package-location new)) > + (build-system (if deep? > + (build-system-with-package-mapping > + (package-build-system new) rewri= te) > + (package-build-system new))) > + (inputs (map rewrite (package-inputs new))) > + (native-inputs (map rewrite (package-native-inputs = new))) > + (propagated-inputs (map rewrite (package-propagated= -inputs new))) > + (replacement (and=3D> (package-replacement new) rep= lace)) > + (properties `((,mapping-property . #t) > + ,@(package-properties new)))))))))) Unfortunately we cannot do that: rewriting happens lazily, when the various inputs fields (which are thunked) are accessed. When PROC returns P, we still need to recurse into its inputs, until CUT? says we can stop. (I=E2=80=99m surprised this change triggers only one test failure actually.) Does that make sense? Thanks, Ludo=E2=80=99.