-
Notifications
You must be signed in to change notification settings - Fork 437
rpc status: fix for Win32 #8806
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
Conversation
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
f4b5978
to
e7e8c50
Compare
After further testing, it seems to be working: @Alizter, can you give it a try on your side to confirm? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, thanks!
cc @emillon any chance we can get this backported for 3.9-3.11? Or at least add it to a list in case another point release is decided.
otherlibs/dune-rpc/private/where.ml
Outdated
| Error e -> Error e | ||
| Ok contents -> | ||
(match of_string contents with | ||
(match default ~build_dir () with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what the issue is yet, but this fix doesn't seem right to me. Previously, the code would look at the socket inside the build directory to connect, and now it's just assuming the address is the default address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing has changed here for Unix systems: default ~build_dir ()
still returns the socket inside the build directory:
dune/otherlibs/dune-rpc/private/where.ml
Lines 130 to 134 in 071cb47
let default ?(win32 = win32) ~build_dir () = | |
if win32 | |
then `Ip (`Host (Unix.string_of_inet_addr Unix.inet_addr_loopback), `Port default_port) | |
else `Unix (Filename.concat build_dir rpc_socket_relative_to_build_dir) | |
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but even on Windows, the workflow to connect should be:
- Inspect the file _build/.rpc/dune
- If it's a socket, connect to it (will never happen on windows)
- If it's a normal file, read it and get the connection string from here. On windows, that connection string will have the address we want to connect on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, you are right. I hadn't grasped the logic behind the client/server split. Now I pushed a commit with the right fix I think.
| `Unix p -> sprintf "unix://%s" p | ||
| `Ip (`Host host, `Port port) -> sprintf "%s:%d" host port | ||
;; | ||
let to_string t = Dune_rpc_private.Where.to_string t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the right "dbus" format so that it can be parsed back in
dune/otherlibs/dune-rpc/private/where.ml
Lines 154 to 162 in 071cb47
let of_file f = | |
let+ contents = IO.read_file f in | |
match contents with | |
| Error e -> Error e | |
| Ok contents -> | |
(match of_string contents with | |
| Error e -> Error e | |
| Ok s -> Ok (Some s)) | |
in |
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
doc/changes/8806.md
Outdated
@@ -0,0 +1 @@ | |||
- Fix `dune rpc status` on Windows (#8806, fixes #8799, @nojb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a little more than status
. It should fix all dune rpc
commands in fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like monitor
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. I amended the Changes entry.
Sure. To be clear, this is a regression introduced in 3.9.0? |
I suspect this has never worked on Windows, until this PR. |
OK. Note a huge rush then. I'll backport that to 3.11.1. |
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com> Signed-off-by: Etienne Millon <me@emillon.org>
CHANGES: - Fix `dune rpc` commands on Windows (ocaml/dune#8806, fixes ocaml/dune#8799, @nojb) - Fix `inline_tests` when the partition list is empty (ocaml/dune#8849, fixes ocaml/dune#8848, @hhugo)
CHANGES: - Fix `dune rpc` commands on Windows (ocaml/dune#8806, fixes ocaml/dune#8799, @nojb) - Fix `inline_tests` when the partition list is empty (ocaml/dune#8849, fixes ocaml/dune#8848, @hhugo)
Beginning of a fix for #8799, but not complete because
dune rpc status
does not seem to be fully working:(no data is reported for the connected client)
cc @Alizter