All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Patrick Steinhardt <ps@pks.im>,  Jeff King <peff@peff.net>,
	 Joe Drew <joe.drew@indexexchange.com>,
	 "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: "lock file exists" when fetching in bare clone of repository
Date: Fri, 22 Aug 2025 10:47:04 -0700	[thread overview]
Message-ID: <xmqq8qjbxn8n.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZS43w74tWjD47h2mnGiyaQWrGEY-UpL8kdXJi_zD0ASmw@mail.gmail.com> (Karthik Nayak's message of "Fri, 22 Aug 2025 01:01:51 -0700")

Karthik Nayak <karthik.188@gmail.com> writes:

> The fix itself isn't too involved:
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 088b52c740..5c31b02e6b 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -776,6 +776,8 @@ static enum ref_transaction_error
> lock_raw_ref(struct files_ref_store *refs,
>             goto retry;
>         } else {
>             unable_to_lock_message(ref_file.buf, myerr, err);
> +			if (myerr == EEXIST)
> +				ret = REF_TRANSACTION_ERROR_NAME_CONFLICT;
>             goto error_return;
>         }
>     }

We assume that the existing lock is what _we_ created to lock the
ref in the other case, not somebody else locked-and-died some time
ago, or somebody else locked-and-about-to-update-competing-with-us? 

Without this change we'd return REF_TRANSACTION_ERROR_GENERIC; does
the caller treat NAME_CONFLICT any specially?  Or is the "fix" you
talk about just about giving a different message and no other
behaviour changes involved?  I guess a more specific message that is
99% of the time more correct is an improvement over an overly
generic "some error happened" message.  But I thought the original
issue was that the user cannot make any progress when the ref
updates are transactional.  Does returning NAME_CONFLICT from here
tell the machinery that we are allowed to break transactional
semantics somehow?

In any case, I wonder if refs_verify_refnames_available() should
notice that we are using files backend on a case challenged
filesystem, and change the behaviour a bit.  This additional check
needs to be implemented as a backend call via refs->be->something()
to tighten the outcome.  It appears to me that the function in the
current form does not even notice a D/F conflict when there is a
branch 'd' and the transaction requests to create a new branch 'D/f'
on a case challenged system if files backend is in use, since the
function is in the generic layer and behaves case sensitively (which
is the right thing to do---we are talking about detecting backend
specific glitches here).

Thanks.



  reply	other threads:[~2025-08-22 17:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 20:54 "lock file exists" when fetching in bare clone of repository Joe Drew
2025-08-20 21:33 ` Jeff King
2025-08-21  7:15   ` Patrick Steinhardt
2025-08-21  7:27     ` Jeff King
2025-08-21 10:09       ` Patrick Steinhardt
2025-08-21 16:05         ` Junio C Hamano
2025-08-22  6:13           ` Patrick Steinhardt
2025-08-22  8:01             ` Karthik Nayak
2025-08-22 17:47               ` Junio C Hamano [this message]
2025-08-28 13:51                 ` Karthik Nayak
2025-08-28 16:16                   ` Junio C Hamano
2025-09-01 18:17                     ` Karthik Nayak
2025-08-21 15:47       ` Junio C Hamano
2025-08-22 13:28   ` Joe Drew
2025-08-26 11:19   ` Jeff King
2025-09-02 10:55     ` 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=xmqq8qjbxn8n.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=joe.drew@indexexchange.com \
    --cc=karthik.188@gmail.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.