From: Justin Tobler Date: Thu, 20 Mar 2025 16:10:19 GMT Subject: Re: `git fetch origin --prune --atomic` core dumped Message-ID: In-Reply-To: On 25/03/20 04:36PM, 李葵 wrote: > Thank you for filling out a Git bug report! > Please answer the following questions to help us understand your issue. > > What did you do before the bug happened? (Steps to reproduce your issue) > >   ```bash >   git clone --quiet --mirror https://github.com/git/git-merge.git git-merge.git.git >   git clone --quiet --mirror git-merge.git.git git-merge.git > >   git --git-dir=git-merge.git.git branch test main > >   touch git-merge.git/refs/heads/test.lock >   git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*" >   ``` > > What did you expect to happen? (Expected behavior) > >   Without core dumped. > > What happened instead? (Actual behavior) > >   ```bash >   $ git clone --quiet --mirror https://github.com/git/git-merge.git git-merge.git.git > >   $ git clone --quiet --mirror git-merge.git.git git-merge.git > >   $ git --git-dir=git-merge.git.git branch test main >   branch 'test' set up to track 'origin/main'. > >   $ touch git-merge.git/refs/heads/test.lock > >   $ git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*" >   From /tmp/git/git-merge.git >    * [new branch]      test       -> test >   error: cannot lock ref 'refs/heads/test': Unable to create '/tmp/git/git-merge.git/refs/heads/test.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. >   BUG: refs.c:2435: abort called on a closed reference transaction >   [1]    1298748 IOT instruction (core dumped)  git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*" > >   $ ls >   core.1298748  git-merge.git  git-merge.git.git >   ``` > > What's different between what you expected and what actually happened? > >   Without core dumped. > > Anything else you want to add: > > Please review the rest of the bug report below. > You can delete any lines you don't wish to share. > > > [System Info] > git version: > git version 2.49.0.rc1.120.g683c54c999 > cpu: x86_64 > built from commit: 683c54c999c301c2cd6f715c411407c413b1d84e > sizeof-long: 8 > sizeof-size_t: 8 > shell-path: /bin/sh > libcurl: 7.81.0 > OpenSSL: OpenSSL 3.0.2 15 Mar 2022 > zlib: 1.2.11 > uname: Linux 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64 > compiler info: gnuc: 11.4 > libc info: glibc: 2.35 > $SHELL (typically, interactive shell): /usr/bin/zsh > > > [Enabled Hooks] > not run from a git repository - no hooks to show I was able to reproduce the reported bug with the following: git init foo && git -C foo commit --allow-empty -m init && git clone --mirror foo bar.git && git -C bar.git branch test master && touch bar.git/refs/heads/test.lock && git -C bar.git fetch origin --prune --atomic "+refs/*:refs/*" This bisects to c92abe71df (builtin/fetch: fix leaking transaction with `--atomic`, 2024-08-22). cc'ing the author. -Justin