Skip to content

Conversation

mseri
Copy link
Collaborator

@mseri mseri commented Apr 25, 2018

See discussion in https://ocaml.github.io/ocamlunix/ocamlunix.html#sec118
and xapi-project/xen-api#3570

This also fixed another potential issue in unixext_open_stubs

Marcello Seri added 2 commits April 25, 2018 09:47
Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
@mseri mseri requested review from gaborigloi and robhoes April 25, 2018 08:53
@coveralls
Copy link

Pull Request Test Coverage Report for Build 30

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.649%

Totals Coverage Status
Change from base Build 29: 0.0%
Covered Lines: 73
Relevant Lines: 74

💛 - Coveralls

@coveralls
Copy link

coveralls commented Apr 25, 2018

Pull Request Test Coverage Report for Build 33

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.649%

Totals Coverage Status
Change from base Build 29: 0.0%
Covered Lines: 73
Relevant Lines: 74

💛 - Coveralls

@minli1
Copy link
Member

minli1 commented Apr 25, 2018

Really detailed comment above code, nice !!! 👍

@robhoes
Copy link
Member

robhoes commented Apr 25, 2018

Travis ain't happy :(


(* Ideally, really_write would be implemented with optional arguments ?(off=0) ?(len=String.length string) *)
let really_write_string fd string =
let payload = Bytes.unsafe_of_string string in
Copy link
Contributor

@edwintorok edwintorok Apr 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're in the area, could you remove this and use Unix.single_write_substring instead? I don't think we should use Bytes.unsafe_of_string anywhere unless we really have other choice. If you need to use an unsafe function to avoid code duplication it would be better to use Bytes.unsafe_to_string and implement really_write by using really_write_string, writing does not modify the buffer at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I think it makes sense and will simplify the port to safe-string. Note however this will break the symmetry of the interface with respect to really_read (that requires a bytes buffer)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fine, read and write have to be different, the former does modify its argument.
If you want to make it clearer you can call the function really_write_substring, but its fine as it is.

@mseri
Copy link
Collaborator Author

mseri commented Apr 25, 2018

The build failure is unrelated but weird. It is supposed to install lwt as it is a dependency of many of the packages, but for some reasons it does not pick it up as a dependency at all....

Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
@mseri
Copy link
Collaborator Author

mseri commented Apr 25, 2018

I've looked more carefully into the Travis error. It happens in one of the revdeps steps, for some reasons when installing xe.master it loses the lwt from the dependency chain. It is unrelated from this and probably we should not run the revdeps on the coverage build, I am going to disable that. If I can figure out the dependencies issue I'll send a PR to xs-opam to fix it

Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
@mseri
Copy link
Collaborator Author

mseri commented Apr 25, 2018

The coverage build is now passing. The xe.master failure is independent and has to be understood at the xs-opam level. @edwintorok are you happy with the changes?

Copy link
Contributor

@edwintorok edwintorok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mseri mseri merged commit 3a73fbb into xapi-project:master Apr 25, 2018
@mseri mseri deleted the fix-really-write branch April 25, 2018 12:58
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.

6 participants