Open the-confessor opened 4 years ago
@the-confessor Hi, I've just commited an untested fix in 151f6c8a4f30182ff7735198ec19ae61b8573c38 (in a custom branch): could you try if that one fixes your issue?
Thanks, Joe
I applied that patch and the result is the same - exact same stack trace.
I notice that the patch is in cd.py, which doesn't appear in the stack trace.
Update - not only does it not fix the issue, it seems to have other side effects, e.g. here is the output of another CD rip with that patch applied:
MGMT -.cue
MGMT -.m3u
MGMT - Oracular.flac
MGMT - Oracular Spectacular - 06 - 4th Dimensional.flac
MGMT - Oracular Spectacular - 08 - Of Moons, Birds &.flac
MGMT -.score
MGMT -.toc
My templates:
track_template="%A - %d/%A - %d - %t - %n"
disc_template="%A - %d/%A - %d"
Thanks for the reply.
I've discovered that the shrinkPath()
method we're using is quite useless.
A comprehensive way to verify a path doesn't exceed any limit in Python would be this:
import os
def check_path_length(path):
"""
Check whether the path and its components respect the filesystem limits.
This method assumes the provided path has been normalized.
The limits retrieved aren't always reliable as some platforms
may provide deceptive values.
NOTE: os.pathconf() is only available on Unix.
:var path: normalized path
:type path: str
:returns: True if length of path and its components respect the filesystem
limits, False otherwise
:rtype: bool
"""
components = path.split(os.sep)
comp_max_len = len(max(components, key=len).encode())
fn_lim = pathconf(path.encode(), 'PC_NAME_MAX')
path_lim = pathconf(path.encode(), 'PC_PATH_MAX')
return comp_max_len <= fn_lim and len(path.encode()) <= path_lim
I think that the method truncate_filename()
works fine but it only applies to the last portion of the path (filename).
What's needed to do to truly address this issue is:
For example on Linux it seems that any component of the path can't be longer than 255 bytes so the function should take care of this (shrinking) for any of the components. The limit for a complete path is something like 4096 bytes which, I would say, it's quite difficult to reach for a normal use case.
This is a case that would benefit from #342. Even after truncating to filesystem limits, I don't think I would be happy with a 255 character file or directory name. Some music players may still choke on it and it may be an issue copying to a different filesystem.
It is quite a challenging problem, and I agree #342 would at least provide a workaround.
In addition to the filesystem limits check we could add a feature to provide users a way to set more restrictive limits which would allow shrinking the paths even more.
I've run into a problem ripping a CD with an extremely long title.
Doing some digging I noticed an existing issue #197 - it says milestone is 1.0 but in whipper 0.9.0 there seems to already be some kind of truncate_filename method introduced. So I am wondering if that fix is in there already, but just not working in this scenario?
The error I encounter: