-#C faults on the first cache entry it names - #1412
Open
xroche wants to merge 2 commits into
Open
Conversation
url_savename() opened by loading sback->lnk into a local that nothing reads until a branch the -#C lister never enters. That lister has no backing and passes NULL, so listing a legacy hts-cache/new.ndx faults on the first entry its pattern matches. Take the local where the block that uses it starts, and skip the type-probing request when there is no backing to issue it with. The unconditional load was also undefined behaviour on a NULL sback, which let the optimizer drop the later NULL tests as unreachable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
The self-test's delayed= knob mirrors -%N, not -#N: case 'N' setting savename_delayed lives in htscoremain.c's '%' family, while '#' is the separate undocumented debug switch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
xroche
enabled auto-merge (squash)
August 24, 2026 21:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
url_savename()opened by loadingsback->lnkinto a local that nothing reads until a branch the-#Clister never enters. That lister has no backing and passes NULL, so listing a legacyhts-cache/new.ndxfaults on the first entry its pattern matches, before it prints anything. The local now comes from the block that uses it, and the type-probing request further down, the last thing on that path to touch the backing, is skipped when there is none.That second half is not belt and braces: reading
sback->lnkup front is undefined behaviour when it is NULL, so the compiler may delete any NULL test ofsbackthat follows, and at -O2 it does. A mutant carrying the load with the guard in place still crashed, in the guarded branch. The new test drivesurl_savename()with no backing through anosback=knob on-#test=savename, and reds on either mutant. End to end, a hand-built legacy ndx over a one-entry cache kills master at htsname.c:413 and lists cleanly once patched.Closes #1393