Skip to content

Configure case-hack once in the NAR fuzzer - #16320

Merged
xokdvium merged 1 commit into
NixOS:masterfrom
JamieMagee:fuzz/harness-invariants
Aug 19, 2026
Merged

Configure case-hack once in the NAR fuzzer#16320
xokdvium merged 1 commit into
NixOS:masterfrom
JamieMagee:fuzz/harness-invariants

Conversation

@JamieMagee

@JamieMagee JamieMagee commented Aug 18, 2026

Copy link
Copy Markdown
Member

Motivation

The case-hacked NAR fuzzer sets use-case-hack inside an assert for every input, even though the setting only needs to be applied once.

Context

Move the setup to a checked function-local static. It runs once, and the harness traps if the setting cannot be applied.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@JamieMagee
JamieMagee requested a review from edolstra as a code owner August 18, 2026 04:37
@JamieMagee
JamieMagee force-pushed the fuzz/harness-invariants branch from eda296d to 39fad7f Compare August 18, 2026 04:39
@xokdvium

Copy link
Copy Markdown
Contributor

Actually, nix can't be built without assertions? At least we must not be built and we have a bit in libutil which fails the build if there NDEBUG

@xokdvium

Copy link
Copy Markdown
Contributor

Specifically this

nix/src/libutil/util.cc

Lines 15 to 17 in f6ac811

#ifdef NDEBUG
# error "Nix may not be built with assertions disabled (i.e. with -DNDEBUG)."
#endif

The case-hacked NAR fuzzer configures use-case-hack inside assert for
every input, although this setup only needs to run once.

Move the setup to a checked function-local static.

Assisted-by: GitHub Copilot CLI (GPT-5.6 Sol)
@JamieMagee
JamieMagee force-pushed the fuzz/harness-invariants branch from 39fad7f to fa5e855 Compare August 18, 2026 22:53
@JamieMagee JamieMagee changed the title Make fuzz harness invariants unconditional Configure case-hack once in the NAR fuzzer Aug 18, 2026
@xokdvium
xokdvium enabled auto-merge August 18, 2026 23:10
@xokdvium
xokdvium added this pull request to the merge queue Aug 18, 2026
Merged via the queue into NixOS:master with commit f15d42f Aug 19, 2026
18 checks passed
@JamieMagee
JamieMagee deleted the fuzz/harness-invariants branch August 19, 2026 00:10
@Ericson2314

Copy link
Copy Markdown
Member

BTW I would support giving the underlying function an overload takes an explicit parameter instead of using the setting. In addition to making this easier, that will help us slightly in our quest to get rid of global variables.

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.

3 participants