Skip to content

rpc status: fix for Win32#8806

Merged
nojb merged 7 commits intoocaml:mainfrom
nojb:rpc_status_win32
Oct 1, 2023
Merged

rpc status: fix for Win32#8806
nojb merged 7 commits intoocaml:mainfrom
nojb:rpc_status_win32

Conversation

@nojb
Copy link
Copy Markdown
Collaborator

@nojb nojb commented Sep 30, 2023

Beginning of a fix for #8799, but not complete because dune rpc status does not seem to be fully working:

image

(no data is reported for the connected client)

cc @Alizter

Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
@nojb
Copy link
Copy Markdown
Collaborator Author

nojb commented Sep 30, 2023

After further testing, it seems to be working:

image

@Alizter, can you give it a try on your side to confirm? Thanks!

Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
Copy link
Copy Markdown
Collaborator

@Alizter Alizter left a 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.

| Error e -> Error e
| Ok contents ->
(match of_string contents with
(match default ~build_dir () with
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Collaborator Author

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:

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)
;;

Copy link
Copy Markdown
Member

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:

  1. Inspect the file _build/.rpc/dune
  2. If it's a socket, connect to it (will never happen on windows)
  3. 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.

Copy link
Copy Markdown
Collaborator Author

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
Copy link
Copy Markdown
Collaborator Author

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

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>
@nojb nojb force-pushed the rpc_status_win32 branch from 719d192 to 34c39d6 Compare October 1, 2023 16:57
@@ -0,0 +1 @@
- Fix `dune rpc status` on Windows (#8806, fixes #8799, @nojb)
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like monitor too.

Copy link
Copy Markdown
Collaborator Author

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.

nojb and others added 4 commits October 1, 2023 18:15
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
@nojb nojb merged commit c91a9f6 into ocaml:main Oct 1, 2023
@nojb nojb deleted the rpc_status_win32 branch October 1, 2023 18:28
@emillon
Copy link
Copy Markdown
Collaborator

emillon commented Oct 2, 2023

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.

Sure. To be clear, this is a regression introduced in 3.9.0?

@nojb
Copy link
Copy Markdown
Collaborator Author

nojb commented Oct 2, 2023

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.

Sure. To be clear, this is a regression introduced in 3.9.0?

I suspect this has never worked on Windows, until this PR.

@emillon
Copy link
Copy Markdown
Collaborator

emillon commented Oct 2, 2023

OK. Note a huge rush then. I'll backport that to 3.11.1.

@emillon emillon mentioned this pull request Oct 2, 2023
7 tasks
@rgrinberg rgrinberg linked an issue Oct 2, 2023 that may be closed by this pull request
emillon pushed a commit to emillon/dune that referenced this pull request Oct 9, 2023
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
emillon pushed a commit to emillon/dune that referenced this pull request Oct 9, 2023
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
Signed-off-by: Etienne Millon <me@emillon.org>
emillon added a commit that referenced this pull request Oct 9, 2023
Signed-off-by: nojebar <nicolas.ojeda.bar@lexifi.com>
Signed-off-by: Etienne Millon <me@emillon.org>
Co-authored-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
emillon added a commit to emillon/opam-repository that referenced this pull request Oct 9, 2023
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)
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
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)
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.

windows: dune rpc status not working

4 participants