public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Toon Claes <toon@iotcl•com>
Cc: git@vger•kernel.org
Subject: Re: Race condition in git-bundle(1) create when ref is updated while running
Date: Fri, 09 Feb 2024 09:39:38 -0800	[thread overview]
Message-ID: <xmqq5xyxh6zp.fsf@gitster.g> (raw)
In-Reply-To: <87eddlpx5k.fsf@iotcl.com> (Toon Claes's message of "Fri, 09 Feb 2024 14:40:30 +0100")

Toon Claes <toon@iotcl•com> writes:

> I discovered a bug in git-bundle(1) create. There is a race condition
> happening when a ref gets updated while the bundle creation process is
> running.

"--all" that tells "traverse from the tip of all the refs" to any
rev-list family of commands (like log and bundle) eventually boils
down to opendir("refs/...") followed by readdir(), and if somebody
creates or deletes files while you are reading in such a loop,
readdir() may appear to skip an entry, which is understandable.
Even "git for-each-ref" would race with a ref update (which involves
removing a file and then creating another file at the same path), I
would think.  IOW, I do not think this is limited to "git bundle".


  reply	other threads:[~2024-02-09 17:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 13:40 Race condition in git-bundle(1) create when ref is updated while running Toon Claes
2024-02-09 17:39 ` Junio C Hamano [this message]
2024-02-12  7:19   ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5xyxh6zp.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=toon@iotcl$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox