Bug when building ocaml-dune-build-info for ocaml5.0

  • Open
  • quality assurance status badge
Details
3 participants
  • Benjamin
  • Julien Lepiller
  • pukkamustard
Owner
unassigned
Submitted by
Benjamin
Severity
normal
B
B
Benjamin wrote on 7 Jun 2023 17:55
(address . bug-guix@gnu.org)
CT6J4OMR46BZ.1XRGC724PO5NF@robot.uvy.fr
Hello,

While trying to work with guix and add the ocaml-lsp-server for
ocaml@5.0 I think I faced a bug.

I did not find the root cause, but I think this is due to the fact of
using a combination of (inherit) and (package-with-ocaml5.0).

Here is a minimal example to reproduce the bug :

---
(use-modules
(gnu packages ocaml)
(guix build-system ocaml))

;ocaml-dune-build-info
(package-with-ocaml5.0 ocaml-dune-build-info)
---

Building the commented default version will create the expected package
in /gnu/store/...ocaml-dune-build-info

While building the ocaml5.0 version will build /gnu/store/...ocaml5.0-dune

I do not exactly know in which direction I should search to fix this
issue but there might be a bug in "package-with-ocaml5.0" function

Is this really a bug ? Or I did not use properly the
package-withocaml5.0 function.

Thanks

Benjamin
B
B
Benjamin wrote on 8 Jun 2023 09:26
(address . 63947@debbugs.gnu.org)
CT736E7PTRU1.1SCMH8L3I2WNC@robot.uvy.fr
After digging a bit more, I could fix this issue by modifying the
definition of ocaml-dune-build-info with this patch.

The problem might have come from the non standard definition of dune
package using properties only.


Toggle diff (13 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index f0b8f9e912..40a820b90e 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -9538,7 +9538,7 @@ (define-public ocaml-fix

(define-public ocaml-dune-build-info
(package
- (inherit dune)
+ (inherit dune-bootstrap)
(name "ocaml-dune-build-info")
(build-system dune-build-system)
(arguments
P
P
pukkamustard wrote on 13 Jun 2023 07:08
(name . Benjamin)(address . benjamin@uvy.fr)
86r0qfvpxf.fsf@posteo.net
Hi Benjamin,

Thanks for the report.

"Benjamin" <benjamin@uvy.fr> writes:

Toggle quote (16 lines)
> Here is a minimal example to reproduce the bug :
>
> ---
> (use-modules
> (gnu packages ocaml)
> (guix build-system ocaml))
>
> ;ocaml-dune-build-info
> (package-with-ocaml5.0 ocaml-dune-build-info)
> ---
>
> Building the commented default version will create the expected package
> in /gnu/store/...ocaml-dune-build-info
>
> While building the ocaml5.0 version will build /gnu/store/...ocaml5.0-dune

Yes, this is a bug.

The reason is that the `(inherit dune)` in ocaml-dune-build-info
incorrectly inherits the package variant properties from dune. The OCaml
5.0 variant for ocaml-dune-build-info becomes ocaml5.0-dune.

I think the best way to fix this is to clear the package variant
properties in ocaml-dune-build-info by resetting the properties. Find
attached a patch that does exactly that. CC: Julien for review.

Your fix to inherit from `dune-bootstrap` has a similar effect as the
package variants are defined in `dune` but not `dune-bootstrap`. I
slightly prefer not inheriting from `dune-bootstrap` as it reduces
things that directly touch bootstrap stuff.

-pukkamustard
From e9286b8552c2c4bed4dd7ddab4ccfeaedb03406c Mon Sep 17 00:00:00 2001
Message-Id: <e9286b8552c2c4bed4dd7ddab4ccfeaedb03406c.1686637070.git.pukkamustard@posteo.net>
From: pukkamustard <pukkamustard@posteo.net>
Date: Tue, 13 Jun 2023 08:13:48 +0200
Subject: [PATCH] gnu: ocaml-dune-build-info: Clear ocaml*-variant properties.

* gnu/packages/ocaml.scm (ocaml-dune-build-info): Clear properties.

Reported by Benjamin <benjamin@uvy.fr>.
---
gnu/packages/ocaml.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (16 lines)
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index ab0aa0574a..06ef5796d9 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -9664,6 +9664,7 @@ (define-public ocaml-dune-build-info
#:tests? #f))
(propagated-inputs
(list ocaml-odoc))
+ (properties '())
(synopsis "Embed build information inside an executable")
(description "This package allows one to access information about how the
executable was built, such as the version of the project at which it was built

base-commit: 0433e7f3c200936fbf77f22aa3b433413d17d0fa
--
2.40.1
J
J
Julien Lepiller wrote on 13 Jun 2023 08:36
(address . 63947@debbugs.gnu.org)
744DD02A-15C8-4CB9-90B8-9E7CF69021C4@lepiller.eu
Untested yet, but looks fine, thanks

Le 13 juin 2023 07:08:11 GMT+02:00, pukkamustard <pukkamustard@posteo.net> a écrit :
Toggle quote (40 lines)
>
>Hi Benjamin,
>
>Thanks for the report.
>
>"Benjamin" <benjamin@uvy.fr> writes:
>
>> Here is a minimal example to reproduce the bug :
>>
>> ---
>> (use-modules
>> (gnu packages ocaml)
>> (guix build-system ocaml))
>>
>> ;ocaml-dune-build-info
>> (package-with-ocaml5.0 ocaml-dune-build-info)
>> ---
>>
>> Building the commented default version will create the expected package
>> in /gnu/store/...ocaml-dune-build-info
>>
>> While building the ocaml5.0 version will build /gnu/store/...ocaml5.0-dune
>
>Yes, this is a bug.
>
>The reason is that the `(inherit dune)` in ocaml-dune-build-info
>incorrectly inherits the package variant properties from dune. The OCaml
>5.0 variant for ocaml-dune-build-info becomes ocaml5.0-dune.
>
>I think the best way to fix this is to clear the package variant
>properties in ocaml-dune-build-info by resetting the properties. Find
>attached a patch that does exactly that. CC: Julien for review.
>
>Your fix to inherit from `dune-bootstrap` has a similar effect as the
>package variants are defined in `dune` but not `dune-bootstrap`. I
>slightly prefer not inheriting from `dune-bootstrap` as it reduces
>things that directly touch bootstrap stuff.
>
>-pukkamustard
>
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 63947@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 63947
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch