Skip to content

opam repo add triggers a git-maintenance race condition #7031

Description

@kit-ty-kate

I noticed a type of error locally (as well as in CI from time to time, i think):

diff --git a/tests/reftests/legacy-git.test b/tests/reftests/legacy-git.test
index 3dbd569da..c7942b61b 100644
--- a/tests/reftests/legacy-git.test
+++ b/tests/reftests/legacy-git.test
@@ -1370,24 +1370,11 @@ P4.3
 PASS 1
 ### : REPO :
 ### opam repo add REPO2 REPO -k git
-[REPO2] Initialised
-[WARNING] The repository 'REPO2' at git+file://${BASEDIR}/REPO doesn't have a 'repo' file, and might not be compatible with this version of opam.
-[NOTE] Repository at git+file://${BASEDIR}/REPO doesn't define its version, assuming it's 1.2.
-
-<><> Upgrading repositories from older opam format ><><><><><><><><><><><><><><>
-Upgrading repository "REPO2"...
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P1.0/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P1.1/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P2.1/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P3.1~weird-version.test/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P4.1/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P4.2/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P4.3/opam
-Updated ${BASEDIR}/OPAM/repo/REPO2/packages/P5.1/opam
-[NOTE] Repository REPO2 has been added to the selections of switch 10+a+b only.
-       Run `opam repository add REPO2 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.
-
+[ERROR] Could not update repository "REPO2": ${OPAM}: "lstat" failed on ${BASEDIR}/OPAM/repo/REPO2/.git/objects/maintenance.lock: No such file or directory
+[ERROR] Initial repository fetch failed
+# Return code 40 #
 ### opam repo remove REPO2 --all
+[WARNING] No configured repositories by these names found: REPO2
 ### opam repo remove test --all
 ### : LIST :
 ### opam list -A

There seems to be two problems:

  • some kind of race condition with git
  • opam repo add shouldn't scan the .git directory but apparently does

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions