OLD-7845: hashdict --archives ignores spaces and refuses unknown archive names #25
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!25
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/25/head"
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?
@ItsMrDubey on GitHub · 2026-11-24 02:01 UTC · original
ItsMrDubey:hashdict-archives-names→main· +59 −2 · 2 files · 2 commits · merged 2026-11-24 02:26 UTCClaimed in the coordination issue as: OLD-7845 (#14)
What and why
Fixes old #7845:
full = set(a.archives.split(","))kept the spaces and never checked the names, so--archives "common, data"selected onlycommon(" data" matched nothing) and a typo such as--archives comonharvested no archive fully, both with exit 0 and no message.Now each entry is stripped and empty entries are dropped. When
--archivesis given explicitly, a name that matches none of the archives in the carve (subfolders with anindex.json, or the one archive when<carve dir>is itself an archive folder) is a usage error viaap.error(exit 2, usage line, like the tool's other usage errors), naming the unknown archive(s) and the archives that are there. It is checked before any harvesting, so an existing--outis left untouched.The default list is not checked: it names five archives and a partial carve (or a one-archive folder such as
<work>/carve/common) legitimately lacks most of them, so refusing them would break the documented default invocation. To tell the two apart,--archivesnow defaults toNoneand the default list lives inDEFAULT_ARCHIVES(shown in--help). An explicit--archives ""still means "no archive fully, PSIN/RBF0 blobs only" and is not an error.Tested
Windows 11, Python 3.11.9, no GPU needed.
commonanddata:--archives "common, data"-> exit 0, only thecommonname in the dictionary;--archives comon-> exit 0, empty dictionary.--archives "common, dta"-> exit 2,hashdict.py: error: --archives: dta not found in <carve> (archives there: common).python -I tests/test_hashdict.py-> Ran 42 tests, OK (the newtest_archives_list_ignores_spaces_and_empty_entriesandtest_archive_named_but_not_carved_is_a_usage_errorfail on origin/main;test_default_archives_absent_from_a_partial_carve_are_not_an_errorpins the default-list behaviour).python -I tests/test_audio_config.py(imports hashdict) -> Ran 22 tests, OK.python -I scripts/check_no_game_data.py tools/hashdict.py tests/test_hashdict.py-> exit 0.AI-assisted: yes
Checklist
@Sigtryggur-Mani-Gudmundsson on GitHub · 2026-11-24 02:12 UTC · original
All 42 hashdict tests passed on Linux with
1512173. Before the fix I reproduced the silent omission and the successful exit for a misspelled archive.One fixture improvement:
custom_packcontains only a PSIN token, which also gets harvested if the second archive is skipped. I added an ordinary blob there and checked that its token appears for the spaced list and disappears for--archives "". This caught a deliberately dropped second selection. The second commit in the source mailbox contains the five added lines.@ItsMrDubey on GitHub · 2026-11-24 02:16 UTC · original
Thanks, good catch: with only a PSIN blob in
custom_pack, the spaced-list case could not tell a selected archive from a skipped one. Added asb2e4095(same five lines, credited in the message).Checked both ways on Windows 11 / Python 3.11.9:
python -I tests/test_hashdict.py-> 42 tests OK, and with the tool changed to keep only the first selected archive,test_archives_list_ignores_spaces_and_empty_entriesnow fails where it used to pass.