git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Troels Thomsen via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Troels Thomsen <troels@thomsen.io>
Subject: Re: [PATCH] receive-pack: fix crash on out-of-namespace symref
Date: Sun, 28 Dec 2025 23:57:45 +0900	[thread overview]
Message-ID: <xmqqfr8uk61i.fsf@gitster.g> (raw)
In-Reply-To: <pull.2144.git.git.1766850014289.gitgitgadget@gmail.com> (Troels Thomsen via GitGitGadget's message of "Sat, 27 Dec 2025 15:40:14 +0000")

"Troels Thomsen via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Troels Thomsen <troels@thomsen.io>
>
> `check_aliased_update_internal()` detects when a symbolic ref and its
> target are being updated in the same push. It does this by building a
> list of ref names without the optional namespace prefix. When a symbolic
> ref within a namespace points to a ref outside the namespace,
> `strip_namespace()` returns NULL which leads to a segfault.
>
> A NULL check preventing this particular issue was repurposed in
> ded8393610. Rather than reintroducing it, we can instead build a list of
> fully qualified ref names. This prevents the crash, preserves the
> consistency check from da3efdb17b, and allows updates to all symbolic
> refs.
>
> Signed-off-by: Troels Thomsen <troels@thomsen.io>
> ---
>     receive-pack: fix crash on out-of-namespace symref

Fixing crash is certainly a good thing, but when the namespace is
segregated and receive-pack wants to get updates only within the
given namespace, would presence of such a cross namespace symref
cause updates outside the namespace through the symref, defeating
the point of setting up a namespace in the first place?

I am not objecting to the new behaviour, but am not sure if it is a
sensible one.  You _might_ be able to argue that an attempt to update
underlying refs outside the namespace through such a symbolic ref
should result in an error (i.e., a fix to the current crashing
behaviour is to die in a controlled way).

Thoughts?

  reply	other threads:[~2025-12-28 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 15:40 [PATCH] receive-pack: fix crash on out-of-namespace symref Troels Thomsen via GitGitGadget
2025-12-28 14:57 ` Junio C Hamano [this message]
2025-12-28 16:26   ` Troels Thomsen
2025-12-30  0:37     ` Junio C Hamano

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=xmqqfr8uk61i.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=troels@thomsen.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).