leonida_mods: install accepts the file names pack writes (MODS-PACKAGE-FILE-NAMES) #1835

Merged
RK28A merged 1 commit from upstream-pr/1835 into main 2026-11-28 20:15:58 +00:00
RK28A commented 2026-11-25 12:51:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by RK28A on 2026-11-25T12:51:13Z.


Claimed in the coordination issue as: MODS-PACKAGE-FILE-NAMES

What and why

install checked each file name of a package against safe_folder_name(). That function makes a tidy folder label so it also collapses double spaces and cuts at 80 characters. A mod with a file like read me.txt or a name longer than 80 characters was packed by pack and then refused by install as an unsafe ZIP member name.

Package names are now refused only when they hold a path separator or a reserved character or end with a dot or a space or are a Windows device name. pack runs the same check before it writes so it never writes a package that install refuses.

Tested

python -I tests/test_mod_package_names.py passes with 5 tests and all 5 fail without the change. tests/test_leonida_mods.py and tests/test_mod_pack_output_alias.py still pass. I compared the old and the new check on 400,000 generated names and no unsafe name is accepted. Linux and Python 3.13.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5491673030 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1835). Originally posted by [RK28A](https://github.com/RK28A) on 2026-11-25T12:51:13Z. --- Claimed in the coordination issue as: MODS-PACKAGE-FILE-NAMES ### What and why `install` checked each file name of a package against `safe_folder_name()`. That function makes a tidy folder label so it also collapses double spaces and cuts at 80 characters. A mod with a file like `read me.txt` or a name longer than 80 characters was packed by `pack` and then refused by `install` as an unsafe ZIP member name. Package names are now refused only when they hold a path separator or a reserved character or end with a dot or a space or are a Windows device name. `pack` runs the same check before it writes so it never writes a package that `install` refuses. ### Tested `python -I tests/test_mod_package_names.py` passes with 5 tests and all 5 fail without the change. `tests/test_leonida_mods.py` and `tests/test_mod_pack_output_alias.py` still pass. I compared the old and the new check on 400,000 generated names and no unsafe name is accepted. Linux and Python 3.13. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
RK28A commented 2026-11-25 12:55:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by RK28A on 2026-11-25T12:55:24Z.


I used an AI for code and text formatting and for help on the parts I could not get working

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7163042816 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1835#issuecomment-7163042816). Originally posted by [RK28A](https://github.com/RK28A) on 2026-11-25T12:55:24Z. --- I used an AI for code and text formatting and for help on the parts I could not get working
zmasi commented 2026-11-28 12:21:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:21:38Z.


#1835 | head 58f14c3d68 (merged cleanly with main d48a957bb) | python -I tests/test_mod_package_names.py | red on main: FAILED (failures=3, errors=6, skipped=1) (safe_folder_name rejected valid repeated-space, Unicode-space, and >80-char member names while accepting COM1 .log) | green on PR+main: 5 tests OK (skipped=1) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited portable_name, zip_parts, and pack_mod in tools/leonida_mods.py and docs/modding.md (separating member-name portability validation from safe_folder_name label sanitization, rejecting Windows reserved device stems with trailing spaces before . such as COM1 .log, and checking zip_parts during pack so install accepts every archive pack produces). Also verified clean merge (0 conflicts) and combined execution with #1834 (15 OK in tests/test_leonida_mods.py, 5 OK (skipped=1) in tests/test_mod_package_names.py), plus tests/test_docs_encoding.py (1 OK), tests/test_ci_registration.py (18 OK), tests/test_runner_calls_all_tests.py (3 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239173004 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1835#issuecomment-7239173004). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T12:21:38Z. --- #1835 | head 58f14c3d68abcc0cca70d4f10965dae313988b6b (merged cleanly with main d48a957bb) | `python -I tests/test_mod_package_names.py` | red on main: `FAILED (failures=3, errors=6, skipped=1)` (`safe_folder_name` rejected valid repeated-space, Unicode-space, and >80-char member names while accepting `COM1 .log`) | green on PR+main: `5 tests OK (skipped=1)` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `portable_name`, `zip_parts`, and `pack_mod` in `tools/leonida_mods.py` and `docs/modding.md` (separating member-name portability validation from `safe_folder_name` label sanitization, rejecting Windows reserved device stems with trailing spaces before `.` such as `COM1 .log`, and checking `zip_parts` during `pack` so `install` accepts every archive `pack` produces). Also verified clean merge (`0` conflicts) and combined execution with #1834 (`15 OK` in `tests/test_leonida_mods.py`, `5 OK (skipped=1)` in `tests/test_mod_package_names.py`), plus `tests/test_docs_encoding.py` (`1 OK`), `tests/test_ci_registration.py` (`18 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 20:15:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:15:55Z.


Red/green: On main test_mod_package_names.py has 3 failures and 6 errors (install refuses as unsafe ZIP member names that pack itself writes), and with the PR 5 tests pass (1 skipped) on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245158201 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1835#issuecomment-7245158201). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T20:15:55Z. --- Red/green: On main test_mod_package_names.py has 3 failures and 6 errors (install refuses as unsafe ZIP member names that pack itself writes), and with the PR 5 tests pass (1 skipped) on Windows 11 at OreoFR's (RTX 4070). Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 21:54:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:54:52Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head 58f14c3d6
  • Test: python -I tests/test_mod_package_names.py
  • Red on main: 3 FAIL + 6 ERROR (ModsError "unsafe ZIP member name" on names pack writes): the defect itself
  • Green with the PR: 5 OK (1 skipped)
  • Verdict: READY (files shared with #1834)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246364359 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1835#issuecomment-7246364359). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:54:52Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `58f14c3d6` - Test: `python -I tests/test_mod_package_names.py` - Red on main: 3 FAIL + 6 ERROR (ModsError "unsafe ZIP member name" on names pack writes): the defect itself - Green with the PR: 5 OK (1 skipped) - Verdict: READY (files shared with #1834) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1835
No description provided.