Skip to content

Truncate long path components for MusicBrainz titles (#453) - #706

Open
ajzrva-sys wants to merge 2 commits into
whipper-team:developfrom
ajzrva-sys:feature/issue-453-long-paths
Open

ajzrva-sys wants to merge 2 commits into
whipper-team:developfrom
ajzrva-sys:feature/issue-453-long-paths

Conversation

@ajzrva-sys

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

Copy link
Copy Markdown

Long MusicBrainz titles can exceed the filesystem's filename limit and stop a rip. This truncates each template component and leaves room for .flac, .log, .cue and .toc extensions.

Limits are resolved from each component's actual destination directory or nearest existing ancestor. Expansion retains the output directory and already-truncated parents, including when nested output directories do not exist yet. Filename templates and output-directory spelling retain their existing behavior. This change is separate from the hierarchy and collision work in #702.

This continues the work in #672 for #453 and #565.

Validated on macOS arm64 / Python 3.11.16: 131 unit tests pass. Deterministic destination-filesystem tests simulate 128- and 255-byte NAME_MAX limits, relative and absolute destinations, missing directories, Unicode, extension reservations, numbered track separation and the existing renamer's collision refusal. The new regressions produce 18 failing subcases on the previous implementation. Full flake8 reports the same 17 pre-existing findings, with none introduced by this correction.

No actual cross-filesystem or optical-drive validation was performed. This correction does not introduce a new collision naming policy or replace the work in #702.

Finish the approach from PR whipper-team#672 (lcorbasson) so extremely long
release/track titles no longer raise ENAMETOOLONG during makedirs
or flac writes.

- truncate_filename: NAME_MAX via existing-ancestor pathconf with a
  255-byte fallback; optional reserve= for extensions the caller appends
- truncate_path_components + getPath: truncate every template segment,
  reserving room on the last component for .flac/.log/.cue
- cdrdao TOC copy truncates directory components before makedirs
- cd rip truncates the final track path after appending .flac

Closes whipper-team#453. Closes whipper-team#565. Completes whipper-team#672.

Signed-off-by: ajzrva-sys <ajzrva-sys@users.noreply.github.com>
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