-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveStorage variant raises Errno::ENAMETOOLONG #30662
Comments
Testing results: using a smaller set of options passed to |
Here is a failing test https://github.com/hausgold/rails/commit/1ca248bb016786c12eb17db335865097403abb9c |
Not sure what the best approach here is. The filesystem has a maximum limit for filenames, we're encoding the passed data via Ideas I have:
|
@khall Do you think splitting the variant#key into subdirectories can help?
|
That's a good idea, and that'd certainly help until the 1024 character path limit is reached. We'd have to reassemble the parts of the key prior to calling |
If a variant has a large set of options associated with it, the generated filename will be too long, causing Errno::ENAMETOOLONG to be raised. This change adds intermediary paths that retain the uniqueness of the variant while not raising the aforementioned error until the overall 1024 path limit is exceeded. Fixes rails#30662.
@khall I was wondering where you get the 1024 path limit from? From file system perspective it's not limited (ext2-4, btrfs, xfs) in nesting. They all share the same 255 characters filename limit. I did not found a concrete string length limit for ruby. |
@Jack12816 I noticed it here https://github.com/rails/rails/blob/master/activesupport/lib/active_support/cache/file_store.rb#L20 and assumed it was accurate. There's references to a maximum path length in ruby as well, but there isn't one single answer, I've seen 1024, 4096, and 8192. Here are a couple links to them: https://github.com/ruby/ruby/search?utf8=%E2%9C%93&q=PATH_MAX&type= |
If a variant has a large set of options associated with it, the generated filename will be too long, causing Errno::ENAMETOOLONG to be raised. This change replaces those potentially long filenames with a much more compact SHA256 hash. Fixes rails#30662.
Steps to reproduce
Expected behavior
no
Errno::ENAMETOOLONG
exceptionActual behavior
Errno::ENAMETOOLONG
exception is raised because the file name is too longSystem configuration
Rails version:
master (07bac9e)
Ruby version:
2.3.5
OS
Ubuntu 16.04
The text was updated successfully, but these errors were encountered: