Repository navigation
rbf0_tree: guard out/--csv/--xml with the shared report_paths.same_report_path (EGEN-RBF0-TREE-SHARED) - #6176
Conversation
…port_path The private same_output_path copy compared realpath+normcase and samefile only, so a case-only spelling of the report path on a volume that folds case without normpath saying so (a vfat/exFAT/CIFS mount on Linux) passed the guard and the report replaced the source stream. tools/report_paths.py asks the volume itself for that pair.
Without the import the new entry fails, so a re-added private copy is caught by the suite.
|
The XML export can still replace a single input file at I used the existing synthetic fixture. Run this from the repository root with import runpy, subprocess, sys, tempfile
from pathlib import Path
sample = runpy.run_path("tests/test_rbf0_tree.py")["wide_blob"]()
with tempfile.TemporaryDirectory() as d:
folder = Path(d)
src = folder / "00000000.xml"
src.write_bytes(sample)
r = subprocess.run([sys.executable, "-I", "tools/rbf0_tree.py", str(src),
str(folder / "report.json"), "--xml", d], capture_output=True, text=True)
print(r.returncode, src.read_bytes() == sample, src.read_bytes()[:16], r.stderr)The result starts with The tree and report-path suites ran 57 tests on the head. 55 passed and two skipped. The new helper-registration check fails against the merge base for AI-assisted. |
tools/rbf0_tree.pycarried its ownsame_output_path(realpath + normcase +samefile) for the guards that keep the JSON out, the--csvreport and the--xmlfolder from replacing the source. Those rules only fold case on Windows, so on a Linux mount that ignores case (vfat, exFAT, CIFS)RBF0.RBFandrbf0.rbfpassed as two names and the report replaced the source stream or the other report.tools/report_paths.pyis the one helper for this: it takes the same two branches and then asks the volume itself with one scratch folder (same_name_on_folding_volume).rbf0_treenow importssame_report_pathand the private copy is gone; the four guards (--outvs--csv,--out/--csvvs a source file,--out/--csvvs a stream in a carve folder,--xmlvs the source folder) call it. The error messages are unchanged.EGEN-RBF0-TREE-SHARED.
Test
tests/test_report_paths.pyalready keeps the list of tools that must use the shared helper. Addingrbf0_treeto it fails on the old file and passes on the new one:Before the change (private copy in place,
rbf0_treelisted inSHARED):After the change:
The tool's own suite is unchanged and still green:
python -I tests/test_rbf0_tree.py->Ran 36 tests ... OK (skipped=1).No GPU needed; the case-folding branch of the helper is exercised with patches in
test_report_paths.py, so it runs on Windows.Notes
I picked
rbf0_tree.pybecause the other tools of this kind already have an open pull request in flight (rbf0_index,bink_index/skin_streams,world_census,vertex_types,tex_headers,pe_inspect,instance_lists,shader_profile) andrbf0_treehad no claim. Nothing else in the file changed;rbf0_index, which it imports for the constants, is untouched.AI-assisted.