Skip to content

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

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

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

Conversation

@ajzrva-sys

Copy link
Copy Markdown

Summary

Finishes the long-path work from PR #672 (@lcorbasson) for issues #453 / #565.

Review notes on #672

  • Design is right: truncate each path component from templates, not only the basename
  • Gaps that blocked a safe merge:
    1. No tests
    2. get_existing_parent could return None → crash on .encode()
    3. No room reserved for .flac/.log/.cue appended after getPath()
    4. cdrdao makedirs still used untruncated directory segments (the traceback in Unable to rip CD with extremely long title #453)
    5. Based on an older develop tip

This PR

  • truncate_filename(path, has_file_ext=True, reserve=0) with safe name_max_for()
  • getPath truncates every template segment; last component reserves extension bytes
  • Track paths truncated again after + '.flac'
  • cdrdao TOC path truncated per component before makedirs
  • Tests for NAME_MAX, extensions, missing parents, Soulwax-length titles

Verification

  • test_common_common + test_common_program — 16/16 OK
  • flake8 clean

Closes #453
Closes #565
Related #672

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.

whipper cd rip Fails with OSError: [Errno 36] File name too long Unable to rip CD with extremely long title

1 participant