dune icon indicating copy to clipboard operation
dune copied to clipboard

dune pkg: improve behavior when available git is too old

Open mbarbin opened this issue 4 months ago • 12 comments

When trying the dune developer preview I had to do a manual upgrade of git. The git that's packaged by ubuntu 20.04.6 LTS is too old for dune pkg.

$ /usr/bin/git --version
git version 2.25.1

dune pkg lock resulted in an internal error for me, displaying the "I must not crash" poem.

$ dune pkg lock
Internal error, please report upstream including the contents of _build/log.
Description:
  ("git returned non-zero exit code",
   { exit code = 129
   ; dir = External "/home/mathieu/.cache/dune/git-repo"
   ; git = External "/usr/bin/git"
   ; args =
       [ "fetch"
       ; "--no-write-fetch-head"
       ; "https://github.com/ocaml-dune/opam-overlays.git"
       ; "9bad4501e6dd4feb7b61b48d29812241d1d711f9"
       ]
   ; output = []
   })
Raised at Stdune__Code_error.raise in file
  "otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from Fiber__Core.O.(>>|).(fun) in file "vendor/fiber/src/core.ml",
  line 253, characters 36-41
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
  line 76, characters 8-11
Re-raised at Stdune__Exn.raise_with_backtrace in file
  "otherlibs/stdune/src/exn.ml" (inlined), line 38, characters 27-56
Called from Stdune__Exn_with_backtrace.reraise in file
  "otherlibs/stdune/src/exn_with_backtrace.ml", line 20, characters 33-71
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
  line 76, characters 8-11

I must not crash. Uncertainty is the mind-killer. Exceptions are the little-death that brings total obliteration. I will fully express my cases. Execution will pass over me and through me. And when it has gone past, I will unwind the stack along its path. Where the cases are handled there will be nothing. Only I will remain.

I think in this git version, git fetch doesn't know the --no-write-fetch-head flag.

It would be nice if dune warned you somehow, instead of throwing some internal error. What's the minimal version that dune pkg requires?

Upgrading git to 2.46.2 fixed it, I am not blocked on this.

mbarbin avatar Sep 30 '24 09:09 mbarbin