mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1367] save_keys: guard --out with same_report_path and refuse directories before resolving (SAVE-KEYS-OUT-GUARD) #1396
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#1396
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/1367
Author: @JesusACD
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/save-keys-out-guard📝 Commits (1)
6265b33save_keys: guard --out with same_report_path and refuse directories before resolving (SAVE-KEYS-OUT-GUARD)📊 Changes
2 files changed (+41 additions, -6 deletions)
View changed files
📝
tests/test_save_keys.py(+29 -0)📝
tools/save_keys.py(+12 -6)📄 Description
Claimed in the coordination issue as: SAVE-KEYS-OUT-GUARD (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146434960)
What and why
tools/save_keys.py(out_problem,:195-204) checked--outonly whenos.path.exists(out)usingos.path.samefile(out, p), and did not check whether--outis a directory:--outnaming an existing directory (including an input folder of saves, sinceinput_files()expands directories to their contained files) passedout_problem(), ran the full key collection, dictionary harvesting, 8 hash families and--composepass, printed the summary tostdout, and only then failed atopen(a.out, "w").os.path.exists(out)andos.path.samefileskippedtools/report_paths.same_report_path(CONTRIBUTING.md), missing non-existing or case-folded aliases on volumes wherenormcase/samefilealone do not fold them.This switches
out_problem()totools/report_paths.same_report_pathand refuses directory--outtargets before any collection or resolution work runs.Tested
python -m compileall -q make_game.py tools tests: clean.python -I tools/save_keys.py --help: clean.python -I tests/test_save_keys.py -v: 36 passed, 1 skipped (added regression tests for pre-resolve directory refusal and delegation tosame_report_pathon Windows 11 / Python 3.13.17).python -I tests/test_report_paths.pyandpython -I tests/test_text_write_line_endings.py: 25 passed.python -I scripts/check_no_game_data.py tools/save_keys.py tests/test_save_keys.py: clean.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.