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

Open
github-bot wants to merge 1 commit from github-bot/gh-1835 into main AGit
Owner

@⁠RK28A on GitHub · 2026-11-25 12:51 UTC · original
RK28A:mods-package-file-names → main · +132 −4 · 3 files · 1 commits · open

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)
**@⁠RK28A** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1835) `RK28A:mods-package-file-names` → `main` · +132 −4 · 3 files · 1 commits · open 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)
zip_parts() decided whether a package member's name was safe by comparing
it with safe_folder_name(), which makes a tidy folder label out of free
text: it also collapses runs of spaces, strips them at both ends and cuts
at 80 characters. So a mod holding `read  me.txt`, a file name with an
ideographic space or one longer than 80 characters packed without a word
and could not be installed again: "unsafe ZIP member name". The same ZIP
made by hand was refused the same way.

Members are now checked with portable_name(): no separator, control or
reserved character, no trailing dot or space, not a device name. It also
refuses `COM1 .log`, which the label comparison let through.

`pack` runs the same check before it writes anything, so it stops at a
file `install` would refuse (`con.txt` or `a:b` made on Linux) instead of
writing a package nobody can install.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:43 +00:00
Author
Owner

@⁠RK28A on GitHub · 2026-11-25 12:55 UTC · original

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

**@⁠RK28A** on GitHub · 2026-11-25 12:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1835#issuecomment-7163042816) I used an AI for code and text formatting and for help on the parts I could not get working
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1835/head:github-bot/gh-1835'
git switch 'github-bot/gh-1835'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1835'
git switch 'github-bot/gh-1835'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1835'
git switch 'github-bot/gh-1835'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1835'
git switch 'main'
git merge --squash 'github-bot/gh-1835'
git switch 'main'
git merge --ff-only 'github-bot/gh-1835'
git switch 'main'
git merge 'github-bot/gh-1835'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.