Skip to content

Guard TOC decode, missing cdrdao output, and None FILE paths - #708

Open
ajzrva-sys wants to merge 4 commits into
whipper-team:developfrom
ajzrva-sys:feature/issue-239-550-594-654-batch
Open

ajzrva-sys wants to merge 4 commits into
whipper-team:developfrom
ajzrva-sys:feature/issue-239-550-594-654-batch

Conversation

@ajzrva-sys

@ajzrva-sys ajzrva-sys commented Sep 18, 2026 •

Copy link
Copy Markdown

Malformed TOCs, missing cdrdao output and invalid UTF-8 can stop a rip with an unrelated exception. This adds checks for missing TOC files and unavailable FILE paths, and replaces invalid UTF-8 bytes while reading TOC/CUE text and process output.

It also includes the existing-file reuse change from #707 for #239: when no prior CRC is recorded, verification records the existing file’s calculated CRC instead of forcing a re-rip. Known CRCs still require a match.

Missing or unavailable FILE paths retain their original track positions during AccurateRip verification, preventing checksum alignment from shifting. Missing tracks cannot produce a successful checksum match. HTOA is excluded from the ordinary-track checksum list.

cdrdao maintains a separate stderr tail, bounded to the most recent 500 characters, so missing-TOC errors can include recently received diagnostic output even after progress lines have been parsed. This retains recent diagnostics rather than the complete stderr transcript.

soxi stderr is decoded safely when collected, using UTF-8 replacement decoding for malformed bytes.

Focused regression tests cover AccurateRip positions with missing first, middle and final tracks, HTOA, unreadable files and missing sources, along with retained cdrdao diagnostics and soxi stderr decoding.

Addresses #239, #550, #594 and #654.

Validation

Previously checked f6ba213 on macOS arm64 / Python 3.11: 129 unit tests passed. No optical-drive test was performed in that run.

Checked f0df55b6e19b6889d2aa9ca46875b2d8f6fb0f26 on October 29, 2026, using Ubuntu 26.04 LTS / Linux arm64 (aarch64) / CPython 3.14.4. The AccurateRip extension was built from that commit. The full suite (python -m unittest discover -v) passed all 148 tests in 11.240 seconds, with zero failures, errors or skips.

No optical-drive validation was performed.

- whipper-team#239/whipper-team#681: verifyTrack accepts existing EAC/resume files when testcrc
  is None and records the file CRC instead of always re-ripping
- whipper-team#550: skip image verify/encode when index.path is None; toc.py no
  longer does s.path on a missing source
- whipper-team#594: ReadTOCTask._done checks the TOC file exists and logs cdrdao
  returncode/stderr instead of FileNotFoundError on a random temp path
- whipper-team#654: open TOC/cue with errors='replace'; decode cdrdao stderr the
  same way so non-UTF-8 CD-TEXT does not abort the rip

Signed-off-by: ajzrva-sys <ajzrva-sys@users.noreply.github.com>
Addresses whipper-team#239
Addresses whipper-team#550
Addresses whipper-team#594
Addresses whipper-team#654
The Fedora whipper-team#550 traceback is toc.py _index doing s.path when the
silence source is None (generic cdrdao TOC). That site was already
guarded; this closes the rest of the chain:

- image.Image.setup: tolerate missing/None INDEX 1 path
- program.verifyImage: skip AccurateRip paths when FILE is null
- common.getRealPath(None) raises KeyError, not AttributeError
- regression test: SILENCE + FILE data.wav TOC parses without crash

Signed-off-by: ajzrva-sys <ajzrva-sys@users.noreply.github.com>
Addresses whipper-team#550
…put guards

whipper-team#239 — verifyTrack reuses EAC/resume files when testcrc is None and
records the file CRC; truncated files still fail via MissingFrames.

whipper-team#594 — ReadTOCTask._done refuses to parse a TOC cdrdao never wrote and
logs returncode + stderr tail (device empty, crash, or concurrent rip).

whipper-team#654 — decode all external tool output with errors='replace':
cdrdao DetectCdr/version, cdparanoia progress/analyze, soxi, and
VersionGetter, not only toc/cue file reads.

Signed-off-by: ajzrva-sys <ajzrva-sys@users.noreply.github.com>
Addresses whipper-team#239
Addresses whipper-team#594
Addresses whipper-team#654
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