Vít Ondruch 4 years ago
parent a1df3525a9
commit 9bedb8bdc2

@ -0,0 +1,28 @@
From 5611f4b430881bcfa788044ff3f42118370c61a2 Mon Sep 17 00:00:00 2001
From: Jonathan Hefner <jonathan@hefner.pro>
Date: Mon, 7 Sep 2020 16:44:21 -0500
Subject: [PATCH] Anchor BacktraceCleaner gem filter regexp
This ensures the default gem filter does not affect backtrace lines that
have a subpath incidentally matching a gem path.
Fixes #40196.
---
activesupport/test/clean_backtrace_test.rb | 6 ++++++
1 files changed, 6 insertions(+)
diff --git a/activesupport/test/clean_backtrace_test.rb b/activesupport/test/clean_backtrace_test.rb
index a846312d68f2..dd62ef359b73 100644
--- a/activesupport/test/clean_backtrace_test.rb
+++ b/activesupport/test/clean_backtrace_test.rb
@@ -124,4 +124,10 @@ def setup
result = @bc.clean(backtrace)
assert_empty result
end
+
+ test "should preserve lines that have a subpath matching a gem path" do
+ backtrace = [Gem.default_dir, *Gem.path].map { |path| "/parent#{path}/gems/nosuchgem-1.2.3/lib/foo.rb" }
+
+ assert_equal backtrace, @bc.clean(backtrace)
+ end
end

@ -0,0 +1,26 @@
From 5611f4b430881bcfa788044ff3f42118370c61a2 Mon Sep 17 00:00:00 2001
From: Jonathan Hefner <jonathan@hefner.pro>
Date: Mon, 7 Sep 2020 16:44:21 -0500
Subject: [PATCH] Anchor BacktraceCleaner gem filter regexp
This ensures the default gem filter does not affect backtrace lines that
have a subpath incidentally matching a gem path.
Fixes #40196.
---
activesupport/lib/active_support/backtrace_cleaner.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/backtrace_cleaner.rb b/activesupport/lib/active_support/backtrace_cleaner.rb
index ad80b8855f3f..405db9a6fe6c 100644
--- a/activesupport/lib/active_support/backtrace_cleaner.rb
+++ b/activesupport/lib/active_support/backtrace_cleaner.rb
@@ -91,7 +91,7 @@ def add_gem_filter
gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
return if gems_paths.empty?
- gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
+ gems_regexp = %r{\A(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
gems_result = '\3 (\4) \5'
add_filter { |line| line.sub(gems_regexp, gems_result) }
end

@ -5,7 +5,7 @@
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Epoch: 1 Epoch: 1
Version: 6.0.3.2 Version: 6.0.3.2
Release: 2%{?dist} Release: 3%{?dist}
Summary: A support libraries and Ruby core extensions extracted from the Rails framework Summary: A support libraries and Ruby core extensions extracted from the Rails framework
License: MIT License: MIT
URL: http://rubyonrails.org URL: http://rubyonrails.org
@ -28,6 +28,10 @@ Patch2: rubygem-activesupport-6.1.0-Update-to-TZInfo-v2.0.0-tests.patch
# Fix flaky `FileStoreTest#test_filename_max_size` test. # Fix flaky `FileStoreTest#test_filename_max_size` test.
# https://github.com/rails/rails/pull/40085 # https://github.com/rails/rails/pull/40085
Patch3: rubygem-activesupport-6.0.4-Reduce-FILENAME_MAX_SIZE-to-accomodate-large-PIDs.patch Patch3: rubygem-activesupport-6.0.4-Reduce-FILENAME_MAX_SIZE-to-accomodate-large-PIDs.patch
# Fix evaluator test from web-console.
# https://github.com/rails/rails/pull/40198
Patch4: rubygem-activesupport-6.1.0-Anchor-BacktraceCleaner-gem-filter-regexp.patch
Patch5: rubygem-activesupport-6.1.0-Anchor-BacktraceCleaner-gem-filter-regexp-test.patch
# ruby package has just soft dependency on rubygem({bigdecimal,json}), while # ruby package has just soft dependency on rubygem({bigdecimal,json}), while
# ActiveSupport always requires them. # ActiveSupport always requires them.
@ -71,9 +75,11 @@ Documentation for %{name}.
%patch1 -p2 %patch1 -p2
%patch3 -p2 %patch3 -p2
%patch4 -p2
pushd %{_builddir} pushd %{_builddir}
%patch2 -p2 %patch2 -p2
%patch5 -p2
popd popd
%gemspec_remove_dep -g tzinfo "~> 1.1" %gemspec_remove_dep -g tzinfo "~> 1.1"
@ -131,6 +137,9 @@ popd
%doc %{gem_instdir}/README.rdoc %doc %{gem_instdir}/README.rdoc
%changelog %changelog
* Thu Sep 10 08:42:03 GMT 2020 Vít Ondruch <vondruch@redhat.com> - 1:6.0.3.2-3
- Fix evaluator test from web-console.
* Tue Sep 01 2020 Vít Ondruch <vondruch@redhat.com> - 1:6.0.3.2-2 * Tue Sep 01 2020 Vít Ondruch <vondruch@redhat.com> - 1:6.0.3.2-2
- Properly fix flaky `FileStoreTest#test_filename_max_size` test case. - Properly fix flaky `FileStoreTest#test_filename_max_size` test case.

Loading…
Cancel
Save