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

whois-parser crashes on load due to ActiveSupport brokenness #160

Open
todb-cisa opened this issue Feb 27, 2024 · 1 comment
Open

whois-parser crashes on load due to ActiveSupport brokenness #160

todb-cisa opened this issue Feb 27, 2024 · 1 comment

Comments

@todb-cisa
Copy link

todb-cisa commented Feb 27, 2024

This is related to rails/rails#49495

ActiveSupport is apparently busted in latest (7.1.3.? as of October 2023, it seems). Example:

➜  project git:(main) ✗ gem install whois-parser
Successfully installed whois-parser-2.0.0
Parsing documentation for whois-parser-2.0.0
Done installing documentation for whois-parser after 0 seconds
1 gem installed
➜  project git:(main) ✗ irb
irb(main):001> require 'whois-parser'
/Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for module ActiveSupport (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/duration.rb:3:in `<top (required)>'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/core_ext/time/calculations.rb:3:in `<top (required)>'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/whois-parser-2.0.0/lib/whois/parser.rb:16:in `<top (required)>'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/whois-parser-2.0.0/lib/whois-parser.rb:10:in `require_relative'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/whois-parser-2.0.0/lib/whois-parser.rb:10:in `<top (required)>'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:141:in `require'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:141:in `rescue in require'
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:135:in `require'
	from (irb):1:in `<main>'
	... 4 levels...
<internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- whois-parser (LoadError)
	from <internal:/Users/user/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from (irb):1:in `<main>'
	from <internal:kernel>:187:in `loop'
	from /Users/user/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
	from /Users/user/.rbenv/versions/3.3.0/bin/irb:25:in `load'
	from /Users/user/.rbenv/versions/3.3.0/bin/irb:25:in `<main>'
irb(main):002> 

This seems resolved when forcing a downgrade to ActiveSupport 7.0.8:

➜  project git:(main) ✗ cat Gemfile         
source 'https://rubygems.org'

gem 'public_suffix'
gem 'activesupport', '~> 7.0.8'
gem 'whois-parser'
➜  project git:(main) ✗ irb -r 'whois-parser'
irb(main):001> Whois::Parser.class
=> Class
irb(main):002> 

Pinning to that version in the gem should resolve things, if you cared to. Dunno if that breaks other things, but probably not.

My Ruby version is 3.3.0, installed with rbenv, from MacOS Homebrew. If that matters.

@Taomyn
Copy link

Taomyn commented Mar 6, 2024

Adding require 'activesupport' to my code got this working - apparently it's needed because of the way activesupport is being used. I'm not a Ruby coder so no clue what that means, I'm just trying to get whois and whois-parser to work.

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