Repository navigation
sandbox_scene: an --out that names the --entities file is refused, not written over it (EGEN-SANDBOX-OUT-ENTITIES) - #6197
Conversation
The packed scene is written with open(args.out, 'wb'), so an --out equal to the --entities file (or a case-only name, symlink or hard link to it) replaced the user's world_index.py --entities-out rows with the LSB1 scene: exit 0, no warning, and the rows gone without the scene being usable twice. Check the pair with the shared report_paths.same_report_path and stop with one ERROR line and exit 2 before any input is read.
The case asserts the refusal, its one ERROR line and the exit code 2, then reads the --entities file back: before the guard the same run exited 0 and the file started with 'LSB1' instead of the JSON rows.
|
Tested 5be8bf4 on Windows 11 (NTFS), Python 3.12.10 (CPU only, no GPU, no game files): pass What I ran:
By hand (CLI, synthetic one-row
Each refusal is one Nits, none blocking:
Overlap: no other open PR adds this guard. #4261, #5550, #5943, #6621 and #6658 also change AI-assisted (Claude Code). |
|
Tested 5be8bf4 merged with main 4989635 on Linux/Python 3.12.16: pass
Diff read: |
tools/sandbox_scene.pywrites its output withopen(args.out, "wb"). Nothing checked the--outpath against the--entitiesfile it reads first, soread the rows and then replaced them with the
LSB1scene: exit 0, no warning, and theworld_index.py --entities-outfile gone. On Windows the same happens for a case-only name, a symlink or a hard link to that file, whichos.path.abspath(a) == os.path.abspath(b)-style guards miss.This checks the pair with the shared
tools/report_paths.same_report_path(path key,os.path.samefile, case-folding volume) at the top ofbuild(), before any input is read, and stops with oneERROR:line and exit 2 — the same form the tool already uses for an unreadable--entitiesor an unwritable--out.Test (
python -I tests/test_sandbox_scene.py), run on Windows, no GPU needed:upstream/main561b65a8, the samemain([... "--out", entities])call:return: 0, stderr empty, and the entities file starts withb'LSB1\x01\x00\x00\x00'(entities rows preserved: False) — the input is destroyed;return: SystemExit(2), stderr is the single lineERROR: ... names the --entities input ...; refusing to overwrite it, and the file still starts withb'{"archet';python -I tests/test_sandbox_scene.py->Ran 11 tests ... OK(10 before, the new case is the 11th);python -m compileall -q tools\sandbox_scene.py tests\test_sandbox_scene.py-> exit 0;python -I tools\sandbox_scene.py --help-> exit 0.Item: EGEN-SANDBOX-OUT-ENTITIES.
Notes
build()rather than inmain()because tools: sandbox_scene refuses a --out in a missing folder before the scan #5550 editsmain()right there (a missing--outfolder); the two changes do not touch the same lines, so they should not conflict.SystemExit(2)thatbuild()raises after printing the line, not amain()return value:main()returns only forOSError, andbuild()already raisesSystemExitfor "no entity resolves to an exported model".--entitiesfile is guarded: it is the one user file this run both reads and could destroy; a--outnaming a--modelsmanifest is not read by the tool after the scene is written.AI-assisted.