//patches:audition reports success after writing nothing #69
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
bcox/tymbal#69
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
bazel run //patches:audition -- /some/direxits 0 when/some/dirdoes notexist, having written no files. The only sign is a line on stdout per patch:
...and then a clean exit. A caller checking the exit status -- a script, CI, or an
agent -- sees success.
This is the same shape as the
--test_filtertrapsCLAUDE.mddocuments at length: agreen run that did nothing. It cost one wasted render cycle while verifying that branch
fm-followupsleft the factory bank byte-identical, and it would silently produce anempty comparison for anyone doing the same.
Two fixes, either acceptable:
std::filesystem::create_directorieson the output path before rendering.Probably both: create the directory, and still fail loudly if a write fails for another
reason (full disk, permissions).
While in there: the message says the same thing twice ("cannot write X: could not write
X"), and neither half carries the
errnothat would explain why.Fixed on
worktree-audition-flags, together with #88, #63 and #81 — but the headline of this issue was already stale when it was picked up, and that is worth recording.audition.ccalready returns 1 on the first write failure (patches/audition.cc:218before this branch). So the tool did not report success after writing nothing; it failed fast on the first patch, with no explanation. What was actually left:The directory is now created, missing parents included —
std::filesystem::create_directories, the first of the two fixes this issue proposed. It runs before the first render rather than at the first write, so a mistyped path costs no render at all.The message says why, and says the path once. The old line named the path twice because
resynth/audio_file.h:95already puts the path in the error string ("could not write " + path) and the call site prefixed it with the same path again. The call site no longer does. Where the reason is available, it is carried:On errno, deliberately not:
resynth/audio_file.hreports only thatma_encoder_init_filefailed — miniaudio does not hand back an errno, so the write path has no reason to carry. Widening that header to invent one would change a subsystem with its own test for a message this tool prints, so it is left alone; the directory is the one write failure whose cause can actually be reported, which is why the reason lives there. Same posture as #85's report-rather-than-widen.Covered by
//patches:audition_options_test. The message shape is asserted structurally rather than by matching text: the error must start with the path and": ", the remainder must not contain the path a second time, and the remainder must equalstd::error_code::message()for the same failure — so a canned non-empty string cannot satisfy it. Verified by injecting anEnsureDirectorythat accepts any existing path; only its own test failed.