All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	git@vger.kernel.org, Yonatan Roth <yroth@paloaltonetworks.com>,
	david asraf <dasraf9@gmail.com>,
	Emily Shaffer <nasamuffin@google.com>,
	Ramsay Jones <ramsay@ramsayjones.plus.com>,
	"D. Ben Knoble" <ben.knoble@gmail.com>
Subject: Re: [PATCH v3 10/12] usage: allow dying without writing an error message
Date: Tue, 3 Jun 2025 12:46:57 +0200	[thread overview]
Message-ID: <aD7SoaRg4UV6ktJL@pks.im> (raw)
In-Reply-To: <CAOLa=ZQTYTNiUhFW+kOqMro0rpWVTkyKop7az_6h7zgM8njRhw@mail.gmail.com>

On Tue, Jun 03, 2025 at 11:04:56AM +0200, Karthik Nayak wrote:
> On Tue, Jun 3, 2025 at 10:34 AM Kristoffer Haugsbakk
> <kristofferhaugsbakk@fastmail.com> wrote:
> >
> > On Tue, Jun 3, 2025, at 10:31, Karthik Nayak wrote:
> > > Patrick Steinhardt <ps@pks.im> writes:
> > >
> > >> Sometimes code wants to die in a situation where it already has written
> > >> an error message. To use the same error code as `die()` we have to open
> > >> code the code with a call to `exit(128)` in such cases, which is easy to
> > >
> > > Nit: This reads a little weird.
> >
> > Maybe s/to open code the code/to open-code the code/
> 
> Ah, that makes so much difference.

That reads better, but I guess we can improve it even further. How about
this instead:

    To retain the same error code as `die()` we have to use `exit(128)`,
    which is easy to get wrong and leaves magical numbers all over our
    codebase.

Patrick

  reply	other threads:[~2025-06-03 10:47 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 14:04 [PATCH 00/11] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 01/11] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 02/11] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 03/11] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 04/11] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-05-27 16:43   ` Ramsay Jones
2025-05-28  7:02     ` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 05/11] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 06/11] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 07/11] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 08/11] builtin/maintenance: let tasks do maintenance before and after detach Patrick Steinhardt
2025-05-27 17:01   ` Ramsay Jones
2025-05-28  7:02     ` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 09/11] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 10/11] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-05-27 14:04 ` [PATCH 11/11] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-05-30 15:08 ` [PATCH v2 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 08/12] builtin/maintenance: let tasks do maintenance before and after detach Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 09/12] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-05-30 15:08   ` [PATCH v2 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-02  7:17 ` [PATCH v3 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-06-02 10:35     ` Karthik Nayak
2025-06-02  7:17   ` [PATCH v3 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 08/12] builtin/maintenance: split into foreground and background tasks Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 09/12] builtin/maintenance: fix locking race when packing refs and reflogs Patrick Steinhardt
2025-06-02 10:03     ` Kristoffer Haugsbakk
2025-06-03  6:34       ` Patrick Steinhardt
2025-06-03  7:08         ` Kristoffer Haugsbakk
2025-06-02  7:17   ` [PATCH v3 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-06-03  8:31     ` Karthik Nayak
2025-06-03  8:33       ` Kristoffer Haugsbakk
2025-06-03  9:04         ` Karthik Nayak
2025-06-03 10:46           ` Patrick Steinhardt [this message]
2025-06-03 13:45             ` Kristoffer Haugsbakk
2025-06-03 15:24     ` Junio C Hamano
2025-06-05 13:02       ` Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-06-02  7:17   ` [PATCH v3 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-03 14:01 ` [PATCH v4 00/12] builtin/maintenance: fix ref lock races when detaching Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 01/12] builtin/gc: use designated field initializers for maintenance tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 02/12] builtin/gc: drop redundant local variable Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 03/12] builtin/maintenance: centralize configuration of explicit tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 04/12] builtin/maintenance: mark "--task=" and "--schedule=" as incompatible Patrick Steinhardt
2025-06-05 15:46     ` Derrick Stolee
2025-06-03 14:01   ` [PATCH v4 05/12] builtin/maintenance: stop modifying global array of tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 06/12] builtin/maintenance: extract function to run tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 07/12] builtin/maintenance: fix typedef for function pointers Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 08/12] builtin/maintenance: split into foreground and background tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 09/12] builtin/maintenance: fix locking race with refs and reflogs tasks Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 10/12] usage: allow dying without writing an error message Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 11/12] builtin/gc: avoid global state in `gc_before_repack()` Patrick Steinhardt
2025-06-03 14:01   ` [PATCH v4 12/12] builtin/maintenance: fix locking race when handling "gc" task Patrick Steinhardt
2025-06-03 15:31   ` [PATCH v4 00/12] builtin/maintenance: fix ref lock races when detaching Kristoffer Haugsbakk
2025-06-04  0:35   ` Ben Knoble
2025-06-05 15:53   ` Derrick Stolee
2025-06-06  5:23     ` 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=aD7SoaRg4UV6ktJL@pks.im \
    --to=ps@pks.im \
    --cc=ben.knoble@gmail.com \
    --cc=dasraf9@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=nasamuffin@google.com \
    --cc=ramsay@ramsayjones.plus.com \
    --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.