You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rubygem-activesupport/rubygem-activesupport-5.1.7...

27 lines
1.2 KiB

From ca4be4b7788c90d94beb1e835b7019f809148d08 Mon Sep 17 00:00:00 2001
From: Andrew White <andrew.white@unboxed.co>
Date: Mon, 2 Apr 2018 09:34:53 +0100
Subject: [PATCH] Backport fix for Dir::Tmpname.create from #32386
The removal of path separators from the tmpname value affects all four
supported versions of Ruby - 2.2.10, 2.3.7, 2.4.4, and 2.5.1.
---
activesupport/test/caching_test.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index c67ffe69b80a..c138f10c13a5 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -854,7 +854,9 @@ def test_key_transformation_with_pathname
def test_filename_max_size
key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}"
path = @cache.send(:normalize_key, key, {})
- Dir::Tmpname.create(path) do |tmpname, n, opts|
+ basename = File.basename(path)
+ dirname = File.dirname(path)
+ Dir::Tmpname.create(basename, Dir.tmpdir + dirname) do |tmpname, n, opts|
assert File.basename(tmpname + ".lock").length <= 255, "Temp filename too long: #{File.basename(tmpname + '.lock').length}"
end
end