ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.23k stars 353 forks source link

"/usr/bin/git diff --quiet" exited with code 129 #3204

Open Armael opened 6 years ago

Armael commented 6 years ago

I just switched to opam 2 from opam 1.2.2. I ran the update step for upgrading the layout of .opam successfully. But now, calling opam update fails with the following error:

[ERROR] Command "/usr/bin/git diff --quiet" failed:
"/usr/bin/git diff --quiet" exited with code 129

# opam config report
# opam-version      2.0.0~rc (c93e37310d11640e4e4e35e68930bc112be48bb0) 
# self-upgrade      no
# system            arch=x86_64 os=linux os-distribution=arch os-version=unknown
# solver            builtin-mccs+glpk
# install-criteria  -removed,-count[version-lag,request],-count[version-lag,changed],-changed
# upgrade-criteria  -removed,-count[version-lag,solution],-new
# jobs              4
# repositories      2 (http), 4 (version-controlled)
# pinned            5 (git), 1 (http)
# current-switch    4.04.2
Armael commented 6 years ago

Not sure if this is related, but if I try opam upgrade instead, I get the following:

https://gist.github.com/Armael/7ac4ce561c9b698ab1b4ad5725a33038

AltGr commented 6 years ago

The issue apparently blocked the repository update ; this explains the upgrade results, because it made opam assume an empty repository.

Now the first issue is quite weird, because an exit of 129 normally means the process received the HUP signal... Could this be related to #3206 ?

AltGr commented 6 years ago

My bad, apparently git breaks the convention on exit codes, and 129 may also mean bad arguments. What's your git version (git --version) ? Thanks

Armael commented 6 years ago

Thanks for investigating. I'm using git version 2.16.1.

AltGr commented 6 years ago

Surprising, that should really support the options... What does /usr/bin/git diff --quiet return if called manually ? You could also try to run with -vv to see the actual output of git.

AltGr commented 6 years ago

Ah, git diff actually also returns 129 if called outside of a git repository. Maybe your repo in ~/.opam/repo/<repo-name> got corrupted, or wasn't using git but is now detected as such ? In that case there are a few things you could do:

Thanks!

Armael commented 6 years ago

Ah, git diff actually also returns 129 if called outside of a git repository.

That's indeed what seems to be happening (using -vv). Here's the full output of opam update -vv:

 ~ $ opam update -vv
+ /usr/bin/git "diff" "--quiet" (CWD=/home/armael/.opam/4.04.2/.opam-switch/sources/coq-equations)
+ /usr/bin/git "diff" "--quiet" (CWD=/home/armael/.opam/4.04.2/.opam-switch/sources/coq-procrastination)
- Not a git repository
- To compare two paths outside a working tree:
- usage: git diff [--no-index] <path> <path>
'opam update -vv' failed.
[ERROR] Command "/usr/bin/git diff --quiet" failed:
"/usr/bin/git diff --quiet" exited with code 129

coq-equations and coq-procrastination are two git-pinned packages. /home/armael/.opam/4.04.2/.opam-switch/sources/coq-equations is a valid git repository, but /home/armael/.opam/4.04.2/.opam-switch/sources/coq-procrastination apparently is not one.

Re-creating the pin would probably solve this precise issue; but maybe there's something to be done in opam to ensure this issue doesn't happen again?

AltGr commented 6 years ago

Re-creating the pin would probably solve this precise issue; but maybe there's something to be done in opam to ensure this issue doesn't happen again?

Sure. It's a bit difficult now to trace back what happened to your directory, but we can at least catch this error and print a more informative message. Could you check what is in .opam-switch/sources/coq-procrastination/.git, if anything ? Also, knowing the precise URL it was pinned to could help me try and reproduce the failure.

One last possibility would be that the migration from 1.2 was interrupted or somehow failed to move some files...

Thanks for your help figuring this out!

Armael commented 6 years ago

Could you check what is in .opam-switch/sources/coq-procrastination/.git, if anything ?

There's no .git. Now that I think of it, could this situation be the result of me pinning this package as a directory by mistake, then git-pinning it instead? I think this happened at some point in the past (with opam 1.2). Maybe something went wrong and some cleanup didn't happen.

Also, knowing the precise URL it was pinned to could help me try and reproduce the failure.

From opam pin list:

coq-procrastination.~unknown    git   git+file:///home/armael/these/coq-procrastination

where this local directory is a clone of https://gitlab.inria.fr/agueneau/coq-procrastination