Skip to content

Remove the pre-3.31 (.dat/.ndx) cache import - #512

Merged
xroche merged 1 commit into
masterfrom
remove-oldformat-cache
Jul 9, 2026
Merged

Remove the pre-3.31 (.dat/.ndx) cache import#512
xroche merged 1 commit into
masterfrom
remove-oldformat-cache

Conversation

@xroche

@xroche xroche commented Jul 9, 2026

Copy link
Copy Markdown
Owner

The zip cache replaced the .dat/.ndx format in 3.31 (2003). What remained was an import-only parser for hostile input, compiled unconditionally (the origin of #507's bounds fix and #510's original OOB), plus dead code keyed to it: the CACHE-1.5 writer behind if (1), the cross-session HTML-MD5 dedup whose store was never written in the zip era, and the legacy legs of the startup rotation and hts_cache_reconcile, which silently renamed or even deleted a user's .dat/.ndx pair. Net -1010 lines.

On a pre-3.31 cache, cache_init now logs a clear refusal, leaves the files in place, and the site is re-crawled rather than aborting. The new -#test=cache-legacy self-test pins the refusal for both layouts (--update old.* and read-only new.*) and that the files stay untouched; the reconcile self-test now pins that legacy pairs are left alone. Verified end-to-end against the local test server. cache_brstr/cache_binput and their cacheindex self-test/fuzzer stay: they still back the -#C cache listing, which turns out to have been broken for zip caches since 3.31 (it only ever enumerated via new.ndx; follow-up to file).

The zip cache replaced this format in 3.31 (2003); what remained was an
import-only parser for hostile input, compiled unconditionally, plus a
tail of dead code keyed to it: the CACHE-1.5 writer behind if(1), the
cross-session HTML-MD5 dedup (its store was never written in the zip
era), the legacy legs of the startup rotation (which silently renamed
or deleted a user's .dat/.ndx pair) and of hts_cache_reconcile.

cache_init now detects a legacy pair, logs a clear refusal, leaves the
files untouched, and re-crawls. The cache-legacy self-test pins refusal
for both layouts (--update old.* and ro new.*), no is_update flag, and
untouched files; proven end-to-end against the local server. The
cacheindex self-test and fuzz-cachendx stay: cache_brstr/cache_binput
still back the -#C cache listing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche force-pushed the remove-oldformat-cache branch from 71d39d5 to 4020cda Compare July 9, 2026 19:45
@xroche
xroche merged commit 7a02d5e into master Jul 9, 2026
17 checks passed
xroche added a commit that referenced this pull request Jul 27, 2026
…does not (#764)

The MD5 comparison the comment promises left the tree in two steps: #467
extracted the function out of htsparse.c's HT_ADD_END macro without the skip
branch, and #512 removed the //[HTML-MD5]// cache entry it read. Drop the
parenthetical; the write is unconditional.

Signed-off-by: Xavier Roche <roche@httrack.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@xroche
xroche deleted the remove-oldformat-cache branch July 27, 2026 18:26
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