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

uninitialized constant Addressable::IDNA::PunycodeBigOutput (NameError) #119

Closed
dentarg opened this issue Feb 21, 2018 · 3 comments
Closed
Labels

Comments

@dentarg
Copy link
Collaborator

dentarg commented Feb 21, 2018

Repro:

$ gem uninstall twingly-url

Select gem to uninstall:
 1. twingly-url-1.3.3
 2. twingly-url-4.2.0
 3. twingly-url-5.1.0
 4. twingly-url-5.1.1
 5. All versions
> 5
Successfully uninstalled twingly-url-1.3.3
Successfully uninstalled twingly-url-4.2.0
Successfully uninstalled twingly-url-5.1.0
Successfully uninstalled twingly-url-5.1.1

$ gem install twingly-url
Fetching: twingly-url-5.1.1.gem (100%)
Successfully installed twingly-url-5.1.1
Parsing documentation for twingly-url-5.1.1
Installing ri documentation for twingly-url-5.1.1
Done installing documentation for twingly-url after 0 seconds
1 gem installed

$ irb -rtwingly/url
/Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:18:in `<class:URL>': uninitialized constant Addressable::IDNA::PunycodeBigOutput (NameError)
	from /Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:11:in `<module:Twingly>'
	from /Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:10:in `<top (required)>'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:281:in `block in load_modules'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:279:in `each'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:279:in `load_modules'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:21:in `setup'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb.rb:378:in `start'
	from /Users/dentarg/.rubies/ruby-2.4.3/bin/irb:11:in `<main>'

This was not an issue in the previous version

$ gem uninstall twingly-url
Successfully uninstalled twingly-url-5.1.1

$ gem install twingly-url -v 5.1.0
Fetching: twingly-url-5.1.0.gem (100%)
Successfully installed twingly-url-5.1.0
Parsing documentation for twingly-url-5.1.0
Installing ri documentation for twingly-url-5.1.0
Done installing documentation for twingly-url after 0 seconds
1 gem installed

$ irb -rtwingly/url
irb(main):001:0>
@dentarg dentarg added the bug label Feb 21, 2018
@dentarg
Copy link
Collaborator Author

dentarg commented Feb 21, 2018

$ gem list addressable

*** LOCAL GEMS ***

addressable (2.5.2, 2.5.0, 2.4.0, 2.3.8)

@dentarg
Copy link
Collaborator Author

dentarg commented Feb 21, 2018

What I'm using

$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin16]

$ gem -v
2.7.6

@dentarg
Copy link
Collaborator Author

dentarg commented Feb 28, 2018

This happens when you have idn-ruby installed:

$ gem list idn-ruby

*** LOCAL GEMS ***

idn-ruby (0.1.0)

$ irb -rtwingly/url
/Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:18:in `<class:URL>': uninitialized constant Addressable::IDNA::PunycodeBigOutput (NameError)
	from /Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:11:in `<module:Twingly>'
	from /Users/dentarg/.gem/ruby/2.4.3/gems/twingly-url-5.1.1/lib/twingly/url.rb:10:in `<top (required)>'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:281:in `block in load_modules'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:279:in `each'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:279:in `load_modules'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb/init.rb:21:in `setup'
	from /Users/dentarg/.rubies/ruby-2.4.3/lib/ruby/2.4.0/irb.rb:378:in `start'
	from /Users/dentarg/.rubies/ruby-2.4.3/bin/irb:11:in `<main>'


$ gem uninstall idn-ruby

You have requested to uninstall the gem:
	idn-ruby-0.1.0

twingly-url-4.1.0 depends on idn-ruby (~> 0.1)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled idn-ruby-0.1.0

$ irb -rtwingly/url
irb(main):001:0>

It is because addressable/idna looks like this

begin
  require "addressable/idna/native"
rescue LoadError
  # libidn or the idn gem was not available, fall back on a pure-Ruby
  # implementation...
  require "addressable/idna/pure"
end

We should require addressable/idna/pure to solve this.

dentarg added a commit that referenced this issue Feb 28, 2018
Since #113, twingly-url can only be used with the pure-Ruby
implementation in Addressable.

If idn-ruby (libidn wrapper gem) is installed, Addressable will not load
the pure-Ruby implementation, which breaks twingly-url.

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

No branches or pull requests

1 participant