GNU bug report logs - #50335
Inheritance vs. ‘this-package’

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Ludovic Courtès <ludovic.courtes@HIDDEN>; merged with #66510; dated Thu, 2 Sep 2021 13:49:02 UTC; Maintainer for guix is bug-guix@HIDDEN.
Forcibly Merged 50335 66510. Request was from Ulf Herrman <striness@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50335 <at> debbugs.gnu.org:


Received: (at 50335) by debbugs.gnu.org; 4 Mar 2023 15:16:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 04 10:16:00 2023
Received: from localhost ([127.0.0.1]:37466 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pYTc8-0003P4-F2
	for submit <at> debbugs.gnu.org; Sat, 04 Mar 2023 10:16:00 -0500
Received: from eggs.gnu.org ([209.51.188.92]:60038)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pYTc6-0003Os-Mj
 for 50335 <at> debbugs.gnu.org; Sat, 04 Mar 2023 10:15:59 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pYTc1-0006hT-ES; Sat, 04 Mar 2023 10:15:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=b47ay3h+IVD/0xO7LkpWHe+1mvO80vxnQXpjBFbjvIE=; b=fzT4OzaVpTWGORiN5NkI
 wbcjftKOajF1t/6VmOCsMZSat8DBglosr0uEhgqqHU9ru3wu3k7GmFTukG3lLjw51BdCoHI91JaxH
 AN1KsW5CQA1xjDu4qj4a0/+fu5tmcVN9qSABwrcrFFqBeilwKbLz7QZFo+3vQkJcDgVylpchkRHjO
 aVsBgJzUrq6UtdVL1OGSALG8mgtW2otyMnVmT00kAPA/5AEQi2R1B8UYobBvsyUWWoQgbRM9fMFxd
 5Cev9bJ97JGcALCGDl8aIIzgFfA6ukM/Qv6oI68RtTOQ1n+kyOlKItX38ViZPnugyUA2vE/6M4BDB
 SR7XmVUOh4TXyw==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pYTc0-0007Jz-VI; Sat, 04 Mar 2023 10:15:53 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: 50335 <at> debbugs.gnu.org
Subject: Re: bug#50335: Inheritance vs. =?utf-8?Q?=E2=80=98this-package?=
 =?utf-8?Q?=E2=80=99?=
References: <87r1e73x78.fsf@HIDDEN>
Date: Sat, 04 Mar 2023 16:15:50 +0100
In-Reply-To: <87r1e73x78.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22?=
 =?utf-8?Q?'s?= message of "Thu, 02 Sep 2021 15:48:27 +0200")
Message-ID: <87a60stumx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50335
Cc: philippe.swartvagher@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ludovic Court=C3=A8s <ludovic.courtes@HIDDEN> skribis:

> We stumbled upon an idiom for package arguments that, combined with
> package inheritance, would not work as expected.

[...]

> We don=E2=80=99t want to (package-arguments this-package) here: that would
> naturally lead to an infinite loop.  But we want something close to it,
> in spirit: (package-arguments parent), where =E2=80=98parent=E2=80=99 is =
the package we
> inherit from.
>
> (package-arguments parent) could call the =E2=80=98arguments=E2=80=99 thu=
nk of the
> parent, but it would pass it the child as its argument.

Here=E2=80=99s an example where I ended up manually defining =E2=80=98paren=
t=E2=80=99:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?h=3Dcore-updates&id=3D=
0aed5bf5120bd434e53be0cea3f96547f95837d6

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#50335; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Sep 2021 13:48:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 02 09:48:41 2021
Received: from localhost ([127.0.0.1]:40048 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mLn56-0002pr-Tg
	for submit <at> debbugs.gnu.org; Thu, 02 Sep 2021 09:48:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:45814)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludovic.courtes@HIDDEN>) id 1mLn52-0002ph-5s
 for submit <at> debbugs.gnu.org; Thu, 02 Sep 2021 09:48:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51628)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1mLn51-0000uX-U4
 for bug-guix@HIDDEN; Thu, 02 Sep 2021 09:48:35 -0400
Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:41703)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1mLn4z-0000qn-FL
 for bug-guix@HIDDEN; Thu, 02 Sep 2021 09:48:35 -0400
IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A9iZwCK+TPGnC/0YchVZuk+DFI+orL9Y04lQ7?=
 =?us-ascii?q?vn2ZKCYlEfBw+Pre+cjzuSWbtN9zYhEdcK67Scu9qBrnnPYfi7X5W43CYOCMgg?=
 =?us-ascii?q?eVxe9ZgLcKuweOJxHD?=
X-IronPort-AV: E=Sophos;i="5.84,326,1620684000"; d="scan'208";a="526402077"
Received: from unknown (HELO ribbon) ([193.50.110.141])
 by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 02 Sep 2021 15:48:27 +0200
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludovic.courtes@HIDDEN>
To: bug-guix@HIDDEN
Subject: Inheritance vs. =?utf-8?Q?=E2=80=98this-package=E2=80=99?=
X-Debbugs-Cc: philippe.swartvagher@HIDDEN
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 16 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 15:48:27 +0200
Message-ID: <87r1e73x78.fsf@HIDDEN>
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
Received-SPF: pass client-ip=192.134.164.83;
 envelope-from=ludovic.courtes@HIDDEN;
 helo=mail2-relais-roc.national.inria.fr
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi!

We stumbled upon an idiom for package arguments that, combined with
package inheritance, would not work as expected.  It goes like this
(taken from <https://gitlab.inria.fr/guix-hpc/guix-hpc/>):

--8<---------------cut here---------------start------------->8---
(define-public starpu
  (package
    ;; =E2=80=A6
    (arguments
      (substitute-keyword-arguments (package-arguments starpu-1.2)
        ((#:configure-flags flags '())
         (match (assoc "mpi" (package-propagated-inputs this-package))
           (("mpi" mpi)
            (if (string=3D? (package-name mpi) "nmad")
                `(cons "--enable-nmad" ,flags)
                flags))))))
    (propagated-inputs `(("mpi" ,openmpi)))))

(define-public starpu+fxt
  (package
    (inherit starpu)
    ;; =E2=80=A6
    (arguments
     (substitute-keyword-arguments (package-arguments starpu)
       ((#:configure-flags flags '())
        `(cons "--with-fxt" ,flags))))))
--8<---------------cut here---------------end--------------->8---

The first package, =E2=80=98starpu=E2=80=99, has its arguments depend on:

  (package-propagated-inputs this-package)

This is smart because if you inherit from it without changing the
=E2=80=98arguments=E2=80=99 field (for instance by doing =E2=80=98--with-in=
put=3Dopenmpi=3Dnmad=E2=80=99),
it=E2=80=99ll adjust its configure flags based on the MPI package it actual=
ly
depends on.

However, this trick doesn=E2=80=99t work with the second package, =E2=80=98=
starpu-fxt=E2=80=99:
if you do:

  guix build starpu-fxt --with-input=3Dopenmpi=3Dnmad

the =E2=80=98--enable-nmad=E2=80=99 configure flag will not be passed.  Thi=
s is because
=E2=80=98starpu-fxt=E2=80=99 calls:

  (package-arguments starpu)

which returns the original arguments of =E2=80=98starpu=E2=80=99.


Still here?  :-)

This is admittedly a pretty far-fetched example and there are ways to
work around it=C2=B9.  Still, I wonder if we could up with a linguistic
device (ah ha!) to address that.

We don=E2=80=99t want to (package-arguments this-package) here: that would
naturally lead to an infinite loop.  But we want something close to it,
in spirit: (package-arguments parent), where =E2=80=98parent=E2=80=99 is th=
e package we
inherit from.

(package-arguments parent) could call the =E2=80=98arguments=E2=80=99 thunk=
 of the
parent, but it would pass it the child as its argument.

Or something like that.

Thoughts?

Ludo=E2=80=99.

=C2=B9 https://gitlab.inria.fr/guix-hpc/guix-hpc/-/commit/761cfe97d5bb42dbb=
de538593cef93e803086e3b




Acknowledgement sent to Ludovic Courtès <ludovic.courtes@HIDDEN>:
New bug report received and forwarded. Copy sent to philippe.swartvagher@HIDDEN, bug-guix@HIDDEN. Full text available.
Report forwarded to philippe.swartvagher@HIDDEN, bug-guix@HIDDEN:
bug#50335; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 21 Oct 2023 22:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.