All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: aeron-gh <agab0323@gmail.com>
Cc: git@vger.kernel.org,  Usman Akinyemi <usmanakinyemi202@gmail.com>,
	Victoria Dye <vdye@github.com>,
	 Meet Soni <meetsoni3017@gmail.com>
Subject: Re: [PATCH] for-each-ref: avoid segfault on --no-format
Date: Fri, 13 Nov 2026 14:10:29 -0800	[thread overview]
Message-ID: <xmqqjymg9ycq.fsf@gitster.g> (raw)
In-Reply-To: <20261113161413.15688-1-agab0323@gmail.com> (aeron-gh's message of "Fri, 13 Nov 2026 21:44:10 +0530")

aeron-gh <agab0323@gmail.com> writes:

> The "--format" option is declared with OPT_STRING(), so the
> parse-options machinery also accepts "--no-format" and sets the
> format string to NULL. The default format is assigned before the
> command line is parsed, so nothing puts it back, and the NULL is
> dereferenced in verify_ref_format():
>
>     $ git for-each-ref --no-format
>     Segmentation fault

That is bad.  PARSE_OPT_NONEG is necessary, I guess?  Another
plausible interpretation may be to exit without showing anything,
but that does not sound like a very useful behaviour.

> Marking the option with PARSE_OPT_NONEG would also stop the crash,
> but then "--no-format" would work for "git branch" and "git tag"
> and be an error here.

Shouldn't "git branch --no-format" also error out?

> Signed-off-by: aeron-gh <agab0323@gmail.com>

Please check [[dco]] and [[real-name]] A few sections in
Documentation/SubmittingPatches.

Thanks.

  reply	other threads:[~2026-11-13 22:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:14 [PATCH] for-each-ref: avoid segfault on --no-format aeron-gh
2026-11-13 22:10 ` Junio C Hamano [this message]
2026-11-13 23:11   ` 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=xmqqjymg9ycq.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=agab0323@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=meetsoni3017@gmail.com \
    --cc=usmanakinyemi202@gmail.com \
    --cc=vdye@github.com \
    /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.