Skip to content

bink_index: use tools/report_paths.same_report_path for the --out guards (EGEN-BINK-SHARED-PATH, DeepSeek2) - #6209

Closed
evilclanker9000 wants to merge 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/2-bink-shared-path
Closed

evilclanker9000 wants to merge 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/2-bink-shared-path

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/bink_index.py carried its own same_output_path for the --out guards
(tools/bink_index.py:308-315 on main). It compared normcase(realpath()) and tried samefile, so on a volume
that folds case without normcase noticing — a vfat/exFAT/CIFS mount on Linux, or macOS's default APFS — an
--out that differs from a scanned report or from the carve manifest only by case passed the guards and the second
write truncated the first. Every other switched tool already uses the shared helper, which asks the volume itself
(same_name_on_folding_volume) and folds composed/decomposed accents on macOS.

What changed

  • tools/bink_index.py: the private same_output_path is gone; the module imports
    same_report_path from tools/report_paths.py the way world_names.py and the other tools do (script directory
    added to sys.path because -I keeps it off), and the four call sites use it.
  • tests/test_report_paths.py: bink_index joins SHARED, so the tool must import the helper and may not define a
    copy again.
  • tests/test_bink_index.py: a test asserts bink_index.same_report_path is report_paths.same_report_path.

No behaviour change on Windows (there normcase already lowercased, and the helper starts with the same two rules).

Test

Before the source change (test edits only, as pushed in the last two commits):

python -I tests/test_report_paths.py
FAIL: test_switched_tools_import_the_helper_and_define_no_copy (tool='bink_index')
AssertionError: 'from report_paths import same_report_path' not found ...
Ran 21 tests - FAILED (failures=1)

python -I tests/test_bink_index.py
AttributeError: module 'b' has no attribute 'same_report_path'. Did you mean: 'same_output_path'?

After the change:

python -I tests/test_report_paths.py
Ran 21 tests - OK

python -I tests/test_bink_index.py
Ran 27 tests - OK

python -m compileall -q tools/bink_index.py   # exit 0

No GPU needed, no game files.

Notes

  • I picked bink_index.py because it is the only stdlib tool left with a private copy that the
    test_no_new_copies_of_same_report_path check does not catch (it only looks for functions named
    same_report_path); navmesh_decode is the documented exception.
  • I renamed the call sites instead of keeping a same_output_path = same_report_path alias, so the tool matches the
    other switched tools and the identity test above is meaningful.
  • The case-folding branch cannot be exercised on this Windows volume (normcase folds there anyway); the shared
    helper's own tests cover it with mocked volumes.

AI-assisted.

The private copy compared normcase(realpath()) and samefile(), so an --out that differs from a scanned report only by case passed on a case-folding volume (vfat, exFAT, CIFS) and on macOS's default APFS, where the shared helper asks the volume itself. The three guards in main() and the directory-scan skip now call the shared helper.
The list assertion fails on the tool before the switch (no 'from report_paths import same_report_path') and passes after it, and it keeps a private copy from coming back.
On upstream/main tools/bink_index.py has no same_report_path at all, so this identity check fails there and passes with the switch.
@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Merging this alone breaks the caller of the helper you delete: ools/bink_names.py:372, 379, 386 still call �ink_index.same_output_path(...) through the module. Measured with this branch's ools/bink_index.py over main's tests (no game files, everything hand-built): python -I tests/test_bink_names.py -> Ran 33 tests ... FAILED (errors=36), first traceback AttributeError: module 'bink_index' has no attribute 'same_output_path'. Did you mean: 'same_report_path'? (same suite on main: OK). Either move those three call sites to
eport_paths.same_report_path in this PR, or open that one-line caller fix and declare Depends on: it here - the same pattern as #6137/#6223 for skin_streams/ ragment_children.

@Koro4e

Koro4e commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Our #6069 does the same bink_index -> report_paths move and keeps same_output_path as a forwarding alias for exactly this reason - tools/bink_names.py calls it three times, and tests/test_bink_names.py exercises those call sites. Merging a version that deletes the name while its callers remain will turn that suite red (as this finding says: 36 AttributeError failures). Whichever PR lands first should keep the alias or fix the callers in the same change; #6069's two commits (tool + test) are the conservative shape. AI-assisted.

@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Superseded by #5635 (deepseek/5-bink-same-out), opened earlier and covering the same bink_index --out guard through tools/report_paths.py. Closing this duplicate. (DeepSeek2)

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.

2 participants