google-code-export / beets

Automatically exported from code.google.com/p/beets
MIT License
0 stars 0 forks source link

Automatically detect maximum filename length #461

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What's the problem? How can I reproduce it?
If the a file being written to an eCryptfs partition has filename which would 
end up being longer than the ecryptfs limit of 143 characters, beets crashes 
with “IOError: [Errno 36] File name too long”.

If it seems relevant, what system are you running on (OS, Python version,
etc.)?

This is on Ubuntu Linux, with encrypted home directories set up (Ubuntu uses 
eCryptfs for its encrypted home dirs.
----
The correct thing to do is apparently to use statfs() to find out the maximum 
file length allowed, and truncate accordingly.

n.b. adjusting MAX_FILENAME_LENGTH to 143 in beets/util/__init__.py does not 
work correctly because it doesn’t include the extension at that point… and 
obviously extensions may vary in length.

https://bugs.launchpad.net/ecryptfs/+bug/344878 is relevant.

Original issue reported on code.google.com by ha...@hawkesnest.net on 16 Nov 2012 at 11:45

GoogleCodeExporter commented 9 years ago
Thanks! I either didn't know or had forgotten about statfs()'s ability to 
detect the maximum filename length. Python exposes the statvfs function:
http://docs.python.org/2/library/os.html#os.statvfs

Original comment by adrian.sampson on 19 Nov 2012 at 9:43

GoogleCodeExporter commented 9 years ago
Extensions are now accounted for as of ccfcb86d72b7. Automatic detection still 
pending.

Original comment by adrian.sampson on 28 Nov 2012 at 12:55

GoogleCodeExporter commented 9 years ago

Original comment by adrian.sampson on 28 Nov 2012 at 4:29

GoogleCodeExporter commented 9 years ago
Automatic detection (and the max_filename_length) configuration option added as 
of 4d3d489a1098.

Original comment by adrian.sampson on 8 Feb 2013 at 8:58