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

Conflict with net/http? #1523

Open
hallerm opened this issue Dec 7, 2022 · 7 comments
Open

Conflict with net/http? #1523

hallerm opened this issue Dec 7, 2022 · 7 comments

Comments

@hallerm
Copy link

hallerm commented Dec 7, 2022

With ruby 2.6.10 and mail 2.8.0 installed, requiring 'mail' followed by 'net/http' shows a conflict with the built-in net/protocol. I have not yet observed any functional problems, but it seems problematic that the net-protocol gem code is being overwritten with the built-in library code.

$ irb
irb(main):001:0> require 'mail'
=> true
irb(main):002:0> require 'net/http'
/opt/homebrew/Cellar/[email protected]/2.6.10/lib/ruby/2.6.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
/opt/homebrew/lib/ruby/gems/2.6.0/gems/net-protocol-0.2.0/lib/net/protocol.rb:68: warning: previous definition of ProtocRetryError was here
/opt/homebrew/Cellar/[email protected]/2.6.10/lib/ruby/2.6.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
/opt/homebrew/lib/ruby/gems/2.6.0/gems/net-protocol-0.2.0/lib/net/protocol.rb:213: warning: previous definition of BUFSIZE was here
/opt/homebrew/Cellar/[email protected]/2.6.10/lib/ruby/2.6.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
/opt/homebrew/lib/ruby/gems/2.6.0/gems/net-protocol-0.2.0/lib/net/protocol.rb:550: warning: previous definition of Socket was here
=> true

Version 2.7.1 does not have this problem.

@dgm
Copy link

dgm commented Dec 14, 2022

Also a problem on ruby 2.7.7 and mail 2.8.0

@lovitt
Copy link

lovitt commented Dec 28, 2022

This problem is described well here.

It sounds like the right solution is for mail to declare net-http as a dependency.

@masonlouchart
Copy link

masonlouchart commented Jan 27, 2023

I encountered this conflict when trying to update Rails (to 6.1.7.2) for fixing security issue CVE-2023-22794.
As (temporary?) solution I locked mail version strictly under 2.8.
Other solution applied: #1523 (comment)

@crivotz
Copy link

crivotz commented Feb 15, 2023

As temporary solution you can also add gem "net-http" to your Gemfile as suggested in reference by @lovitt

@masonlouchart
Copy link

masonlouchart commented Feb 16, 2023

@crivotz Actually during PR review we decided to do as you suggested (add net-http to the Gemfile).
It introduced an issue with CircleCI default gem uri but it's another story (we fixed it too).

@crivotz
Copy link

crivotz commented Feb 16, 2023

@crivotz Actually during PR review we decided to do as you suggested (add net-http to the Gemfile). It introduced an issue with CircleCI default gem uri but it's another story (we fixed it too).

I just had trouble deploying because of the uri issue if I pass the net-http gem in the Gemfile in production I get:

You have already activated uri 0.10.1, but your Gemfile requires uri 0.12.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem

So for the moment I rollback to 2.7.1 version of mail

@masonlouchart
Copy link

You have already activated uri 0.10.1, but your Gemfile requires uri 0.12.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem

We ran through this error too.
The solution we applied is to change the Ruby default gem version.
We added a step to the CI configuration that deploy the application before the dependencies installation.

- run: sudo gem install uri -v0.12.0 --default

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

5 participants