Join GitHub today
Reduce FILENAME_MAX_SIZE in ActiveSupport::Cache::FileStore #4911
Seems good, but I'm a little annoyed because this value is OS (and possibly filesystem) specific. I'm annoyed that Ruby doesn't provide an API to
Just checked on Linux
in my case
Ubuntu community says that is known filesize bug (on cryptfs) and filesize on current dir underlying fs cannot be determined by syscalls from ruby.
On Ext4 unencrypted:
On FreeBSD UFS unencrypted tests passed on FILENAME_MAX_SIZE = 230
What about cryptfs on Linux - current FILENAME_MAX_SIZE value will make cache files with long names(usually escaped utf strings) unusable before it hooked and truncated by rails.cache api calls
In my particular case - i only can use a constant override to decrease FILENAME_MAX_SIZE to use a cache on dev and prod machines with cryptfs :( Sad
added a commit
this pull request
Mar 31, 2012
Just ran into this issue on 3.2.11 and ended up overriding the constant to 223. I probably won't submit a pull request to change it in master because 228 should be good enough for most cases, and because we should find a more robust solution as @tenderlove suggests. Maybe catching the ENAMETOOLONG and retrying with a shorter max length, but that may break existing keys.
That said, I'll at least document why I went with 223 instead of 228:
So, 228 should work fine in most real world cases where the max pid is 5 digits long and there are no retries and the max filename length is 255.