fix(tools): normalize pad input output encoding and validate target path #11312
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11312"
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?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-26T02:57:20Z.
What
Carries #6531 (Laronza, head
be8b84b43c; the first commit keeps its authorship), rebased onmain. The first commit makestools/pad_input.pywrite the command file as UTF-8 with LF line endings on every host and report a directory target or a missing parent directory as a command line error instead of a traceback. Inmain()its two checks now sit after thebutton_maskhandling from #9079.The second commit answers the changes requested in the reviews of #6531 (adriadam10, 19 October; THEMANnt, 25 October):
previous_sequencecatches onlyFileNotFoundErroragain, so an unreadable command file fails instead of being overwritten with a restarted sequence, and a test covers that case with a mockedPermissionErrorthat checks the existing command is left unchanged, so it does not depend on file modes (nochmod) and runs the same for a privileged writer. This is the coverage the review of 25 October asks for; that review also withdraws its earlier remark about a POSIX test.Overlap: #10206 (emirplus) also changes
main()and the tests oftools/pad_input.py; the two heads conflict intools/tests/test_pad_input.py(both add tests at the same place), so whichever lands second rebases and keeps both sets of tests. #10578 (xTRACKGOD) changes the same file andtools/tests/test_pad_timeline.py; it merges with this PR without a conflict.git merge-treeof this head with currentmain14eb2cda22is clean.Fixes: none
Tested
One base for all arms:
main5b85225ef3, head10781b738d(these two commits), treed8a21e955ccac6f8070362603fcdd77117fcd8bbidentical on Windows and Linux (on Linux the same two patches applied withgit am); no build step (Python only).python -I tools/tests/test_pad_input.py, 18 tests, onlypad_input.pyswapped between arms, the tests of the head kept:pad_input.pyof the first commit alone 1 failure (test_unreadable_command_file_is_not_replaced); withpad_input.pyofmain2 errors (the directory and missing-parent tests) and 1 failure (the LF test).main2 errors (directory and missing-parent tests); the LF test passes on Linux withmainalready, as the review of 19 October notes, so it only guards Windows.Path.opento raisePermissionError, so it behaves the same for an unprivileged and a privileged run (nochmod 000, which a privileged writer bypasses).tools/check_conventions.py --base upstream/mainpasses on Windows and Linux.Not tested: macOS, a real unreadable file on disk, the CI.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Co-authored by the original author of #6531.
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T04:35:22Z.
Review: APPROVED
Reviewed the path validation and output handling. The directory/missing-parent checks prevent the reported traceback paths before creating a temp file; explicit UTF-8 plus
newline="\n"makes serialization stable on Windows, and the test checks raw bytes. Restoring the narrowFileNotFoundErrorcatch means a read/permission error is no longer mistaken for a missing sequence, preserving the existing command file; the mocked permission failure avoids chmod/root dependence. The stated overlap with #10206 is a same-file test conflict with a clear keep-both resolution, and #10578 was checked as clean. Hosted conventions, eligibility, intake, labels and the Linux/macOS/Windows relinker matrix plus ASan pass; product jobs are skipped by path policy. The author reports 18 focused tests on Windows and WSL Linux; I did not rerun them locally. No blocking issue found.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T18:45:57Z.
Review: APPROVED
Reviewed
10781b738d7c08b5c91b66eb688d38099832706d. Approve; no actionable finding in this focused review.The writer rejects directory destinations and missing parents before staging output, and explicitly writes UTF-8 with LF endings. The submitted unreadable-file check also confirms that read denial propagates without replacing an existing command.
Validation: Windows, Python 3.11: 16 passed, 2 skipped; base 12 passed, 2 skipped. Old production fails the newline assertion and errors in the two new path-diagnostic cases. Exact-head hosted Build and Conventions are checked again before submission; skipped product jobs are not counted as native execution.
Scope: The two skips concern POSIX permission/ownership behavior. No controller or title session was run.