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

Handle end of channel in Seq API #95

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

Leonidas-from-XIV
Copy link
Contributor

In #92 @kit-ty-kate added support for the Seq API instead of the Stream API to be compatible with OCaml 5, which is very convenient, as we are approaching a release soon

While attempting to port the gettext unit tests which use assert_command I ran into the issue that migrating the tests to the Seq API was simple but they were always failing with an End_of_file exception.

Upon further inspection I realized the issue must be in ounit, and indeed: the previous code used Stream.of_channel which presumably handled End_of_file while the new Seq API would build an infinite Seq, attempting to read from the end of a channel, even if it was already at the end.

This changes the code to implement a functionality similar to Stream.of_channel.

Attempting to run the gettext unit tests succeeds without issues with this patch.

In gildor478#92 @kit-ty-kate added support for the `Seq` API instead of the
Stream API to be compatible with OCaml 5, which is very convenient, as
we are approaching a release.

While attempting to port the `gettext` unit tests which use
`assert_command` I ran into the issue that migrating the tests to the
`Seq` API was simple but they were always failing with an `End_of_file`
exception.

Upon further inspection I realized the issue must be in ounit, and
indeed: the previous code used `Stream.of_channel` which presumably
handled `End_of_file` while the new `Seq` API would build an infinite
`Seq`, attempting to read from the end of a channel, even if it was
already at the end.

This changes the code to implement a functionality similar to
`Stream.of_channel`.

Attempting to run the `gettext` unit tests succeeds without issues with
this patch.
Leonidas-from-XIV added a commit to Leonidas-from-XIV/ocaml-gettext that referenced this pull request Jun 28, 2022
This patch requires a release of ounit that incorporates the fix in
gildor478/ounit#95 for the `Seq` API to
correctly handle the end of the channel.
@Leonidas-from-XIV
Copy link
Contributor Author

Hi @gildor478, do you have a moment to look into this?

I am trying to unblock as many packages as possible for compatibility with OCaml 5.0 and getting gettext working via this PR would potentially allow an additional 1728 packages to build on OCaml 5.0.

@kit-ty-kate
Copy link
Contributor

I am trying to unblock as many packages as possible for compatibility with OCaml 5.0 and getting gettext working via this PR would potentially allow an additional 1728 packages to build on OCaml 5.0.

It's not really true. It's only counted high in the revdeps count because it was once a dependency of OASIS. But not anymore. Apart from older versions of OASIS no packages are really using gettext in opam currently

@Leonidas-from-XIV
Copy link
Contributor Author

Leonidas-from-XIV commented Oct 11, 2022 via email

@MisterDA MisterDA merged commit 7d67edd into gildor478:master Oct 27, 2022
Leonidas-from-XIV added a commit to Leonidas-from-XIV/ocaml-gettext that referenced this pull request Dec 2, 2022
This patch requires a release of ounit that incorporates the fix in
gildor478/ounit#95 for the `Seq` API to
correctly handle the end of the channel.
MisterDA added a commit to MisterDA/opam-repository that referenced this pull request Mar 22, 2023
CHANGES:

### Fixed
- Handle end of channel in Seq API.
  gildor478/ounit#95, @Leonidas-from-XIV

- Windows and OCaml 5 compatibility.
  gildor478/ounit#96, @MisterDA

### Changed
- Update to Dune 3.0 for newer stanzas and warnings.
  gildor478/ounit#96, @MisterDA
gildor478 pushed a commit to gildor478/ocaml-gettext that referenced this pull request Dec 26, 2024
This patch requires a release of ounit that incorporates the fix in
gildor478/ounit#95 for the `Seq` API to
correctly handle the end of the channel.
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.

3 participants