CommitFest 7250 Review: glist _Generic wrapper over dlist/dclist

code-review · generated from canonical Markdown

Type
code-review
Source
postgresql-master
Slug
commitfest-7250-review
Tags
code-reviewcommitfest-7250glistilistpg-review-harnesspostgresqlreview-report-v2waiting-on-author
Updated
2026-09-04T09:09:36.488324+00:00
Verdict / Summarywaiting-on-author
Front matter
schema: review-report-v2
review_id: commitfest-7250-review
source: postgresql-master
commitfest: "7250"
target: "glist _Generic wrapper over dlist/dclist in src/include/lib/ilist.h (staged uncommitted diff, +117/-0)"
head: ac00b0f8bdc59152e0d5b5f97c979595e9a5e2ad
base: ac00b0f8bdc59152e0d5b5f97c979595e9a5e2ad
diff_sha: a11388d74442513c6eafc33fd10d96a4e25e2190
diff_type: staged-uncommitted
verdict: waiting-on-author
blocker_counts:
  verified: 3
  unverified: 0
finding_counts:
  blocker: 3
  major: 5
  minor: 5
model: glm-5.2:cloud
router_policy_version: 1
router_policy_hash: 997c035512fa1b35aa17149ea386a861af531ec05839ce06810f38268a3caebe
artifact_sha256: 88cdfd064f787b88638a4a9af4978aedf8f4542866e61a43afac8d29871c5eef

CommitFest 7250 Review: glist _Generic wrapper over dlist/dclist

Verdict: waiting-on-author — 3 verified BLOCKERs (compile failure, broken iterator, use-after-free), 5 MAJORs, 5 MINORs. The patch does not compile for dclist_head * and the glist_foreach/glist_foreach_modify macros are memory-unsafe.

Target

Pipeline and provenance

SeatAgentHandoff slugStatus
Patch reviewpg-patch-reviewercommitfest-7250-review-handoff-patch-reviewerverified (sha256 66625cb9…)
Security reviewpg-security-reviewercommitfest-7250-review-handoff-security-reviewerverified (sha256 37582c26…)
Test authorpg-test-authorcommitfest-7250-review-handoff-test-authorverified (sha256 390a9688…)
Thread reconciliationcross-reference-review-with-threadcommitfest-7250-review-thread-ledgerverified (sha256 7c9a31a7…)
Finding verificationpg-finding-verifiercommitfest-7250-review-handoff-verifierverified (sha256 28063419…)
Changed-code coveragepg-change-coverage-reviewercommitfest-7250-review-handoff-coverageverified (sha256 822c7a9b…)

Model routing: route-review-models policy v1 (hash 997c0355…). No catalog model matched host caps; user-fixed model glm-5.2:cloud bound as session default for all seats.

Findings

BLOCKER-A — glist_delete / glist_delete_thoroughly dclist arms reference non-existent functions

BLOCKER-B — glist_foreach uses first real node as end sentinel, visits head sentinel as element, skips first node, asserts on empty

BLOCKER-C — glist_foreach_modify_next reads freed cur->next (use-after-free)

MAJOR-D — Count-contract conflation in glist_delete / glist_delete_thoroughly

MAJOR-E — Expression-form _Generic evaluates all arms (arity/type errors)

MAJOR-F — glist_foreach* drop StaticAssertVariableIsOfTypeMacro type guards

MAJOR-G — glist_foreach_stopcond / glist_foreach_next take unused lhead parameter

MAJOR-H — No tests; no ilist test module exists

MINOR-I — Inconsistent association ordering

MINOR-J — Two _Generic association forms used inconsistently; undocumented

MINOR-K — Trailing doubled blank line before #endif

MINOR-L — No header comment / documentation block for glist API

MINOR-M — No do{}while(0) / statement-expression guards; macro caveats undocumented

Verification Summary

All 13 findings survive verification (12 new + 1 author-deferred); none refuted.

FindingSeverityVerificationMethod
BLOCKER-ABLOCKERverifiedcompile
BLOCKER-BBLOCKERverifiedrepro
BLOCKER-CBLOCKERverifiedrepro
MAJOR-DMAJORverifiedstatic-check
MAJOR-EMAJORverifiedcompile
MAJOR-FMAJORverifiedstatic-check
MAJOR-GMAJORverifiedstatic-check
MAJOR-HMAJORverifiedstatic-check
MINOR-IMINORverifiedstatic-check
MINOR-JMINORverifiedstatic-check
MINOR-KMINORverifiedstatic-check
MINOR-LMINORverifiedstatic-check
MINOR-MMINORverifiedstatic-check

Baseline compile evidence (BLOCKER-A + MAJOR-E): gcc -std=c11 -fsyntax-only on a stubbed TU instantiating every glist_* macro against both head types produced 4 errors: implicit declaration of function 'dclist_delete', implicit declaration of function 'dclist_delete_thoroughly', passing argument 1 of 'dclist_insert_after' from incompatible pointer type, passing argument 1 of 'dclist_insert_before' from incompatible pointer type.

Baseline runtime evidence (BLOCKER-B + BLOCKER-C): glist_foreach over a 3-element dlist visited the head sentinel as a user node and skipped the first real node (visits corrupted, eventual crash). glist_foreach_modify with delete+poison-current segfaulted (exit=139, SIGSEGV).

Repair Validation Summary

One combined repair patch (SHA-256 c25ef0ac28aa94a30ab9a8629e2820f6c849dfdf99bc794863b30220d0ff812b, bound to frozen HEAD ac00b0f8bdc) addresses BLOCKER-A/B/C, MAJOR-D/E/F/G, and MINOR-I/J/K/L/M. MAJOR-H's repair is the proposal-only test_ilist module.

Combined patch validation: passed

Test module (MAJOR-H): not-run (proposal-only; must be landed with the ilist.h repair and run via make check-world).

Caveats: Validation used a stubbed PG-primitive TU, not a full configure+make PG build, because the glist layer is header-only and the defects are macro-expansion/runtime-semantics issues independent of the wider PG build. A full PG build + make check-world with the test_ilist module installed is the recommended final gate before commit.

Changed-Code Coverage

Coverage requirement: not-applicable

The 117 added lines are all preprocessor #define macro definitions (29 #define directives plus continuation/backslash lines and comments). There are zero static inline function bodies, zero executable C statements, zero branches, zero function definitions in the diff. gcov/gcovr instruments executable lines and branches inside compiled function bodies; preprocessor macro definitions are not executable and produce no gcov line/branch records.

pgsql-hackers Thread Ledger

Status: reconciled. A pgsql-hackers thread exists for CF 62 / patch 7250 (author Matthias van de Meent, root posted 2026-09-02). 8 messages read in full. Ledger report: commitfest-7250-review-thread-ledger.

Thread participants: Matthias van de Meent (author), Japin Li (reviewer), Tristan Partin (reviewer), David Rowley (committer).

Per-finding dispositions: 12 of 13 findings are new (not raised by any thread participant, including all 3 blockers and 4 of 5 majors). MINOR-L (docs) is author-deferred (Tristan Partin suggested a usage doc comment; author accepted "Good idea" but no v2 posted).

Notable thread-vs-review discrepancy: Tristan Partin's review (msg DL50FQ57QSNE.3NCSZWJAJ7WMQ@partin.io) contains an explicit correctness claim — "I also checked that the dlist/dclist function names match up with the glist function names" — which is false for the glist_delete and glist_delete_thoroughly arms (BLOCKER-A). No participant reported compiling the patch. The three blockers and MAJOR-E would surface on any compile of a TU that exercises the affected arms.

Thread debate: The thread is dominated by a "should this API exist at all / where is the caller" debate (David Rowley: "cart before the horse", wants a 0002 caller or fold into the Proxy memory-contexts series; Japin Li agrees no justification without a real user) rather than line-level review.

Aggregated Test Plan

  1. src/test/modules/test_ilist/ (proposal-only, pg-test-author) — TAP module exercising every glist_* macro on both dlist_head and dclist_head: basic ops, glist_foreach over populated and empty lists, glist_foreach_modify deleting current node, count assertions for dclist. Oracle: test_ilist_run() -> ok with per-test INFO lines. Must be landed alongside the ilist.h repair.
  2. Scratch repro TUs (verifier seat, disposable) — repro_blocker.c (compile failure evidence), repro_blocker_bc.c (runtime BLOCKER-B/C evidence), repro_fixed.c (post-repair runtime validation). These are disposable scratch artifacts, not durable tree files.

Residual Risk

Deterministic Verdict

waiting-on-author — 3 verified BLOCKERs (BLOCKER-A: compile failure from non-existent dclist_delete/dclist_delete_thoroughly; BLOCKER-B: glist_foreach visits sentinel as element, skips first node, asserts on empty; BLOCKER-C: glist_foreach_modify_next use-after-free). Any surviving BLOCKER => waiting-on-author. Blocker split: verified 3, unverified 0.

Maintainer CC

Author: Matthias van de Meent <boekewurm+postgres@gmail.com>. Committer candidate: David Rowley (engaged in thread). Reviewer: Tristan Partin (engaged in thread).

Artifact