File: drop-taint-checking-mechanism.patch

package info (click to toggle)
ruby-fast-gettext 2.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: ruby: 3,220; makefile: 3
file content (63 lines) | stat: -rw-r--r-- 2,408 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 081e2eebd252583890e8703b4706024d49e730ef Mon Sep 17 00:00:00 2001
From: Aleksei Lipniagov <alipniagov@gitlab.com>
Date: Wed, 25 Aug 2021 15:29:02 +0300
Subject: [PATCH] Drop taint checking mechanism related code

Taint checking has been deprecated in
https://bugs.ruby-lang.org/issues/16131. As the result, this gems and
other gems using it (`gettext_i18n_rails`) produce too many noise
warning on Ruby 3 builds. We consider follow the deprecation of the
taint checking logic.
---
 lib/fast_gettext/translation_repository/base.rb        | 2 +-
 spec/cases/safe_mode_can_handle_locales.rb             | 5 -----
 spec/fast_gettext/translation_repository/merge_spec.rb | 5 -----
 spec/fast_gettext/translation_repository/mo_spec.rb    | 5 -----
 4 files changed, 1 insertion(+), 16 deletions(-)
 delete mode 100644 spec/cases/safe_mode_can_handle_locales.rb

--- a/lib/fast_gettext/translation_repository/base.rb
+++ b/lib/fast_gettext/translation_repository/base.rb
@@ -47,7 +47,7 @@
         Dir[File.join(path, '*')].each do |locale_folder|
           next unless File.basename(locale_folder) =~ LOCALE_REX
 
-          file = File.join(locale_folder, relative_file_path).untaint
+          file = File.join(locale_folder, relative_file_path)
           next unless File.exist? file
 
           locale = File.basename(locale_folder)
--- a/spec/cases/safe_mode_can_handle_locales.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-$LOAD_PATH.unshift 'lib'
-require 'fast_gettext'
-$SAFE = 1
-rep = FastGettext::TranslationRepository.build('safe_test',:path=>File.join('spec','locale'))
-print rep.is_a?(FastGettext::TranslationRepository::Mo)
--- a/spec/fast_gettext/translation_repository/merge_spec.rb
+++ b/spec/fast_gettext/translation_repository/merge_spec.rb
@@ -137,10 +137,4 @@
       end
     end
   end
-
-  it "can work in SAFE mode" do
-    pending_if RUBY_VERSION > "2.0" do
-      `ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
-    end
-  end
 end
--- a/spec/fast_gettext/translation_repository/mo_spec.rb
+++ b/spec/fast_gettext/translation_repository/mo_spec.rb
@@ -52,10 +52,4 @@
     rep['car'].should == 'Test'#just check it is loaded correctly
     rep.pluralisation_rule.call(2).should == 3
   end
-
-  it "can work in SAFE mode" do
-    pending_if RUBY_VERSION > "2.0" do
-      `ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
-    end
-  end
 end