All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: git@vger.kernel.org, Yonatan Roth <yroth@paloaltonetworks.com>,
	david asraf <dasraf9@gmail.com>
Subject: Re: [PATCH 10/11] builtin/gc: avoid global state in `gc_before_repack()`
Date: Fri, 30 May 2025 16:05:29 +0200	[thread overview]
Message-ID: <aDm7KdKrjhjDToqH@pks.im> (raw)
In-Reply-To: <6EE3E4F8-16DB-45AB-AD67-FADE12FBFBBD@gmail.com>

On Fri, May 30, 2025 at 08:56:36AM -0400, Ben Knoble wrote:
> > @@ -965,7 +957,8 @@ int cmd_gc(int argc,
> >          goto out;
> >      }
> > 
> > -        gc_before_repack(&opts, &cfg); /* dies on failure */
> > +        if (gc_before_repack(&opts, &cfg) < 0)
> > +            exit(127);
> 
> If I (a relative novice to this part of the code) am reading
> correctly, we trade an implicit die in a private helper for explicit
> exit in a « main » function, which I find much easier to reason about.
> Nice!
> 
> What I don’t see (being away from the rest of the source at the
> moment) is where 127 comes from. I don’t intend a crusade against
> magic numbers :) and I’ve certainly seen enough exit-codes of 127 to
> guess what this means, but reading only the patch the number does
> appear out of thin air.

The funny thing is that 127 isn't even correct -- it should be 128.
Maybe we can adapt `die_builtin()` so that it knows to not write
anything when the first argument is a NULL pointer?

Patrick

  reply	other threads:[~2025-05-30 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 12:56 [PATCH 10/11] builtin/gc: avoid global state in `gc_before_repack()` Ben Knoble
2025-05-30 14:05 ` Patrick Steinhardt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-05-27 14:04 [PATCH 00/11] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 10/11] builtin/gc: avoid global state in `gc_before_repack()` 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=aDm7KdKrjhjDToqH@pks.im \
    --to=ps@pks.im \
    --cc=ben.knoble@gmail.com \
    --cc=dasraf9@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=yroth@paloaltonetworks.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.