Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be compatible with OCaml 5.00.0 #294

Merged
merged 4 commits into from
Mar 11, 2022
Merged

Be compatible with OCaml 5.00.0 #294

merged 4 commits into from
Mar 11, 2022

Conversation

dinosaure
Copy link
Member

@dinosaure dinosaure commented Mar 2, 2022

Add a new dependency on cstruct-unix: mmap.1.2.0 to be compatible with OCaml 5.00.0 (/cc @kit-ty-kate).

EDIT: it's not strictly a compatibility with OCaml 5.00 but a compatibility with dune.3.0.0 too. Not sure where the problem was introduced but it seems a clear path for me.

unix/unix_cstruct.ml Outdated Show resolved Hide resolved
@haesbaert
Copy link
Member

Out of curiosity, what changed in 5.0, or why is Unix.map_file not enough anymore ?

@dinosaure
Copy link
Member Author

Out of curiosity, what changed in 5.0, or why is Unix.map_file not enough anymore ?

This patch is needed due to: ocaml/dune#5494

For a long support (including 4.05), we need to use bigarray-compat because bigarray (for OCaml <= 4.07) brings the unix dependency. So for a long term support, it's preferable to use bigarray-compat (even if, in that specific case, bigarray/bigarray-compat is not problem because the package - cstruct-unix - already depends on unix). Then, about OCaml 5.00, as I linked above, bigarray will be deleted (as a part of the caml distribution). It's a long run when we decided, may be 3 years ago, to integrate bigarray into the caml distribution without map_file which is now provided by mmap (for MirageOS) or unix.cmxa (for OCaml).

Due to the fact that cstruct is widely used, I prefer to keep a compatibility with, at least, 4.05.

@haesbaert
Copy link
Member

Out of curiosity, what changed in 5.0, or why is Unix.map_file not enough anymore ?

This patch is needed due to: ocaml/dune#5494

For a long support (including 4.05), we need to use bigarray-compat because bigarray (for OCaml <= 4.07) brings the unix dependency. So for a long term support, it's preferable to use bigarray-compat (even if, in that specific case, bigarray/bigarray-compat is not problem because the package - cstruct-unix - already depends on unix). Then, about OCaml 5.00, as I linked above, bigarray will be deleted (as a part of the caml distribution). It's a long run when we decided, may be 3 years ago, to integrate bigarray into the caml distribution without map_file which is now provided by mmap (for MirageOS) or unix.cmxa (for OCaml).

Due to the fact that cstruct is widely used, I prefer to keep a compatibility with, at least, 4.05.

Thank you for the explanation

@patricoferris
Copy link

Thanks for this @dinosaure -- looks like ppx_cstruct could use a similar bigarray library removal

(libraries sexplib ppxlib bigarray stdlib-shims))

@dinosaure
Copy link
Member Author

Indeed, I don't understand why we need such library for ppx.

@hannesm
Copy link
Member

hannesm commented Mar 7, 2022

I'd personally be also ok with raising the lower bound to 4.08.0 and removing all these -compat libraries (result, bigarray-compat, mmap) from our dependency chain. If someone is interested in earlier OCaml compilers, they can install old cstruct packages. The advantage of 4.08+ is as well e.g. the Result module (and let* syntax), which allows to remove the rresult dependency and write nice and readable code.

Given that OCaml 5.0.0 will have an impact on the ecosystem, I'd be in favour to drop the legacy boilerplate rather sooner than later to focus with a clear picture on the new major release (which may result in dropping even further legacy). Another reason is CI time / how many cycles are spent on a library. Given that both here and in opam-repository the CI attempts to compiler for all supported OCaml compilers, dropping support for old compilers is beneficial for the environment.

If we discover issues in cstruct we can always backport them to releases that work with OCaml before 4.08.

On a related note, since cmdliner 1.1.0 is supporting only OCaml >= 4.08.0, I can see that a huge part of our ecosystem is moving there already.

@dinosaure
Copy link
Member Author

On a related note, since cmdliner 1.1.0 is supporting only OCaml >= 4.08.0, I can see that a huge part of our ecosystem is moving there already.

It seems a good argument indeed. I think the best is to see the intersection between:

  • cstruct >= 6.0.0
  • and ocaml < 4.08

If we don't find any packages inside this intersection, we can safely drop the support of ocaml < 4.08. I will try to check that and come back later in this PR - may be the best is to merge this PR and, if we want to drop the support of ocaml < 4.08, propose an other PR which remove this support.

@hannesm
Copy link
Member

hannesm commented Mar 7, 2022

@dinosaure sounds good. A quick git grep cstruct | grep '>= "6.0.0"' | cut -d ':' -f 1 | xargs grep '"ocaml"' | grep -v '4.08' | less in opam-repository doesn't show anything that depends on cstruct >= 6.0.0 and requires ocaml < 4.08.0. The above output: (a) everything mentioning 4.08.0 is >= 4.08.0, (b) is non-empty, some packages requires earlier OCaml versions, other newer ones than 4.08.0. TL;DR: IMHO all safe to raise the lower bound to 4.08.0.

@dinosaure dinosaure merged commit c98c537 into master Mar 11, 2022
@dinosaure dinosaure deleted the fix-500 branch March 11, 2022 13:08
hannesm added a commit to hannesm/opam-repository that referenced this pull request Mar 29, 2022
…ct-lwt and cstruct-async (6.1.0)

CHANGES:

**breaking changes**
- The deprecated functions `Cstruct.len`, `Cstruct.add_len`, `Cstruct.set_len`,
  and `Cstruct.blit_to_string` have been removed (@hannesm mirage/ocaml-cstruct#291)

- Implement host_endian (@haesbaert mirage/ocaml-cstruct#292, fixes mirage/ocaml-cstruct#72)
- Compatibility with OCaml 5.0.0 (@dinosaure mirage/ocaml-cstruct#294)
- Drop support of OCaml < 4.08.0, remove bigarray-compat dependency
  (@hannesm mirage/ocaml-cstruct#298)
- Fix year in chages (@reynir mirage/ocaml-cstruct#297)
hannesm added a commit to hannesm/opam-repository that referenced this pull request Mar 31, 2022
…ct-lwt and cstruct-async (6.1.0)

CHANGES:

**breaking changes**
- The deprecated functions `Cstruct.len`, `Cstruct.add_len`, `Cstruct.set_len`,
  and `Cstruct.blit_to_string` have been removed (@hannesm mirage/ocaml-cstruct#291)

- Implement host_endian (@haesbaert mirage/ocaml-cstruct#292, fixes mirage/ocaml-cstruct#72)
- Compatibility with OCaml 5.0.0 (@dinosaure mirage/ocaml-cstruct#294)
- Drop support of OCaml < 4.08.0, remove bigarray-compat dependency
  (@hannesm mirage/ocaml-cstruct#298)
- Fix year in chages (@reynir mirage/ocaml-cstruct#297)
hannesm added a commit to hannesm/opam-repository that referenced this pull request Mar 31, 2022
…ct-lwt and cstruct-async (6.1.0)

CHANGES:

**breaking changes**
- The deprecated functions `Cstruct.len`, `Cstruct.add_len`, `Cstruct.set_len`,
  and `Cstruct.blit_to_string` have been removed (@hannesm mirage/ocaml-cstruct#291)

- Implement host_endian (@haesbaert mirage/ocaml-cstruct#292, fixes mirage/ocaml-cstruct#72)
- Compatibility with OCaml 5.0.0 (@dinosaure mirage/ocaml-cstruct#294)
- Drop support of OCaml < 4.08.0, remove bigarray-compat dependency
  (@hannesm mirage/ocaml-cstruct#298)
- Fix year in chages (@reynir mirage/ocaml-cstruct#297)
hannesm added a commit to hannesm/opam-repository that referenced this pull request Mar 31, 2022
…ct-lwt and cstruct-async (6.1.0)

CHANGES:

**breaking changes**
- The deprecated functions `Cstruct.len`, `Cstruct.add_len`, `Cstruct.set_len`,
  and `Cstruct.blit_to_string` have been removed (@hannesm mirage/ocaml-cstruct#291)

- Implement host_endian (@haesbaert mirage/ocaml-cstruct#292, fixes mirage/ocaml-cstruct#72)
- Compatibility with OCaml 5.0.0 (@dinosaure mirage/ocaml-cstruct#294)
- Drop support of OCaml < 4.08.0, remove bigarray-compat dependency
  (@hannesm mirage/ocaml-cstruct#298)
- Fix year in chages (@reynir mirage/ocaml-cstruct#297)
hannesm added a commit to hannesm/opam-repository that referenced this pull request Apr 1, 2022
…ct-lwt and cstruct-async (6.1.0)

CHANGES:

**breaking changes**
- The deprecated functions `Cstruct.len`, `Cstruct.add_len`, `Cstruct.set_len`,
  and `Cstruct.blit_to_string` have been removed (@hannesm mirage/ocaml-cstruct#291)

- Implement host_endian (@haesbaert mirage/ocaml-cstruct#292, fixes mirage/ocaml-cstruct#72)
- Compatibility with OCaml 5.0.0 (@dinosaure mirage/ocaml-cstruct#294)
- Drop support of OCaml < 4.08.0, remove bigarray-compat dependency
  (@hannesm mirage/ocaml-cstruct#298)
- Fix year in changes of 6.0.1 (@reynir mirage/ocaml-cstruct#297)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants