mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #2388] restofworld_index: judge text on the same 512 bytes in an archive (RESTOFWORLD-INDEX-TEXT-SAMPLE) #2389
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2389
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2388
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/restofworld-index-text-sample📝 Commits (1)
16dde22restofworld_index: judge text on the same 512 bytes in an archive (RESTOFWORLD-INDEX-TEXT-SAMPLE)📊 Changes
2 files changed (+13 additions, -2 deletions)
View changed files
📝
tests/test_restofworld_index.py(+11 -0)📝
tools/restofworld_index.py(+2 -2)📄 Description
Claimed in the coordination issue as: RESTOFWORLD-INDEX-TEXT-SAMPLE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198290287)
What and why
tools/restofworld_index.pyclassifies each zlib stream of an RPF9 archive, or each carved file of a folder, by its first bytes. Itstextclass comes from_printable, which samples the first 512 bytes: text when the sample is at least 64 bytes and more than 90% printable.A carved file is classified from its whole data.
scan_rpfkeeps a stream whole only when it may be a PSIN or a CPU resource (texture scan). For every other stream it passedclassifya 256-byte head, so_printablesaw at most 256 bytes there. One stream could therefore get two signatures. A stream whose first 306 bytes are printable, followed by binary data, read astextfrom the archive and asraw:6e616d65from its carved file.af55ea1b4removed the same archive-versus-folder split for PSIN streams.The archive scan now keeps a 512-byte head, the sample
_printabletakes. The other head checks (PSIN, CPU-resource prefix) read at most 16 bytes, so nothing else changes. A stream that was text under the 256-byte sample is still text unless bytes 256-511 bring it under 90% printable, which is what a carved-file scan already says.Different topic from #1535 (validation and I/O, same files); the two merge cleanly.
Tested
Windows 11, Python 3.14.7, synthetic streams only:
python -I tests/test_restofworld_index.py: 35 tests OK. Newtest_text_is_judged_on_the_same_512_bytes_as_a_carved_fileputs the stream above into an archive and expects the signatureclassifygives for its whole data, which is nottext. Onmainit gets'text' != 'raw:6e616d65'. The existing signature, PSIN-chain and scan tests are unchanged.python -m compileall;scripts/check_no_game_data.pyon both files.Not measured: how many streams of a real archive change class (no game files here).
GPUs tested: n/a (CPU-only tool)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.