Bug 282086 - devel/ocaml-sexplib0: Update to 0.17.0, chase related ports
Summary: devel/ocaml-sexplib0: Update to 0.17.0, chase related ports
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-14 19:59 UTC by Benjamin Jacobs
Modified: 2024-10-15 11:21 UTC (History)
2 users (show)

See Also:


Attachments
0001-devel-ocaml-sexplib0-Update-to-0.17.0-chase-related-.patch (17.46 KB, patch)
2024-10-14 19:59 UTC, Benjamin Jacobs
no flags Details | Diff
0001-devel-ocaml-sexplib0-Update-to-0.17.0-chase-related-.patch (17.44 KB, patch)
2024-10-14 20:14 UTC, Benjamin Jacobs
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Jacobs 2024-10-14 19:59:07 UTC
Created attachment 254229 [details]
0001-devel-ocaml-sexplib0-Update-to-0.17.0-chase-related-.patch

Dears,

Please apply this patch to update devel/ocaml-sexplib0 and related ports. By this I'd like to take on its maintainership.

Best regards,

Benjamin
Comment 1 Benjamin Jacobs 2024-10-14 20:14:14 UTC
Created attachment 254231 [details]
0001-devel-ocaml-sexplib0-Update-to-0.17.0-chase-related-.patch

Same patch, but applying directly to main this time.

(There was another in-flight patch on my tip, intersecting the PORTREVISION bumps of this one).
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2024-10-15 06:58:07 UTC
Hi,

Thanks for the update and the work.

WHile I test the patch, could you please elaborate on why the PORTREVISION bump in dependencies is necessary? it is not immediately obvious by the diff contents, maybe it requires some specific ocaml internals knowledge to grasp it?

Thanks again!
Comment 3 Benjamin Jacobs 2024-10-15 08:58:37 UTC
Hi Guido,

It is because ocaml objects store a hash of the signature of the
library against which they have been compiled. This is to ensure that
the program stays sound.  The same issue occurs in rust, e.g. when you
update a single dependency in the Cargo.toml file, you will see that cargo
will recompile most of the other dependencies[1].

Let me demonstate the problem:

1: you have build all the packages before updating ocaml-sexplib0
#  poudriere bulk ... -C ocaml/ocaml-ppxlib ocaml/ocaml-sexplib0

2: you apply my patch but revert all the PORTREVISIONS bumps

# poudriere testport -j 150_CURRENT_amd64 -p freebsd -i devel/ocaml-sexplib0
...
[150_CURRENT_amd64-freebsd] Extracting ocaml-sexplib0-0.17.0: 100%
[00:00:14] Installing local Pkg repository to /usr/local/etc/pkg/repos
[00:00:14] Remounting /usr/ports read-write
[00:00:14] Mounting logs from: /usr/local/poudriere/data/logs/bulk/150_CURRENT_amd64-freebsd/2024-10-15_08h07m58s
[00:00:14] Entering interactive test mode. Type 'exit' when done.
Welcome to Poudriere interactive mode!
nobody@150_CURRENT_amd64-freebsd:/usr/ports/devel/ocaml-sexplib0 $ su -
root@150_CURRENT_amd64-freebsd:/usr/ports/devel/ocaml-sexplib0 # pkg ins ocaml-ppxlib ocaml-findlib
Updating local repository catalogue...
local repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 21 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        brotli: 1.1.0,1
        expat: 2.6.3
        fontconfig: 2.15.0_3,1
        freetype2: 2.13.3
        libX11: 1.8.9,1
        libXScrnSaver: 1.2.4_1
        libXau: 1.0.11
        libXdmcp: 1.1.5
        libXext: 1.3.6,1
        libXft: 2.3.8
        libXrender: 0.9.11
        libxcb: 1.17.0
        ocaml-compiler-libs: 0.12.4
        ocaml-findlib: 1.9.6_3
        ocaml-labltk: 8.06.12_1
        ocaml-ppx_derivers: 1.2.1
        ocaml-ppxlib: 0.33.0
        png: 1.6.44
        tcl86: 8.6.15_2
        tk86: 8.6.15
        xorgproto: 2024.1

Number of packages to be installed: 21

The process will require 150 MiB more space.

Proceed with this action? [y/N]: y
...
[150_CURRENT_amd64-freebsd] [21/21] Extracting ocaml-ppxlib-0.33.0: 100%

root@150_CURRENT_amd64-freebsd:/usr/ports/devel/ocaml-sexplib0 # ocaml
OCaml version 4.14.2
Enter #help;; for help.

# #use "topfind";; (* -> load findlib toplevel command *)
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
# #require "ppxlib";;  (* -> ask findlib to ppxlib into the toplevel, it will load its depencies first *)
/usr/local/lib/ocaml/site-lib/ocaml-compiler-libs/shadow: added to search path
/usr/local/lib/ocaml/site-lib/ocaml-compiler-libs/shadow/ocaml_shadow.cma: loaded
/usr/local/lib/ocaml/site-lib/ppx_derivers: added to search path
/usr/local/lib/ocaml/site-lib/ppx_derivers/ppx_derivers.cma: loaded
/usr/local/lib/ocaml/compiler-libs: added to search path
/usr/local/lib/ocaml/compiler-libs/ocamlcommon.cma: loaded
/usr/local/lib/ocaml/site-lib/ocaml-compiler-libs/common: added to search path
/usr/local/lib/ocaml/site-lib/ocaml-compiler-libs/common/ocaml_common.cma: loaded
/usr/local/lib/ocaml/site-lib/ppxlib/astlib: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/astlib/astlib.cma: loaded
/usr/local/lib/ocaml/site-lib/ppxlib/ast: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/ast/ppxlib_ast.cma: loaded
/usr/local/lib/ocaml/site-lib/ppxlib/print_diff: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/print_diff/ppxlib_print_diff.cma: loaded
/usr/local/lib/ocaml/site-lib/sexplib0: added to search path
/usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma: loaded
/usr/local/lib/ocaml/site-lib/ppxlib/stdppx: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/stdppx/stdppx.cma: loaded
The files /usr/local/lib/ocaml/site-lib/ppxlib/stdppx/stdppx.cma
and /usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma            <- BOOM!
disagree over interface Sexplib0__Sexp_grammar
/usr/local/lib/ocaml/site-lib/ppxlib/traverse_builtins: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/traverse_builtins/ppxlib_traverse_builtins.cma: loaded
/usr/local/lib/ocaml/site-lib/ppxlib: added to search path
/usr/local/lib/ocaml/site-lib/ppxlib/ppxlib.cma: loaded
The files /usr/local/lib/ocaml/site-lib/ppxlib/ppxlib.cma
and /usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma
disagree over interface Sexplib0__Sexp_grammar                      <- BOOM!
# open Ppxlib;;
Error: The files /usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma
       and /usr/local/lib/ocaml/site-lib/ppxlib/ppxlib.cmi
       make inconsistent assumptions over interface Sexplib0__Sexp_grammar
# ^D

So by updating sexplib0, we have made the existing ppxlib library unusable.

Here we see with what the "Ppxlib" module of ppxlib has been compiled against.

# ocamlobjinfo /usr/local/lib/ocaml/site-lib/ppxlib/ppxlib.cma
...skip
Unit name: Ppxlib
Interfaces imported:
...skip
        2faa9bde329eba38acd3881e9d57559e        Sexplib0
...

And compare with what version we have:

# ocamlobjinfo /usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma
File /usr/local/lib/ocaml/site-lib/sexplib0/sexplib0.cma
Force custom: no
Extra C object files:
Extra C options:
Extra dynamically-loaded libraries:
...skip
Required globals:
Uses unsafe features: no
Force link: no
Unit name: Sexplib0
Interfaces imported:
        79b0e9d3b6f7fed07eb3cc2abb961b91        Stdlib
        5bb23eed6b0e6bef4878480b270ab142        Sexplib0__
        377f73f726ecaec708d05509401d8b76        Sexplib0      <-- different hash!
        8f8f634558798ee408df3c50a5539b15        CamlinternalFormatBasics
Required globals:
Uses unsafe features: no
Force link: no

I hope that this explaination is sufficient to understand the problem.



[1]: of course, in practice with rust, go, etc., there is no packaging
   implication because they have given up on the idea of providing
   shared objects and loadable libraries...

[2]: Note that in this patch, some of bumps are not needed
   (e.g. encoders/ocaml-base64) because, although they require ppxlib
   to build (which needs to be rebuild, hence will have a different
   signature), they do not record this dependency in the resulting
   objects.  But I don't have an automated method to filter those out,
   so I'd prefer to err on the safe side.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2024-10-15 11:02:26 UTC
(In reply to Benjamin Jacobs from comment #3)

Thanks for the exhaustive explanation. I was not aware of all these details.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-10-15 11:20:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8038b6c1a6c91bd3e967bb51e7b85804a0e8a19a

commit 8038b6c1a6c91bd3e967bb51e7b85804a0e8a19a
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2024-10-15 11:17:11 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2024-10-15 11:17:11 +0000

    devel/ocaml-sexplib0: Update to 0.17.0

    Assign maintainership to submitter

    PR:             282086

 devel/ocaml-sexplib0/Makefile        | 33 ++++++---------------
 devel/ocaml-sexplib0/distinfo        |  6 ++--
 devel/ocaml-sexplib0/pkg-plist (new) | 57 ++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 27 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-10-15 11:20:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fc9200867e270303c170dd81260957cb00fb0092

commit fc9200867e270303c170dd81260957cb00fb0092
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2024-10-15 11:17:56 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2024-10-15 11:17:56 +0000

    devel/ocaml-sexplib0: Bump revisions after dependency update

    PR:             282086

 converters/ocaml-base64/Makefile     | 2 +-
 devel/ocaml-base/Makefile            | 2 +-
 devel/ocaml-bos/Makefile             | 2 +-
 devel/ocaml-camlp5/Makefile          | 2 +-
 devel/ocaml-cstruct/Makefile         | 2 +-
 devel/ocaml-dolmen/Makefile          | 2 +-
 devel/ocaml-ipaddr/Makefile          | 2 +-
 devel/ocaml-linol/Makefile           | 2 +-
 devel/ocaml-logs/Makefile            | 2 +-
 devel/ocaml-lsp/Makefile             | 2 +-
 devel/ocaml-lwt/Makefile             | 2 +-
 devel/ocaml-parsexp/Makefile         | 1 +
 devel/ocaml-ppx_blob/Makefile        | 1 +
 devel/ocaml-ppx_compare/Makefile     | 1 +
 devel/ocaml-ppx_deriving/Makefile    | 1 +
 devel/ocaml-ppx_hash/Makefile        | 1 +
 devel/ocaml-ppx_js_style/Makefile    | 1 +
 devel/ocaml-ppx_sexp_conv/Makefile   | 2 +-
 devel/ocaml-ppx_yojson_conv/Makefile | 2 +-
 devel/ocaml-ppxlib/Makefile          | 1 +
 devel/ocaml-sexplib/Makefile         | 1 +
 devel/ocaml-stdio/Makefile           | 1 +
 devel/ocaml-trace/Makefile           | 1 +
 ftp/ocaml-ocurl/Makefile             | 2 +-
 graphics/ocaml-images/Makefile       | 3 ++-
 math/alt-ergo/Makefile               | 2 +-
 math/ocaml-farith/Makefile           | 1 +
 math/ocaml-ocplib-simplex/Makefile   | 1 +
 math/ocamlgsl/Makefile               | 1 +
 security/ocaml-lwt_ssl/Makefile      | 2 +-
 30 files changed, 31 insertions(+), 17 deletions(-)
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2024-10-15 11:21:30 UTC
Update committed, and maintainer updated. Thanks!