Skip to content

Make [read_all] work for channels that are not files#3162

Merged
aalekseyev merged 11 commits intoocaml:masterfrom
aalekseyev:fix-io-read_all
Feb 20, 2020
Merged

Make [read_all] work for channels that are not files#3162
aalekseyev merged 11 commits intoocaml:masterfrom
aalekseyev:fix-io-read_all

Conversation

@aalekseyev
Copy link
Copy Markdown
Collaborator

This fixes a bug where Sys.linux is not detected properly because /proc/sys/kernel/ostype is not a file.

Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
@aalekseyev aalekseyev requested a review from a user February 19, 2020 11:50
@rgrinberg
Copy link
Copy Markdown
Member

Looks good. Let's add a change log entry since this is probably confusing a lot of linux users.

@aalekseyev
Copy link
Copy Markdown
Collaborator Author

Did we do a release since the bug was introduced?

@rgrinberg
Copy link
Copy Markdown
Member

Yup... 2.3 contains this bug

@aalekseyev
Copy link
Copy Markdown
Collaborator Author

... and is missing any relevant changelog entry. Should I put one retroactively, or do we not do that?

@rgrinberg
Copy link
Copy Markdown
Member

rgrinberg commented Feb 19, 2020 via email

@aalekseyev
Copy link
Copy Markdown
Collaborator Author

I guess the mention of when the bug was introduced in 2.4.0's changelog should be sufficient. Pushed that.

Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
@rgrinberg
Copy link
Copy Markdown
Member

rgrinberg commented Feb 19, 2020 via email

@ghost
Copy link
Copy Markdown

ghost commented Feb 19, 2020

Nevermind, I though in_channel_length was raising. Let's not bother then. Though let's use Buffer.add_channel to avoid the extra copy.

aalekseyev and others added 6 commits February 19, 2020 17:33
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost
Copy link
Copy Markdown

ghost commented Feb 20, 2020

I let you check the new code, it's a bit more complicated but it seems worth it to me. I'm always wary of these temporary buffers putting pressure on the gc.

Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
@aalekseyev
Copy link
Copy Markdown
Collaborator Author

aalekseyev commented Feb 20, 2020

By the way, it looks like lseek mostly works correctly on procfs (e.g. SEEK_CUR works fine, even with negative offsets), it's just SEEK_END that's broken. In fact it seems to handle SEEK_END exactly like SEEK_SET. I wonder if this is just a small bug that might be fixed on newer kernels.

And in fact linux does raise an error when lseek is used on non-file fds.

aalekseyev and others added 2 commits February 20, 2020 12:15
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost
Copy link
Copy Markdown

ghost commented Feb 20, 2020

Ah ok, that makes more sense.

@aalekseyev aalekseyev merged commit 4670939 into ocaml:master Feb 20, 2020
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Feb 20, 2020
…lugin, dune-private-libs and dune-glob (2.3.1)

CHANGES:

- Fix versioning of artifact variables (eg %{cmxa:...}), which were introduced
  in 2.0, not 1.11. (ocaml/dune#3149, @nojb)

- Fix a bug introduced in 2.3.0 where dune insists on using `fswatch` on linux
  (even when `inotifywait` is available). (ocaml/dune#3162, @aalekseyev)

- Fix a bug causing all executables to be considered as optional (ocaml/dune#3163, @diml)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Feb 22, 2020
…lugin, dune-private-libs and dune-glob (2.3.1)

CHANGES:

- Fix versioning of artifact variables (eg %{cmxa:...}), which were introduced
  in 2.0, not 1.11. (ocaml/dune#3149, @nojb)

- Fix a bug introduced in 2.3.0 where dune insists on using `fswatch` on linux
  (even when `inotifywait` is available). (ocaml/dune#3162, @aalekseyev)

- Fix a bug causing all executables to be considered as optional (ocaml/dune#3163, @diml)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Feb 23, 2020
…lugin, dune-private-libs and dune-glob (2.3.1)

CHANGES:

- Fix versioning of artifact variables (eg %{cmxa:...}), which were introduced
  in 2.0, not 1.11. (ocaml/dune#3149, @nojb)

- Fix a bug introduced in 2.3.0 where dune insists on using `fswatch` on linux
  (even when `inotifywait` is available). (ocaml/dune#3162, @aalekseyev)

- Fix a bug causing all executables to be considered as optional (ocaml/dune#3163, @diml)
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Feb 24, 2020
…lugin, dune-private-libs and dune-glob (2.3.1)

CHANGES:

- Fix versioning of artifact variables (eg %{cmxa:...}), which were introduced
  in 2.0, not 1.11. (ocaml/dune#3149, @nojb)

- Fix a bug introduced in 2.3.0 where dune insists on using `fswatch` on linux
  (even when `inotifywait` is available). (ocaml/dune#3162, @aalekseyev)

- Fix a bug causing all executables to be considered as optional (ocaml/dune#3163, @diml)
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