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

Sync.fetch raises Mimic error: Handshake got an error #644

Closed
kentookura opened this issue Jun 25, 2024 · 3 comments
Closed

Sync.fetch raises Mimic error: Handshake got an error #644

kentookura opened this issue Jun 25, 2024 · 3 comments

Comments

@kentookura
Copy link

Hello,
in the context of using this library via irmin, we've encountered an issue.

The following code fails on both nixOS 24.05 via WSL (@kentookura), and macOS 14.5 (@jonsterling). however @art-w reports the code working on their linux.

(executable (name test) (libraries lwt git-unix git.nss.git))
open Lwt.Syntax
open Lwt.Infix
module Store = Git_unix.Store
module Sync = Git_unix.Sync (Store)
module Uri = Smart_git.Endpoint

let src =
  Uri.of_string "https://git.sr.ht/~jonsterling/public-trees" |> Result.get_ok

let main () =
  let* ctx = Git_unix.ctx (Happy_eyeballs_lwt.create ()) in
  let* store = Store.v Fpath.(v "/tmp" / "gitsync") >|= Result.get_ok in
  let+ result = Sync.fetch ~ctx src store `All in
  match result with
  | Ok (Some (_hash, lst)) ->
      Format.printf "Ok! Some list %#i@." (List.length lst)
  | Ok None -> Format.printf "Ok! None?@."
  | Error (#Mimic.error as e) ->
      Format.printf "Mimic error: %a@." Mimic.pp_error e
  | Error (`Exn e) -> Format.printf "Git error: %s@." (Printexc.to_string e)
  | Error _ -> Format.printf "Git error: <unknown private error tag>@."

let () = Lwt_main.run (main ())
Mimic error: Handshake got an error

Thanks!

mirage/irmin#2319

@jonsterling
Copy link

Hi all, I wanted to check if anyone has had a chance to look into this issue — I have some cool experiments I would like to run in connection with the Forester project that are currently blocked on this.

@dinosaure
Copy link
Member

You must initialize mirage-crypto-rng.unix at some point. I can reproduce your error and I can fix it also if I add into your code:

let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)

I agree that the error is a bit obscur. I will try to understand why mirage-crypto does not show up a message which advise the user to initialize the RNG.

@dinosaure
Copy link
Member

Fixed by #647

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

No branches or pull requests

3 participants