Repository navigation
Conversation
…anned files With a directory source, an `out` naming a bank or clip inside that directory was accepted: the scan ran and the report was then renamed over the file (`rsc8_audio.py <dir> <dir>\a.awc` left a.awc holding the JSON report). main() only compared `out` with the source argument itself. An `out` that is an existing directory was refused only by the final rename, after the whole scan. Both are now usage errors (exit 2) before anything is read. scan_dir() takes the report path and compares it, with report_paths.same_report_path, against the list of files it is about to open, so the files refused are the files read: other spellings of a path, another letter case on a volume that ignores case, a trailing dot or space on Windows and a hard link included. The source-file comparison uses the same function. A report inside the scanned directory under a name the scan does not read (.json, .csv) still works and is not counted as an input on the next run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested 257dce5 on Windows 11, CPython 3.14.7, CPU only: pass. I ran the CLI against the synthetic folder from With
AI-assisted. |
|
Tested 257dce5 merged with main 561b65a on Linux (WSL2) / Python 3.12.16 (-I): pass tests/test_rsc8_audio.py: 42 run, 42 passed, 0 failed; tests/test_docs_*.py: 11 files, 11 OK (the PR edits docs/rsc8_audio.md). Negative control: with tools/rsc8_audio.py restored from upstream/main the new refusal tests fail (12 failures; e.g. a report path that resolves to a scanned .awc through "sub/deep/../.././a.awc" replaces the bank with the JSON report, which is the bug); restored the PR file and all pass. Not run: a native Windows pass for the case-insensitive path comparison (it goes through the existing report_paths.same_report_path). |
|
Tested
Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047. |
BUILD (new item), claimed in the coordination issue: #5361 (comment)
Depends on: #4355 (overlaps with it in one place, does not build on it; see the last point of "What and why")
What and why
tools/rsc8_audio.py <source> [out]writes its report to a temporary file and renames it overoutwhen the scanis done. Before the scan,
main()only comparedoutwith thesourceargument itself. On main3faac557:outthat names a bank or clip inside that directory was accepted, and the file wasreplaced by the report:
python -I tools/rsc8_audio.py <dir> <dir>\a.awc --quietexits 0 anda.awc(a4,900-byte synthetic bank) is the JSON report afterwards. The same for a
.rsc8file, a file in a nestedfolder, a truncated bank, and every other spelling of such a path (
sub\..\a.awc, another letter case, atrailing dot or space on Windows).
outthat is an existing directory was refused only by the final rename, after the whole scan, with theoperating system's "access is denied" text.
Now both are usage errors (exit 2, one
rsc8_audio.py: error:line) before anything is read:main()refuses anoutthat is an existing directory (output must be a file, not a directory: <out>).scan_dir()takes the report path (out=) and compares it withreport_paths.same_report_pathagainst thelist of files it is about to open, right after listing them and before the first one is read, as
tools/awc_manifest.pydoes. The list compared is the list read, so a file cannot be scanned without havingbeen checked. The error names the input:
output must not overwrite the input file <path>.same_report_pathtoo, in place of a bareos.path.samefile. Its results forthe cases tried are the same as before (same path,
..spelling, letter case, trailing dot, 8.3 name, hardlink: all refused on main already).
replaces the link's name, not the file's data), so this one is stricter, not a fix.
report.json,report.csv, also in a sub-folder or a folder that does not exist yet) is written, and the next run neitherrefuses it nor counts it as an input, because the scan reads
.awcand.rsc8names only. Anoutthat doesnot exist yet works as before. The tool writes no second file derived from
out; the temporary file is.rsc8_audio.<random>.partnext toout, created exclusively and removed on failure.docs/rsc8_audio.md: one sentence at the export example.tools/rsc8_audio.pyhas thedef scan_dir(...)line as context and thisadds a parameter on that line, so the two do not merge automatically. The conflict is one region (its new
_walk_errorfunction above thedefline, the new signature here); keeping both sides resolves it, and itsos.walk(..., onerror=_walk_error)line and its tests merge without a conflict. Resolved that way in a scratchcopy,
tests/test_rsc8_audio.pyruns 42 tests, OK (1 skipped: its chmod test, on Windows), and an unlistablesub-folder with an
outgiven ends with exit 2, no traceback and no report. rsc8_audio: the AWC start/end cue records matched into region pairs, record by record (ASSET-320) #5518 applies cleanly on top ofthis (
git apply --check, and a three-way merge).Tested
Windows 11, Python 3.14.0. No GPU is involved. Every input is synthetic (built by the test file's helpers).
python -I tests/test_rsc8_audio.py: 40 tests, OK (34 on main plus 6 new). The new ones run the CLI andrequire, for every refused
out: exit 2, no traceback, exactly one line after the usage text, nothing onstdout, every input byte-identical and no file added or removed in the folder. The folder holds a truncated
bank that a scan would name on stderr, so the single stderr line also shows that nothing was read.
out= each scanned file (bank, clip, nested bank, truncated bank),sub\..\a.awc,sub\deep\..\..\.\a.awc, and on WindowsA.AWC,SUB\Deep\NESTED.awc,a.awc.anda.awc(10 cases);out= a hard link to a scanned bank, in another folder under a.jsonname;out= an existing directory, for a directory source and for a file source (5 cases);out= the same file under another spelling (already refused on main);.json,.csvin a nested folder,.jsonin a new folder), two runseach: exit 0 both times, same counts, inputs unchanged, only the three reports added.
tools/rsc8_audio.py: 40 tests, 16 failures (10 + 1 + 5in the first three groups above); the other two new tests pass there, as they describe behaviour main already has.
\\?\path, a\\localhost\C$path, forwardslashes, a relative path, a symbolic link to a bank, a path through a directory symbolic link and through a
junction: all refused, the bank unchanged.
python -I tests/test_report_paths.py(15, OK),tests/test_awc_manifest.py(18, OK),tests/test_audio_config.py(21, OK),tests/test_text_write_line_endings.py(3, OK),tests/test_docs_links.py(6, OK),tests/test_docs_repo_paths.py(2, OK),tests/test_docs_list_items.py(2, OK),
tests/test_docs_design_rows.py(4, OK),python -m compileall -q make_game.py tools tests,python -I make_game.py --help.outand 1.27 s with one(about 0.16 ms per file).
Checklist
Not checked
the volume or the system does not treat the two names as one; a case-insensitive macOS volume was not tried
(that part is
report_paths.py's, which has its own tests).outthat names an existing file the scan does not read is still replaced, whatever it is: for example abank next to a single-file source (
rsc8_audio.py a.awc b.awc), or any file with a.awcor.rsc8nameoutside the scanned folder. The help text says
.json or .csv, but any other extension is accepted andwritten as JSON. Left as it is here.
AI-assisted.