Re: [PATCH 4/8] packfile: always populate pack-specific info when reading object info
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 18, 2025, 07:32 UTC
- Message-ID
- <xmqqcy4cxn2l.fsf@gitster.g>
- In-Reply-To
- <20251218-b4-pks-odb-read-object-info-improvements-v1-4-81c8368492be@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 10 quoted lines
> @@ -2148,8 +2162,13 @@ int packfile_store_read_object_info(struct packfile_store *store,
> * We know that the caller doesn't actually need the
> * information below, so return early.
> */
> - if (oi == &blank_oi)
> + if (oi == &blank_oi) {
> + oi->whence = OI_PACKED;
> + oi->u.packed.offset = e.offset;
> + oi->u.packed.pack = e.p;
> + oi->u.packed.type = PACKED_OBJECT_TYPE_UNKNOWN;It cannot be seen as it is before the precontext, but if blank_oi is still a function scope static that is initialized only once by assigning OBJECT_INFO_INIT, this will leave a timg bomb waiting to go off, as it violates the "blank"-ness promise for the next caller of this function who calls NULL in oi.
I'd prefer we fix this nonsense "we only declared a function scope static, but without actually using it for anything, other than to compare its address with the caller supplied parameter" well before this step.