Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meet error ArgumentError: wrong number of arguments calling gsub (0 for 1) when upgrade to v1.2.6 #114

Closed
hieudion opened this issue Feb 5, 2020 · 2 comments

Comments

@hieudion
Copy link

hieudion commented Feb 5, 2020

Hi,
I met a problem when upgraded from 1.2.5 -> 1.2.6. It runs fine with 1.2.5.
It throws ArgumentError: wrong number of arguments callinggsub (0 for 1) at this line
https://github.com/tzinfo/tzinfo/blob/v1.2.6/lib/tzinfo/ruby_data_source.rb#L41
It is quite weird to me...
Could you please help to check?

The code
DEFAULT_LOCAL = ActiveSupport::TimeZone["America/Chicago"].today

Log

load_timezone_info at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/tzinfo-1.2.6/lib/tzinfo/ruby_data_source.rb:43          
get at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/tzinfo-1.2.6/lib/tzinfo/timezone.rb:92                
new at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/tzinfo-1.2.6/lib/tzinfo/timezone.rb:113      
 find_tzinfo at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/activesupport-5.2.4.1/lib/active_support/values/time_zone.rb:206                
initialize at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/activesupport-5.2.4.1/lib/active_support/values/time_zone.rb:300                        
[] at /Users/hieu/.rbenv/versions/jruby-9.0.5.0/lib/ruby/gems/shared/gems/activesupport-5.2.4.1/lib/active_support/values/time_zone.rb:234
 <class:RangeGeneratorTest> at /Users/hieu/TD/Plugins/embulk-input-mixpanel/test/test_range_generator.rb:9

gem file lock:

PATH
  remote: .
  specs:
    embulk-input-mixpanel (0.5.15)
      activesupport
      httpclient (>= 2.8.3)
      perfect_retry (~> 0.5)
      tzinfo (= 1.2.6)

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (5.2.4.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    codeclimate-test-reporter (0.6.0)
      simplecov (>= 0.7.1, < 1.0.0)
    coderay (1.1.2)
    concurrent-ruby (1.1.5)
    docile (1.3.2)
    embulk (0.8.39-java)
      bundler (>= 1.10.6)
      liquid (~> 4.0.0)
      msgpack (~> 1.1.0)
      rjack-icu (~> 4.54.1.1)
    everyleaf-embulk_helper (0.0.6)
    ffi (1.12.2-java)
    httpclient (2.8.3)
    i18n (1.5.1)
      concurrent-ruby (~> 1.0)
    json (2.3.0-java)
    liquid (4.0.3)
    method_source (0.9.2)
    minitest (5.14.0)
    msgpack (1.1.0-java)
    perfect_retry (0.5.0)
    power_assert (1.1.5)
    pry (0.12.2-java)
      coderay (~> 1.1.0)
      method_source (~> 0.9.0)
      spoon (~> 0.0)
    rake (13.0.1)
    rjack-icu (4.54.1.1-java)
    rr (1.2.1)
    simplecov (0.17.1)
      docile (~> 1.1)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.2)
    spoon (0.0.6)
      ffi
    test-unit (3.3.5)
      power_assert
    test-unit-rr (1.0.5)
      rr (>= 1.1.1)
      test-unit (>= 2.5.2)
    thread_safe (0.3.6-java)
    tzinfo (1.2.6)
      thread_safe (~> 0.1)

PLATFORMS
  java

DEPENDENCIES
  bundler (~> 1.0)
  codeclimate-test-reporter (~> 0.5)
  embulk (>= 0.8.6, < 1.0)
  embulk-input-mixpanel!
  everyleaf-embulk_helper
  pry
  rake (>= 10.0)
  test-unit
  test-unit-rr

BUNDLED WITH
   1.17.3
@philr
Copy link
Member

philr commented Feb 6, 2020

It looks like this is a bug with JRuby 9.0.5.0. The conditional using on line 2 causes the gsub call to fail (even though UntaintExt isn't defined).

Later versions of JRuby work fine and, according to the JRuby roadmap, version 9.0 is now 'defunct'. I'd therefore suggest upgrading if you can.

Alternatively, as a work around, you can just remove the using calls from line 2 of ruby_data_source.rb and line 2 zoneinfo_timezone_info.rb and everything should work fine.

I'll try and include a fix in a future 1.2.7 release.

@hieudion
Copy link
Author

hieudion commented Feb 7, 2020

Thanks a lot!!!
Your workaround works perfectly.

I'd therefore suggest upgrading if you can.
Thanks for the advice I will consider it.

Going to close that issue.

@hieudion hieudion closed this as completed Feb 7, 2020
philr added a commit that referenced this issue Jan 21, 2023
Despite the UntaintExt refinement that replaces Object#untaint being
used, JRuby 9.4 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).

Replace the UntaintExt refinement with an untaint method in the now
reinstanted RubyCoreSupport module.

Change test cases to skip when taint/untaint is undefined or a no-op.
There's no point in running these tests without inputs that are tainted.
Remove the (test-only) TaintExt refinement too.

Resolves #145.
philr added a commit that referenced this issue Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method (in the now
reinstanted RubyCoreSupport module).

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
philr added a commit that referenced this issue Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method in
RubyCoreSupport.

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
philr added a commit that referenced this issue Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method in
RubyCoreSupport (now reinstated having previously been removed in
2.0.0).

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants