Skip to content

[FIX] Fail cleanly when a CEA-708 file can't be created - #2396

Merged
cfsmp3 merged 1 commit into
masterfrom
fix/dtvcc-output-file-error
Oct 18, 2026
Merged

cfsmp3 merged 1 commit into
masterfrom
fix/dtvcc-output-file-error

Conversation

@cfsmp3

@cfsmp3 cfsmp3 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

Run any input with CEA-708 captions (e.g. sample c83f765c661595e1bfa4750756a54c006c6f2c697a436bc0726986f71f0706cd.ts) with -o /dev/null. The 708 service file becomes /dev/null.p1.svc01.srt, which can't be created, and the run aborts with SIGABRT (exit 134): panicked at src/decoder/service_decoder.rs:897. Same for any unwritable per-service path (e.g. a directory named out.p1.svc01.srt next to -o out.srt).


screen_print() unwrapped the result of writer_output(), so a CEA-708 output file that couldn't be created panicked. The C writer (ccx_decoders_708_output.c) and v0.94 before the port treat a failed open as a fatal file-creation error, exit 5, like the main output path does. This does the same, and includes the file name in the error, which previously carried only the OS message.

Case master this PR
-o /dev/null SIGABRT (134) exit 5, [CEA-708] Failed to open output file: /dev/null.p1.svc01.srt: Permission denied (os error 13)
directory in place of the service file SIGABRT (134) exit 5, [CEA-708] Failed to open output file: blk.p1.svc01.srt: Is a directory (os error 21)

Verified:

  • New test: a file that can't be created yields an error naming it; it fails without the change.
  • All 23 local CEA-708 samples: output and exit codes byte-identical to master.
  • cargo test, cargo fmt --check and cargo clippy -D warnings clean in both crates.

screen_print() unwrapped the result of writer_output(), so a per-service
CEA-708 output file that couldn't be created aborted the run with a
panic (SIGABRT). -o /dev/null hits this, since the service file becomes
/dev/null.p1.svc01.srt; so does anything that makes the file
unwritable.

The C writer, and v0.94 before the port, treat this as a fatal
file-creation error (exit 5). Do the same, and include the file name
in the error, which previously carried only the OS message.
@cfsmp3
cfsmp3 merged commit d7eb132 into master Oct 18, 2026
47 of 49 checks passed
@cfsmp3
cfsmp3 deleted the fix/dtvcc-output-file-error branch October 18, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant