hpc / charliecloud

Now hosted on GitLab.
https://gitlab.com/charliecloud/main
Apache License 2.0
312 stars 60 forks source link

fix crash with unlinked worktrees #1824

Closed reidpr closed 10 months ago

reidpr commented 10 months ago

ch-image can get into a state where all commands crash with a traceback similar to:

$ ch-image build -t paraview -f ./examples/paraview/Dockerfile ./examples
Traceback (most recent call last):
  File "[...]/bin/ch-image", line 332, in <module>
    main()
  File "[...]/bin/ch-image", line 319, in main
    bu.init(cli)
  File "[...]/lib/build_cache.py", line 184, in init
    cache = Enabled_Cache(cli.cache_large)
  File "[...]/lib/build_cache.py", line 677, in __init__
    self.worktrees_fix()
  File "[...]/lib/build_cache.py", line 1329, in worktrees_fix
    assert (wt_gits == wt_actuals)
AssertionError

The crash is because one or more images think they are a Git worktree (i.e., img/$FOO/ch/git exists) but Git has no record of the worktree (i.e., bucache/worktrees/$FOO does not)

I haven’t been able to reproduce the situation itself. We think it has something to do with mixing --cache (usually the default) and --no-cache.

This PR converts the crash to a warning and requests help reproducing the underlying bug.