Skip to content

refactor(config): dedup libzstd discovery into auto/zstd (CQ1)#53

Merged
eilandert merged 1 commit into
masterfrom
refactor/cq1-dedup-zstd-discovery
Jun 12, 2026
Merged

refactor(config): dedup libzstd discovery into auto/zstd (CQ1)#53
eilandert merged 1 commit into
masterfrom
refactor/cq1-dedup-zstd-discovery

Conversation

@eilandert

Copy link
Copy Markdown
Owner

Issue CQ1 (Low — code quality)

filter/config and static/config each duplicated the entire libzstd static/dynamic/pkg-config discovery sequence. The copies had drifted: static/config's not-found error reported that the filter module was missing. Any future portability/linker/version fix had to be made twice.

Fix

  • New auto/zstd holds the discovery probe, the NGX_LD_OPT append, and the libzstd version advisory.
  • Top-level config sources it once before declaring either module.
  • filter/config and static/config shrink to module-specific declarations only, reusing exported ngx_zstd_opt_I / ngx_zstd_opt_L; each sets ngx_module_libs=\$ngx_zstd_opt_L explicitly.
  • Error text is module-generic ("the ngx_http_zstd modules require…") so it can't drift again.
  • Version advisory now also covers static-only builds.

Verification

  • sh -n clean on all four scripts.
  • Configure run reaches the shared probe and prints the new generic message (host lacks libzstd-dev; full compile covered by CI runners).

filter/config and static/config each carried a full copy of the
static/dynamic/pkg-config libzstd discovery sequence, the NGX_LD_OPT append,
and (in filter/config only) the version advisory. The copies had drifted:
static/config's not-found error claimed the *filter* module was missing.

Move the whole probe into a single auto/zstd helper, sourced once from the
top-level config before either module is declared. Both module configs now just
reuse the exported ngx_zstd_opt_I / ngx_zstd_opt_L. Error text is module-generic
so it can't drift again, and the version advisory now also covers static-only
builds. Each module sets ngx_module_libs=$ngx_zstd_opt_L explicitly.

Addresses audit CQ1.
@eilandert eilandert merged commit e64c056 into master Jun 12, 2026
14 checks passed
@eilandert eilandert deleted the refactor/cq1-dedup-zstd-discovery branch June 12, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant