From unknown Fri Sep 19 16:07:31 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#66510 <66510@debbugs.gnu.org> To: bug#66510 <66510@debbugs.gnu.org> Subject: Status: `this-package' references reintroduce pre-transformation packages. Reply-To: bug#66510 <66510@debbugs.gnu.org> Date: Fri, 19 Sep 2025 23:07:31 +0000 retitle 66510 `this-package' references reintroduce pre-transformation pack= ages. reassign 66510 guix submitter 66510 Ulf Herrman severity 66510 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 12 23:58:14 2023 Received: (at submit) by debbugs.gnu.org; 13 Oct 2023 03:58:14 +0000 Received: from localhost ([127.0.0.1]:44555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qr9JV-00006x-Iv for submit@debbugs.gnu.org; Thu, 12 Oct 2023 23:58:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qr9JP-00006Q-CQ for submit@debbugs.gnu.org; Thu, 12 Oct 2023 23:58:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qr9Iw-0007RA-LQ for bug-guix@gnu.org; Thu, 12 Oct 2023 23:57:38 -0400 Received: from tilde.club ([142.44.150.184]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qr9Iu-0004Ja-QY for bug-guix@gnu.org; Thu, 12 Oct 2023 23:57:38 -0400 Received: by tilde.club (Postfix, from userid 5378) id DF6682204ECD3; Fri, 13 Oct 2023 03:57:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club DF6682204ECD3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1697169454; bh=RaFJNMUOZZsOrjAEtX8icDj5e5J61xMnM57nBSGgeUU=; h=From:To:Subject:Date:From; b=BF83EKtoeVxE/FIQSjskKpTtfdPPQjYq/fVBjHFIVsdwwK6QQQZjLxyrU7Jdh5IG5 yxjnwDuelVPrDyHR2Tnp5EemacjK0N9pZyYpl0Hje6GbeTgSL80EI7B2brGHMJTMxL XMchUjiQoWPKzqffzD+WWZ4ZBIoQt3G04+xLgQY8= From: Ulf Herrman To: bug-guix@gnu.org Subject: `this-package' references reintroduce pre-transformation packages. Date: Thu, 12 Oct 2023 22:57:14 -0500 Message-ID: <87sf6fdvj9.fsf@tilde.club> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=142.44.150.184; envelope-from=striness@tilde.club; helo=tilde.club X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Suppose you have a package that is using a gexp in its argument list and, like a good citizen of the gexp world, it uses this-package-input to refer to its own input packages. In fact, let's suppose that it's the model citizen depicted in https://guix.gnu.org/en/blog/2021/the-big-change/ under the "G-expressions and self-referential records" heading: (define hello (package (name "hello") ;; =E2=80=A6 (arguments (list #:configure-flags #~(list (string-append "--with-gawk=3D" #$(this-package-input "gawk"))))) (inputs `(("gawk" ,gawk))))) If we define a variant like so: (define hello-variant (package (inherit hello) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))))) it will work just fine. But if we define a variant like SO: (define hello-variant (package (inherit hello) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))) (arguments (substitute-keyword-arguments (package-arguments hello) ((#:configure-flags flags #~'()) #~(cons "--with-hospitality=3Dice-cream" #$flags)))))) it will NOT work just fine. When (package-arguments hello) is evaluated, it will execute the field definition for `hello' with `this-package' bound to `hello', rather than `hello-variant'. Consequently, `this-package-input' will return gawk rather than gawk-4.0. We need a way to access the "parent" package's fields while keeping `this-package' bound to its current value. The most general form of this would look something like this: (define (package-arguments-with-package p0 p) (match p0 (($ _ _ _ _ arguments-proc) (arguments-proc p)))) Then hello-variant could be changed to use (package-arguments-with-package hello this-package) instead of (package-arguments hello). This may be needlessly general, though; the problem could also be solved with an interface more along the lines of (parent-package-arguments hello) which expands into the aforementioned package-arguments-with-package call. Another option would be to, yet again, extend the record syntax. It's always bugged me a bit to have to explicitly reference the original record in more than one place when using derived fields, so this might be generally useful as well: (define hello-variant (package (inherit hello (arguments hello-arguments)) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))) (arguments (substitute-keyword-arguments hello-arguments ((#:configure-flags flags #~'()) #~(cons "--with-hospitality=3Dice-cream" #$flags)))))) This would create a macro named `hello-arguments' within the scope of the (package ...) form which expands into something equivalent to a `parent-package-arguments' call. Adjust syntax to taste. Thoughts? =2D Ulf --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHIBAEBCAAyFiEEn6BUn0yca1D9JsMa1lV76sJM9mgFAmUowBoUHHN0cmluZXNz QHRpbGRlLmNsdWIACgkQ1lV76sJM9mhMggv+KB3jA1cTdS9iUoGC2tJWHNvWYAjp tq6kaKJgop/2hgxcdPuhB37Lcx3TOCTJoVFzL7Mpni6o4k2UolgERYMy9hUCzXul XZhqoLrSvDWfQEpoKzFNMZaVGC6PSirFdFb3XteyrfiWyjH/INgL/IX+V91g93Si /ZR7Ks6CiRuQ5MReW2LzyhiDx64KXEnE3oUCnqKUfDJgLtHD/bFqqK3ZqjIPeIir 4pPDfq2pyH8MqQAx5cQjfmQwVoX1RNKITISHlvIAZvTVsp7oCJV0Rvg/Pg+8kpFI P6eKyzsJJbZx4NYVRpXAXXpfcn5D02CjGErOYrFolK+HLT5KlyNc6FYFQstOyoB2 vAu/WYaSBD4rfaT6iSL4m9zH4kMb6pl2sLkgMP5QPYK2i0zsnvjAqBc+2SPOwpvE n52+uq7w/WtqzcZCYzmezunTK9VvGy50+HkfC2aVDpckpC3HSklotkDhJkn8PHwy bxxxDRP9nfcG9YirGPJrJ+Y5G0UmBvAniMkR =8Su+ -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 21 18:34:20 2023 Received: (at control) by debbugs.gnu.org; 21 Oct 2023 22:34:20 +0000 Received: from localhost ([127.0.0.1]:45216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quKXw-0001XZ-QE for submit@debbugs.gnu.org; Sat, 21 Oct 2023 18:34:20 -0400 Received: from tilde.club ([2607:5300:204:4340::114]:40230 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quKXr-0001XJ-Fe for control@debbugs.gnu.org; Sat, 21 Oct 2023 18:34:15 -0400 Received: by tilde.club (Postfix, from userid 5378) id CE654224101FA; Sat, 21 Oct 2023 22:33:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club CE654224101FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1697927621; bh=16BzXhth4up2eBhlwRIjWEqSWdkBnFNL4hOaFZR5ADc=; h=From:To:Subject:Date:From; b=GCUG8ZgDR/2aaR0Y7IZ9PA78hyrknzcZOzZwSupT8ddCm3aXQUGGQ0FoZ5mPnZ+rk SMFJK0nNj1jS+B3F5QBikJ1nRDZB3bcftIZ08tK44tlG2hNt0cxntv1OseKtnichgQ yDIju+TVFF9zx7iz9jHeDhyBVmi4pTXFRSfdCGh8= From: Ulf Herrman To: control@debbugs.gnu.org Subject: Merge new duplicate Date: Sat, 21 Oct 2023 17:33:30 -0500 Message-ID: <87y1fvppvp.fsf@tilde.club> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forcemerge 50335 66510 From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 09 10:07:24 2024 Received: (at 66510) by debbugs.gnu.org; 9 Apr 2024 14:07:24 +0000 Received: from localhost ([127.0.0.1]:51176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruC8C-0004u1-58 for submit@debbugs.gnu.org; Tue, 09 Apr 2024 10:07:24 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:57435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruC8A-0004t3-1T for 66510@debbugs.gnu.org; Tue, 09 Apr 2024 10:07:22 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-516cbf3fd3dso6529006e87.2 for <66510@debbugs.gnu.org>; Tue, 09 Apr 2024 07:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712671627; x=1713276427; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=VIsbmnZEoI8ll1CMgdGT9t7uHfJCSv4eT0DRpQt79P0=; b=ZfVST1baAKwCFUXHNN2XeRr9tSxqqFaRM02cQQcEcTN0koTmm4L4w0+hRfMq9HX67W EmEe9KJV9hPZOq+EgzpVS+yP0+jlAnZ/hJdiS5rllu7F+GLqw4xJR1uAj95XBt3Tgv4b VWmmvn5o0Vm5+r8j55VX49RZWc2F7sxUbSwUAnL/syuTVRMpC3nI+H+BCmMDacxejNWv +aig8bFlIhqi+NiVL0KhN2nszWUIm+d8imfhsTsRSv8uyIKfUqG3OQqCIH8GVA8bW8Qj MXSzAX+8667IJWoa6mXwVZoF9B4w3Sle7vtT12L3uT/unkCJLU4Bbb6ET8pGuoFsNp5E wg+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712671627; x=1713276427; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VIsbmnZEoI8ll1CMgdGT9t7uHfJCSv4eT0DRpQt79P0=; b=JHPkhL/gEatekpoPT/zI8qsnDsT+q4p7J/ORRJkGD0yyRvk4DFz295gfw1zRbI/x4w Uf4YCkX/P5IGJjK1Xu2Z615qRkafD2ZPMTNHXpt5LPyKO6lBhfjQpBlB+gSaTeitYwdT CQAF11vcuoI/91kU0W6N6eUgaOL6wLSQ1GXE8Co15OpDq6VSI2vREpPw51zBp/KfGRY8 3bqnSk+grmUMlaueONEbeHGqMfbPsVEBl5TOUT7eJqrnh1WQVz3n1KODMwb4w1FKqmEA piWNcj5twmd82Hlky/GuX6UZRhqL8HgQMYjA1eSnFOWVJLjqT2RgNOvegS5yp6ckGVcx 3Cow== X-Gm-Message-State: AOJu0Ywq8HWA0bezKqPbtegFB2OTXu51TXiCpj7xExZWAoPiFmcxPW1H Y1uITVhckMgI/u45wk4ORj2wdwtIBsdXaEp+5FvBq/insS5dPmS5z7MyQBNqH9o51//cCuViqQG 1cXIQOsN9AVY/tEsTxsqvB7rqVKAmizsxwgU= X-Google-Smtp-Source: AGHT+IF8Mh8PxguBvIQpR0NFwAUbItFfX+lH4HctVCbReSZlFUbivQkZPrKMTrePQYs7Sw1C2d6dXCY3PtVh9uzFUw0= X-Received: by 2002:a05:6512:488a:b0:515:bbf7:bdcf with SMTP id eq10-20020a056512488a00b00515bbf7bdcfmr9022306lfb.65.1712671626603; Tue, 09 Apr 2024 07:07:06 -0700 (PDT) MIME-Version: 1.0 From: Jake Date: Tue, 9 Apr 2024 14:06:55 +0000 Message-ID: Subject: Unexpected `this-package(-native)-input` To: 66510@debbugs.gnu.org Content-Type: multipart/alternative; boundary="000000000000ebb2e50615aa6f46" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66510 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000ebb2e50615aa6f46 Content-Type: text/plain; charset="UTF-8" Hi Ulf Has any progress been made on this? I ran into the same thing, except with native-inputs instead of inputs. I spent a fair amount of time trying to pin it down, since I don't know much guile and it requires a combination of conditions to manifest. Is it worth documenting this behaviour? Or do we expect a solution will be implemented soon enough? For now, is the following guideline accurate enough to avoid these surprises? If we inherit a package that uses (either directly or through inheritance) this-package-native-input (or this-package-input), we should not modify the native inputs (or inputs) via replace if substitute-keyword-arguments is used anywhere in the inheritance chain. Thanks Jake --000000000000ebb2e50615aa6f46 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ulf

Has any progress been made on this?

I= ran into the same thing, except with native-inputs instead of inputs.
I= spent a fair amount of time trying to pin it down, since I don't know = much guile and it requires a combination of conditions to manifest.
Is i= t worth documenting this behaviour? Or do we expect a solution will be impl= emented soon enough?

For now, is the following guideline accurate en= ough to avoid these surprises?

If we inherit a package that use= s (either directly or through inheritance) this-package-native-input (or th= is-package-input), we should not modify the native inputs (or inputs) via r= eplace if substitute-keyword-arguments is used anywhere in the inheritance = chain.

Thanks
Jake
--000000000000ebb2e50615aa6f46--