tzinfo 1.2.10 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6364432a0aef34ccf3b6b1ecad65dd6f7f13843ac503cbcea1f693b74c96b46
4
- data.tar.gz: 825fd6905101f51fa700dfa682490851952de8a692c03954d12f38944f8814c8
3
+ metadata.gz: 0c5144874478331106359b387585793f77f3d3dfe8ae0fd86ffeceff71c86342
4
+ data.tar.gz: db94ffee0228f3afa5737b2c2003d258b23b2915919999e7349cf47c047c7cef
5
5
  SHA512:
6
- metadata.gz: ef4b1b6a189bbf011294210d2e0651f41bc82e1db8fe342c9f8dbcefd473e8b49b9affa67bc9a395a5831b376db8d37b5942cfade1dacf5485f23ce3d6f78a46
7
- data.tar.gz: 2871fbd7aded391c88a74724138073675690710dfca6adbbbe610ec4395e8d6631fad93b22d684650d04d9affeed0ab64a1d7489f766eb9ab1996556329c6ddc
6
+ metadata.gz: 7aa784cba67cb6908503874be5a5c618052c2d508a6f3f2c76d5fc5339b09970cda98719ecc3cbc5fee743657cd9ca457705fc98fa01a3b79ee156dea3c9ddc9
7
+ data.tar.gz: 86f994ba37c3e1f38d343d828a58bada483d658544a5f8780b4ed0d28b3a8cadc5bd0a8729e07468fe2d69147ff04342faad614ffdc0dc03ced90dc6a11a3171
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ Version 1.2.11 - 28-Jan-2023
2
+ ----------------------------
3
+
4
+ * Eliminate Object#untaint deprecation warnings on JRuby 9.4.0.0. #145.
5
+
6
+
1
7
  Version 1.2.10 - 19-Jul-2022
2
8
  ----------------------------
3
9
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2005-2022 Philip Ross
1
+ Copyright (c) 2005-2023 Philip Ross
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
@@ -153,16 +153,23 @@ module TZInfo
153
153
  end
154
154
 
155
155
 
156
- # Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
157
- # 3.2. Add a refinement to either silence the warning, or supply the method
158
- # if needed.
156
+ # Object#untaint is deprecated and becomes a no-op in Ruby >= 2.7. It has
157
+ # been removed from Ruby 3.2.
159
158
  if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
160
- module UntaintExt
161
- refine Object do
162
- def untaint
163
- self
164
- end
165
- end
159
+ # Returns the supplied `Object`
160
+ #
161
+ # @param o [Object] the `Object` to untaint.
162
+ # @return [Object] `o`.
163
+ def self.untaint(o)
164
+ o
165
+ end
166
+ else
167
+ # Untaints and returns the supplied `Object`.
168
+ #
169
+ # @param o [Object] the `Object` to untaint.
170
+ # @return [Object] `o`.
171
+ def self.untaint(o)
172
+ o.untaint
166
173
  end
167
174
  end
168
175
  end
@@ -1,8 +1,4 @@
1
1
  module TZInfo
2
- # Use send as a workaround for erroneous 'wrong number of arguments' errors
3
- # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
4
- send(:using, RubyCoreSupport::UntaintExt) if RubyCoreSupport.const_defined?(:UntaintExt)
5
-
6
2
  # A DataSource that loads data from the set of Ruby modules included in the
7
3
  # TZInfo::Data library (tzinfo-data gem).
8
4
  #
@@ -25,7 +21,7 @@ module TZInfo
25
21
  data_file = File.join('', 'tzinfo', 'data.rb')
26
22
  path = $".reverse_each.detect {|p| p.end_with?(data_file) }
27
23
  if path
28
- @base_path = File.join(File.dirname(path), 'data').untaint
24
+ @base_path = RubyCoreSupport.untaint(File.join(File.dirname(path), 'data'))
29
25
  else
30
26
  @base_path = tzinfo_data
31
27
  end
@@ -45,7 +41,7 @@ module TZInfo
45
41
  # Untaint identifier after it has been reassigned to a new string. We
46
42
  # don't want to modify the original identifier. identifier may also be
47
43
  # frozen and therefore cannot be untainted.
48
- identifier.untaint
44
+ RubyCoreSupport.untaint(identifier)
49
45
 
50
46
  identifier = identifier.split('/')
51
47
  begin
@@ -1,12 +1,4 @@
1
1
  module TZInfo
2
- # Use send as a workaround for an issue on JRuby 9.2.9.0 where using the
3
- # refinement causes calls to RubyCoreSupport.file_open to fail to pass the
4
- # block parameter.
5
- #
6
- # https://travis-ci.org/tzinfo/tzinfo/jobs/628812051#L1931
7
- # https://github.com/jruby/jruby/issues/6009
8
- send(:using, TZInfo::RubyCoreSupport::UntaintExt) if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)
9
-
10
2
  # An InvalidZoneinfoDirectory exception is raised if the DataSource is
11
3
  # set to a specific zoneinfo path, which is not a valid zoneinfo directory
12
4
  # (i.e. a directory containing index files named iso3166.tab and zone.tab
@@ -229,7 +221,7 @@ module TZInfo
229
221
  # Untaint path rather than identifier. We don't want to modify
230
222
  # identifier. identifier may also be frozen and therefore cannot be
231
223
  # untainted.
232
- path.untaint
224
+ RubyCoreSupport.untaint(path)
233
225
 
234
226
  begin
235
227
  ZoneinfoTimezoneInfo.new(identifier, path, @posix_tz_parser)
@@ -388,7 +380,7 @@ module TZInfo
388
380
  def enum_timezones(dir, exclude = [], &block)
389
381
  Dir.foreach(dir ? File.join(@zoneinfo_dir, dir) : @zoneinfo_dir) do |entry|
390
382
  unless entry =~ /\./ || exclude.include?(entry)
391
- entry.untaint
383
+ RubyCoreSupport.untaint(entry)
392
384
  path = dir ? File.join(dir, entry) : entry
393
385
  full_path = File.join(@zoneinfo_dir, path)
394
386
 
@@ -1,8 +1,4 @@
1
1
  module TZInfo
2
- # Use send as a workaround for erroneous 'wrong number of arguments' errors
3
- # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
4
- send(:using, RubyCoreSupport::UntaintExt) if RubyCoreSupport.const_defined?(:UntaintExt)
5
-
6
2
  # An InvalidZoneinfoFile exception is raised if an attempt is made to load an
7
3
  # invalid zoneinfo file.
8
4
  class InvalidZoneinfoFile < StandardError
@@ -351,7 +347,7 @@ module TZInfo
351
347
  std_offset = 0
352
348
  end
353
349
 
354
- offset index, utc_offset, std_offset, offset[:abbr].untaint.to_sym
350
+ offset index, utc_offset, std_offset, RubyCoreSupport.untaint(offset[:abbr]).to_sym
355
351
  end
356
352
 
357
353
  # Parses a zoneinfo file and intializes the DataTimezoneInfo structures.
data/test/tc_country.rb CHANGED
@@ -2,10 +2,6 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')
2
2
 
3
3
  include TZInfo
4
4
 
5
- # Use send as a workaround for erroneous 'wrong number of arguments' errors with
6
- # JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
7
- send(:using, TaintExt) if Module.const_defined?(:TaintExt)
8
-
9
5
  class TCCountry < Minitest::Test
10
6
  def setup
11
7
  @orig_data_source = DataSource.get
@@ -48,6 +44,7 @@ class TCCountry < Minitest::Test
48
44
  end
49
45
 
50
46
  def test_get_tainted_loaded
47
+ skip_if_taint_is_undefined_or_no_op
51
48
  Country.get('GB')
52
49
 
53
50
  safe_test(:unavailable => :skip) do
@@ -60,6 +57,7 @@ class TCCountry < Minitest::Test
60
57
  end
61
58
 
62
59
  def test_get_tainted_and_frozen_loaded
60
+ skip_if_taint_is_undefined_or_no_op
63
61
  Country.get('GB')
64
62
 
65
63
  safe_test do
@@ -69,6 +67,8 @@ class TCCountry < Minitest::Test
69
67
  end
70
68
 
71
69
  def test_get_tainted_not_previously_loaded
70
+ skip_if_taint_is_undefined_or_no_op
71
+
72
72
  safe_test(:unavailable => :skip) do
73
73
  code = 'GB'.dup.taint
74
74
  assert(code.tainted?)
@@ -79,6 +79,8 @@ class TCCountry < Minitest::Test
79
79
  end
80
80
 
81
81
  def test_get_tainted_and_frozen_not_previously_loaded
82
+ skip_if_taint_is_undefined_or_no_op
83
+
82
84
  safe_test do
83
85
  country = Country.get('GB'.dup.taint.freeze)
84
86
  assert_equal('GB', country.code)
@@ -2,10 +2,6 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')
2
2
 
3
3
  include TZInfo
4
4
 
5
- # Use send as a workaround for erroneous 'wrong number of arguments' errors with
6
- # JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
7
- send(:using, TaintExt) if Module.const_defined?(:TaintExt)
8
-
9
5
  class TCRubyDataSource < Minitest::Test
10
6
  def setup
11
7
  @data_source = RubyDataSource.new
@@ -81,6 +77,7 @@ class TCRubyDataSource < Minitest::Test
81
77
  end
82
78
 
83
79
  def test_load_timezone_info_tainted
80
+ skip_if_taint_is_undefined_or_no_op
84
81
  skip_if_has_bug_14060
85
82
 
86
83
  safe_test(:unavailable => :skip) do
@@ -93,6 +90,7 @@ class TCRubyDataSource < Minitest::Test
93
90
  end
94
91
 
95
92
  def test_load_timezone_info_tainted_and_frozen
93
+ skip_if_taint_is_undefined_or_no_op
96
94
  skip_if_has_bug_14060
97
95
 
98
96
  safe_test do
@@ -149,6 +147,8 @@ class TCRubyDataSource < Minitest::Test
149
147
  end
150
148
 
151
149
  def test_load_country_info_tainted
150
+ skip_if_taint_is_undefined_or_no_op
151
+
152
152
  safe_test(:unavailable => :skip) do
153
153
  code = 'NL'.dup.taint
154
154
  assert(code.tainted?)
@@ -159,6 +159,8 @@ class TCRubyDataSource < Minitest::Test
159
159
  end
160
160
 
161
161
  def test_load_country_info_tainted_and_frozen
162
+ skip_if_taint_is_undefined_or_no_op
163
+
162
164
  safe_test do
163
165
  info = @data_source.load_country_info('NL'.dup.taint.freeze)
164
166
  assert_equal('NL', info.code)
data/test/tc_timezone.rb CHANGED
@@ -2,10 +2,6 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')
2
2
 
3
3
  include TZInfo
4
4
 
5
- # Use send as a workaround for erroneous 'wrong number of arguments' errors with
6
- # JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
7
- send(:using, TaintExt) if Module.const_defined?(:TaintExt)
8
-
9
5
  class TCTimezone < Minitest::Test
10
6
 
11
7
  class BlockCalled < StandardError
@@ -244,6 +240,7 @@ class TCTimezone < Minitest::Test
244
240
  end
245
241
 
246
242
  def test_get_tainted_loaded
243
+ skip_if_taint_is_undefined_or_no_op
247
244
  Timezone.get('Europe/Andorra')
248
245
 
249
246
  safe_test(:unavailable => :skip) do
@@ -256,6 +253,7 @@ class TCTimezone < Minitest::Test
256
253
  end
257
254
 
258
255
  def test_get_tainted_and_frozen_loaded
256
+ skip_if_taint_is_undefined_or_no_op
259
257
  Timezone.get('Europe/Andorra')
260
258
 
261
259
  safe_test do
@@ -265,6 +263,7 @@ class TCTimezone < Minitest::Test
265
263
  end
266
264
 
267
265
  def test_get_tainted_not_previously_loaded
266
+ skip_if_taint_is_undefined_or_no_op
268
267
  skip_if_has_bug_14060
269
268
 
270
269
  safe_test(:unavailable => :skip) do
@@ -277,6 +276,7 @@ class TCTimezone < Minitest::Test
277
276
  end
278
277
 
279
278
  def test_get_tainted_and_frozen_not_previously_loaded
279
+ skip_if_taint_is_undefined_or_no_op
280
280
  skip_if_has_bug_14060
281
281
 
282
282
  safe_test do
@@ -7,17 +7,8 @@ require 'tmpdir'
7
7
 
8
8
  include TZInfo
9
9
 
10
- # Use send as a workaround for an issue on JRuby 9.2.9.0 where using the
11
- # refinement causes calls to RubyCoreSupport.file_open to fail to pass the block
12
- # parameter.
13
- #
14
- # https://travis-ci.org/tzinfo/tzinfo/jobs/628812051#L1931
15
- # https://github.com/jruby/jruby/issues/6009
16
- send(:using, TZInfo::RubyCoreSupport::UntaintExt) if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)
17
- send(:using, TaintExt) if Module.const_defined?(:TaintExt)
18
-
19
10
  class TCZoneinfoDataSource < Minitest::Test
20
- ZONEINFO_DIR = File.join(File.expand_path(File.dirname(__FILE__)), 'zoneinfo').untaint
11
+ ZONEINFO_DIR = RubyCoreSupport.untaint(File.join(File.expand_path(File.dirname(__FILE__)), 'zoneinfo'))
21
12
 
22
13
  def setup
23
14
  @orig_search_path = ZoneinfoDataSource.search_path.clone
@@ -662,6 +653,8 @@ class TCZoneinfoDataSource < Minitest::Test
662
653
  end
663
654
 
664
655
  def test_load_timezone_info_tainted
656
+ skip_if_taint_is_undefined_or_no_op
657
+
665
658
  safe_test(:unavailable => :skip) do
666
659
  identifier = 'Europe/Amsterdam'.dup.taint
667
660
  assert(identifier.tainted?)
@@ -672,6 +665,8 @@ class TCZoneinfoDataSource < Minitest::Test
672
665
  end
673
666
 
674
667
  def test_load_timezone_info_tainted_and_frozen
668
+ skip_if_taint_is_undefined_or_no_op
669
+
675
670
  safe_test do
676
671
  info = @data_source.load_timezone_info('Europe/Amsterdam'.dup.taint.freeze)
677
672
  assert_equal('Europe/Amsterdam', info.identifier)
@@ -679,6 +674,8 @@ class TCZoneinfoDataSource < Minitest::Test
679
674
  end
680
675
 
681
676
  def test_load_timezone_info_tainted_zoneinfo_dir_safe_mode
677
+ skip_if_taint_is_undefined_or_no_op
678
+
682
679
  safe_test(:unavailable => :skip) do
683
680
  assert_raises(SecurityError) do
684
681
  ZoneinfoDataSource.new(@data_source.zoneinfo_dir.dup.taint)
@@ -687,6 +684,8 @@ class TCZoneinfoDataSource < Minitest::Test
687
684
  end
688
685
 
689
686
  def test_load_timezone_info_tainted_zoneinfo_dir
687
+ skip_if_taint_is_undefined_or_no_op
688
+
690
689
  data_source = ZoneinfoDataSource.new(@data_source.zoneinfo_dir.dup.taint)
691
690
  info = data_source.load_timezone_info('Europe/London')
692
691
  assert_kind_of(ZoneinfoTimezoneInfo, info)
@@ -697,7 +696,7 @@ class TCZoneinfoDataSource < Minitest::Test
697
696
  entries = Dir.glob(File.join(directory, '**', '*'))
698
697
 
699
698
  entries = entries.select do |file|
700
- file.untaint
699
+ RubyCoreSupport.untaint(file)
701
700
  File.file?(file)
702
701
  end
703
702
 
@@ -868,6 +867,8 @@ class TCZoneinfoDataSource < Minitest::Test
868
867
  end
869
868
 
870
869
  def test_load_country_info_tainted
870
+ skip_if_taint_is_undefined_or_no_op
871
+
871
872
  safe_test(:unavailable => :skip) do
872
873
  code = 'NL'.dup.taint
873
874
  assert(code.tainted?)
@@ -878,6 +879,8 @@ class TCZoneinfoDataSource < Minitest::Test
878
879
  end
879
880
 
880
881
  def test_load_country_info_tainted_and_frozen
882
+ skip_if_taint_is_undefined_or_no_op
883
+
881
884
  safe_test do
882
885
  info = @data_source.load_country_info('NL'.dup.taint.freeze)
883
886
  assert_equal('NL', info.code)
@@ -5,10 +5,6 @@ require 'tempfile'
5
5
 
6
6
  include TZInfo
7
7
 
8
- # Use send as a workaround for erroneous 'wrong number of arguments' errors with
9
- # JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
10
- send(:using, RubyCoreSupport::UntaintExt) if RubyCoreSupport.const_defined?(:UntaintExt)
11
-
12
8
  class TCZoneinfoTimezoneInfo < Minitest::Test
13
9
  class FakePosixTimeZoneParser
14
10
  def initialize(&block)
@@ -1281,7 +1277,7 @@ class TCZoneinfoTimezoneInfo < Minitest::Test
1281
1277
 
1282
1278
  tzif_test(offsets, []) do |path, format|
1283
1279
  # untaint only required for Ruby 1.9.2
1284
- path.untaint
1280
+ RubyCoreSupport.untaint(path)
1285
1281
 
1286
1282
  safe_test do
1287
1283
  info = ZoneinfoTimezoneInfo.new('Zone/three', path, @posix_tz_parser)
data/test/test_utils.rb CHANGED
@@ -108,6 +108,25 @@ module Kernel
108
108
  skip('Skipping test due to Ruby 2.4.4 being affected by Bug 14060 (see https://bugs.ruby-lang.org/issues/14060#note-5)')
109
109
  end
110
110
  end
111
+
112
+ # Object#taint is deprecated in Ruby >= 2.7 and will be removed in 3.2.
113
+ # 2.7 makes it a no-op with a warning.
114
+ # Define a method that will skip for use in tests that deal with tainted
115
+ # objects.
116
+ if Object.respond_to?(:taint)
117
+ if RUBY_VERSION >= '2.7'
118
+ def skip_if_taint_is_undefined_or_no_op
119
+ skip('Object#taint is a no-op')
120
+ end
121
+ else
122
+ def skip_if_taint_is_undefined_or_no_op
123
+ end
124
+ end
125
+ else
126
+ def skip_if_taint_is_undefined_or_no_op
127
+ skip('Object#taint is not defined')
128
+ end
129
+ end
111
130
 
112
131
  def assert_array_same_items(expected, actual, msg = nil)
113
132
  full_message = message(msg, '') { diff(expected, actual) }
@@ -184,19 +203,6 @@ module Kernel
184
203
  end
185
204
 
186
205
 
187
- # Object#taint is a deprecated no-op in Ruby 2.7 and outputs a warning. It will
188
- # be removed in 3.2. Silence the warning or supply a replacement.
189
- if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)
190
- module TaintExt
191
- refine Object do
192
- def taint
193
- self
194
- end
195
- end
196
- end
197
- end
198
-
199
-
200
206
  # JRuby 1.7.5 to 1.7.9 consider DateTime instances that differ by less than
201
207
  # 1 millisecond to be equivalent (https://github.com/jruby/jruby/issues/1311).
202
208
  #
@@ -3,7 +3,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils.rb')
3
3
  # Use a zoneinfo directory containing files needed by the tests.
4
4
  # The symlinks in this directory are set up in test_utils.rb.
5
5
  zoneinfo_path = File.join(File.expand_path(File.dirname(__FILE__)), 'zoneinfo')
6
- zoneinfo_path.untaint if RUBY_VERSION < '2.7'
6
+ TZInfo.const_get(:RubyCoreSupport).untaint(zoneinfo_path) if RUBY_VERSION < '2.7'
7
7
  TZInfo::DataSource.set(:zoneinfo, zoneinfo_path)
8
8
 
9
9
  require File.join(File.expand_path(File.dirname(__FILE__)), 'ts_all.rb')
data/tzinfo.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'tzinfo'
3
- s.version = '1.2.10'
3
+ s.version = '1.2.11'
4
4
  s.summary = 'Daylight savings aware timezone library'
5
5
  s.description = 'TZInfo provides daylight savings aware transformations between times in different time zones.'
6
6
  s.author = 'Philip Ross'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Ross
@@ -29,7 +29,7 @@ cert_chain:
29
29
  J3Zn/kSTjTekiaspyGbczC3PUaeJNxr+yCvR4sk71Xmk/GaKKGOHedJ1uj/LAXrA
30
30
  MR0mpl7b8zCg0PFC1J73uw==
31
31
  -----END CERTIFICATE-----
32
- date: 2022-07-19 00:00:00.000000000 Z
32
+ date: 2023-01-28 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: thread_safe
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 3.3.7
194
+ rubygems_version: 3.4.5
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Daylight savings aware timezone library
metadata.gz.sig CHANGED
Binary file