Please describe the problem.
Starting with git 2.37, git annex init
fails with a lock issue.
What steps will reproduce the problem?
Run git annex init
with git version > 2.36 (I tested 2.37.0 and 2.37.1)
What version of git-annex are you using? On what operating system?
10.20220624-g17e4081d4 on Arch Linux
Please provide any additional information below.
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log
arno@genie ⛁ /tmp/annex_test
★ rm -rf .git
arno@genie ⛁ /tmp/annex_test
★ git init
Initialized empty Git repository in /tmp/annex_test/.git/
arno@genie ⛁ /tmp/annex_test
★ git annex init test
init test fatal: Unable to create '/tmp/annex_test/.git/annex/index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
git-annex: failed to read sha from git write-tree
CallStack (from HasCallStack):
error, called at ./Git/Sha.hs:23:15 in main:Git.Sha
failed
init: 1 failed
# End of transcript or log.
Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes ! git-annex is my goto tool for file storage.
done; this is a bug in git and will have to be fixed there. (git-annex could work around it by making sure the index file exists before calling write-tree, but I don't think it makes sense to work around a segfault bug like that, at least not unless it gets into some stable release of an OS...) --Joey
I did a little testing with potential triggers in my ~/.gitconfig and traced it down to core.untrackedCache=true
With core.untrackedCache=true and git 2.36, everything works as expected. With git 2.37, I get the bug.
git write-tree
has always locked the index, so it seems something else has changed to also lock the index when core.untrackedCache is set, that did not before.Probably
git update-index
, since that's what looks at the config.git-annex init
does run that, beforegit write-tree
, but it waits for it to exit. So I don't understand what would have the index still locked.I've reproduced it, setting core.untrackedCache.
Seems that git write-tree is segfaulting, which leaves the index locked:
And this is not due to anything git-annex is doing, git is 100% broken:
git 2.37.1 has the same problem. I have emailed the git list about it.
Now 2 weeks since the segfault in git has been known, and they have not fixed it.
Now feeling that it's might be worth git-annex init avoiding the segfault, by making sure to do something that creates the index file before write-tree. So I don't have to worry about when this gets fixed in git, or the chances that a buggy release will start being widely used for a long time.
Yeah, done so.