From: Patrick Steinhardt <ps@pks.im>
To: Elijah Newren <newren@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 1/6] odb: introduce interface to generate packfiles
Date: Fri, 21 Aug 2026 08:34:53 +0200 [thread overview]
Message-ID: <aofxjYAYPGkCrtQ7@pks.im> (raw)
In-Reply-To: <CABPp-BHSFW38sF4dZkqZuGaRASVRj2FVG2NN1OTA7-Dd6Pt6rw@mail.gmail.com>
On Thu, Aug 20, 2026 at 09:41:03PM -0700, Elijah Newren wrote:
> On Wed, Aug 19, 2026 at 11:01 PM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > On Wed, Aug 19, 2026 at 09:56:56AM -0700, Elijah Newren wrote:
> > > On Sun, Aug 16, 2026 at 10:40 PM Patrick Steinhardt <ps@pks.im> wrote:
> > > >
> > > > +static int odb_source_files_generate_pack(struct odb_source *source UNUSED,
> > > > + struct odb_pack_generator **out,
> > > > + const struct odb_generate_pack_options *opts)
> > > > +{
> > > > + struct child_process cp = CHILD_PROCESS_INIT;
> > > > + struct odb_pack_generator_files *generator;
> > > > + FILE *in;
> > > [...]
> > > > + cp.clean_on_exit = 1;
> > > > +
> > > > + if (start_command(&cp))
> > > > + return error(_("could not spawn pack-objects"));
> > > [...]
> > > > + CALLOC_ARRAY(generator, 1);
> > > > + generator->base.out = opts->pack_fd < 0 ? cp.out : -1;
> > > > + generator->base.err = opts->progress_fd < 0 ? cp.err : -1;
> > > > + generator->base.finish = odb_pack_generator_files_finish;
> > > > + generator->cp = cp;
> > > > +
> > > > + *out = &generator->base;
> > > > + return 0;
> > > > +}
> > >
> > > Does this have a use-after-scope bug lurking here, due to the
> > > combination of clean_on_exit = 1 (which makes a copy of &cp for later
> > > use), and the fact that cp is a function-local? If I'm reading the
> > > code right, start_command() calls mark_child_for_cleanup(), which does
> > >
> > > p->process = process; /* where process is &cp */
> > >
> > > and then cleanup_children() accesses various fields under p->process.
> > > You do copy the necessary fields from cp to generator->cp, but
> > > &generator->cp was not passed to start_command(), so p->process points
> > > to the function-local cp.
> >
> > Oh, that's a very good catch indeed. Out of curiosity, how did you end
> > up discovering this? Did you just happen to remember that we store the
> > pointer out of scope or did the copy make you have a deeper look?
>
> Neither. Went to review the series, but I was worried I'd be missing
> context from not reviewing earlier odb refactorings. Used AI to help
> orient me and give me its own findings from reviewing your patches.
> (AI will sometimes spot things I miss in a review, though it'll also
> miss some things I catch.) And sometimes I iterate with AI to dig
> into various areas. Anyway, it flagged the potential problem, and I
> dug in to make sure it didn't look like a hallucination before
> cleaning it up and passing it on. I'm still looking through your
> other patches in this series, but should finish soon.
I agree. For all the pain AI is causing, doing reviews is one of the
things where it's helping me a ton. Both by reviewing my own patch
series before I send them out, and by reviewing others.
Thanks!
Patrick
next prev parent reply other threads:[~2026-08-21 6:34 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 10:45 [PATCH 0/5] odb: make packfile generation pluggable Patrick Steinhardt
2026-08-07 10:45 ` [PATCH 1/5] odb: introduce interface to generate packfiles Patrick Steinhardt
2026-08-07 10:45 ` [PATCH 2/5] upload-pack: generate packfiles via the object database Patrick Steinhardt
2026-08-07 10:45 ` [PATCH 3/5] send-pack: " Patrick Steinhardt
2026-08-07 10:45 ` [PATCH 4/5] builtin/bundle: refactor option handling for progress meter Patrick Steinhardt
2026-08-07 10:45 ` [PATCH 5/5] bundle: generate packfiles via the object database Patrick Steinhardt
2026-08-13 18:00 ` Junio C Hamano
2026-08-14 7:40 ` Patrick Steinhardt
2026-08-07 21:05 ` [PATCH 0/5] odb: make packfile generation pluggable Junio C Hamano
2026-08-10 5:25 ` Patrick Steinhardt
2026-08-12 23:41 ` Taylor Blau
2026-08-13 5:47 ` Patrick Steinhardt
2026-08-13 17:35 ` Junio C Hamano
2026-08-17 5:39 ` [PATCH v2 0/6] " Patrick Steinhardt
2026-08-17 5:39 ` [PATCH v2 1/6] odb: introduce interface to generate packfiles Patrick Steinhardt
2026-08-19 16:56 ` Elijah Newren
2026-08-20 6:01 ` Patrick Steinhardt
2026-08-21 4:41 ` Elijah Newren
2026-08-21 6:34 ` Patrick Steinhardt [this message]
2026-08-17 5:39 ` [PATCH v2 2/6] upload-pack: generate packfiles via the object database Patrick Steinhardt
2026-08-17 5:39 ` [PATCH v2 3/6] send-pack: " Patrick Steinhardt
2026-08-17 5:39 ` [PATCH v2 4/6] builtin/bundle: refactor option handling for progress meter Patrick Steinhardt
2026-08-17 5:39 ` [PATCH v2 5/6] bundle: get (mostly) rid of `the_repository` Patrick Steinhardt
2026-08-17 16:47 ` Junio C Hamano
2026-08-18 5:26 ` Patrick Steinhardt
2026-08-21 5:42 ` Elijah Newren
2026-08-21 7:46 ` Patrick Steinhardt
2026-08-17 5:39 ` [PATCH v2 6/6] bundle: generate packfiles via the object database Patrick Steinhardt
2026-08-19 21:52 ` Justin Tobler
2026-08-20 6:01 ` Patrick Steinhardt
2026-08-20 7:55 ` [PATCH v3 0/6] odb: make packfile generation pluggable Patrick Steinhardt
2026-08-20 7:55 ` [PATCH v3 1/6] odb: introduce interface to generate packfiles Patrick Steinhardt
2026-08-20 10:16 ` Karthik Nayak
2026-08-20 11:38 ` Patrick Steinhardt
2026-08-20 17:04 ` Junio C Hamano
2026-08-21 6:28 ` Patrick Steinhardt
2026-08-20 7:55 ` [PATCH v3 2/6] upload-pack: generate packfiles via the object database Patrick Steinhardt
2026-08-20 10:24 ` Karthik Nayak
2026-08-20 11:38 ` Patrick Steinhardt
2026-08-20 21:11 ` Karthik Nayak
2026-08-20 7:55 ` [PATCH v3 3/6] send-pack: " Patrick Steinhardt
2026-08-20 7:55 ` [PATCH v3 4/6] builtin/bundle: refactor option handling for progress meter Patrick Steinhardt
2026-08-20 11:17 ` Karthik Nayak
2026-08-20 7:55 ` [PATCH v3 5/6] bundle: get (mostly) rid of `the_repository` Patrick Steinhardt
2026-08-20 7:55 ` [PATCH v3 6/6] bundle: generate packfiles via the object database Patrick Steinhardt
2026-08-20 11:19 ` Karthik Nayak
2026-08-20 11:38 ` Patrick Steinhardt
2026-08-20 11:20 ` [PATCH v3 0/6] odb: make packfile generation pluggable Karthik Nayak
2026-08-20 11:40 ` Patrick Steinhardt
2026-08-21 6:05 ` Elijah Newren
2026-08-21 6:30 ` [PATCH v4 " Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 1/6] odb: introduce interface to generate packfiles Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 2/6] upload-pack: generate packfiles via the object database Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 3/6] send-pack: " Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 4/6] builtin/bundle: refactor option handling for progress meter Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 5/6] bundle: get (mostly) rid of `the_repository` Patrick Steinhardt
2026-08-21 6:30 ` [PATCH v4 6/6] bundle: generate packfiles via the object database Patrick Steinhardt
2026-08-21 12:38 ` [PATCH v4 0/6] odb: make packfile generation pluggable Karthik Nayak
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=aofxjYAYPGkCrtQ7@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.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.