parent
27cedd6873
commit
a1df3525a9
@ -0,0 +1,42 @@
|
||||
From 3fed62cfb1f43d8df5a5ff31229a5ad03264186e Mon Sep 17 00:00:00 2001
|
||||
From: John Hawthorn <john@hawthorn.email>
|
||||
Date: Fri, 17 Jan 2020 11:12:32 -0800
|
||||
Subject: [PATCH] Reduce FILENAME_MAX_SIZE to accomodate large PIDs
|
||||
|
||||
The max size here is designed around Ruby's Dir::Tmpname.create which
|
||||
creates temporary filenames in the format
|
||||
|
||||
$TIMESTAMP-$PID-$RANDOM
|
||||
|
||||
I believe the previous value of this field was based on the assumption
|
||||
that PIDs are 1-65535, which isn't necessarily the case on 64 bit Linux
|
||||
systems, which can be up to 2**22.
|
||||
|
||||
$ uname -a
|
||||
Linux zergling 5.4.11-arch1-1 #1 SMP PREEMPT Sun, 12 Jan 2020 12:15:27 +0000 x86_64 GNU/Linux
|
||||
$ cat /proc/sys/kernel/pid_max
|
||||
4194304
|
||||
|
||||
I've chosen a new value based on what I believe the largest possible
|
||||
tempname is:
|
||||
|
||||
255 - "20200117-4194304-#{0x100000000.to_s(36)}.lock".length #=> 226
|
||||
|
||||
(cherry picked from commit a98f330fb138fe4a78c270788218309849440026)
|
||||
---
|
||||
activesupport/lib/active_support/cache/file_store.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
|
||||
index cbce9d891533..8b248efd14de 100644
|
||||
--- a/activesupport/lib/active_support/cache/file_store.rb
|
||||
+++ b/activesupport/lib/active_support/cache/file_store.rb
|
||||
@@ -16,7 +16,7 @@ class FileStore < Store
|
||||
attr_reader :cache_path
|
||||
|
||||
DIR_FORMATTER = "%03X"
|
||||
- FILENAME_MAX_SIZE = 228 # max filename size on file system is 255, minus room for timestamp and random characters appended by Tempfile (used by atomic write)
|
||||
+ FILENAME_MAX_SIZE = 226 # max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
|
||||
FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
|
||||
GITKEEP_FILES = [".gitkeep", ".keep"].freeze
|
||||
|
Loading…
Reference in new issue