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

Ruby 3.1 compatibility #1461

Closed
brian-kephart opened this issue Nov 9, 2021 · 2 comments
Closed

Ruby 3.1 compatibility #1461

brian-kephart opened this issue Nov 9, 2021 · 2 comments

Comments

@brian-kephart
Copy link

Ruby 3.1.0-preview1 was released today. Notably, several gems that Mail depends on were moved from default gems to bundled gems, so they need to be explicitly depended on.

I created a branch that adds the gems net-smtp, net-pop, and net-imap to the gemspec. You can see the results here.

I did not go to the lengths of wrangling a docker image and updating the Github Actions config. The output of running the tests locally on Ruby 3.1.0-preview1 is below. Running the tests locally on Ruby 3.0.2 passes, so the failures would appear to be associated specifically with the newer version.

Running Specs under Ruby Version 3.1.0
Running Specs for Mail Version 2.8.0.edge
Run options: exclude {:require_rspec_benchmark=>#<Proc: ./spec/spec_helper.rb:36>}
............................................................................................................*......................................................................................................................................................................................................Encoding conversion failed "\xDE\xBA" on UTF-16BE
.............................................................................................................*...................................................................................................................................................................................................................................................................................................................................................................................................................WARNING: Invalid date field for received element (29 Jul 2013 25:12:46 +0900): Date::Error: invalid date
......................................................................*..................................................................................................................................................................................................................................................................................FFFFFFF........................................................................................................F....................................................................................................................................................................................................**......*...................................................................................................................................................................................................................................................................................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Mail::AddressList parsing should handle malformed folding whitespace
     # No reason given
     Failure/Error: raise Mail::Field::IncompleteParseError.new(Mail::AddressList, data, p)
     
     Mail::Field::IncompleteParseError:
       Mail::AddressList can not parse |leads@sg.dc.com,
       	 sag@leads.gs.ry.com,
       	 sn@example-hotmail.com,
       	 e-s-a-g-8718@app.ar.com,
       	 jp@t-exmaple.com,
       	
       	 cc@c-l-example.com|: Only able to parse up to "leads@sg.dc.com,"
     # ./lib/mail/parsers/address_lists_parser.rb:33233:in `parse'
     # ./lib/mail/elements/address_list.rb:25:in `initialize'
     # ./spec/mail/elements/address_list_spec.rb:75:in `new'
     # ./spec/mail/elements/address_list_spec.rb:75:in `block (3 levels) in <top (required)>'

  2) Test emails from RFC2822 should handle the rfc obsolete whitespace email
     # No reason given
     Failure/Error: expect(mail.from).to eq 'John Doe <jdoe@machine(comment).example>'
     
       expected: "John Doe <jdoe@machine(comment).example>"
            got: ["jdoe@machine.  example"]
     
       (compared using ==)
     # ./spec/mail/example_emails_spec.rb:241:in `block (3 levels) in <top (required)>'

  3) Mail::SenderField initialization should reject headers with multiple mailboxes
     # Sender accepts an address list now, but should only accept a single address
     Failure/Error:
       expect {
         Mail::SenderField.new('Mikel Lindsaar <mikel@test.lindsaar.net>, "Bob Smith" <bob@me.com>')
       }.to raise_error(Mail::Field::ParseError)
     
       expected Mail::Field::ParseError but nothing was raised
     # ./spec/mail/fields/sender_field_spec.rb:24:in `block (3 levels) in <top (required)>'

  4) SMTP Delivery Method dot-stuff unterminated last line of the message
     # is skipped on Ruby versions without dot-stuff bug
     # ./spec/mail/network/delivery_methods/smtp_connection_spec.rb:23

  5) SMTP Delivery Method dot-stuff unterminated last line of the message containing a single dot
     # is skipped on Ruby versions without dot-stuff bug
     # ./spec/mail/network/delivery_methods/smtp_connection_spec.rb:37

  6) SMTP Delivery Method general usage dot-stuff unterminated last line of the message
     # is skipped on Ruby versions without dot-stuff bug
     # ./spec/mail/network/delivery_methods/smtp_spec.rb:29


Failures:

  1) Mail::Message initialization YAML serialization should serialize the basic information to YAML
     Failure/Error: yaml_output = YAML.load(yaml)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./spec/mail/message_spec.rb:199:in `block (4 levels) in <top (required)>'

  2) Mail::Message initialization YAML serialization should deserialize after serializing
     Failure/Error: hash = YAML.load(str)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./lib/mail/message.rb:1844:in `from_yaml'
     # ./spec/mail/message_spec.rb:209:in `block (4 levels) in <top (required)>'

  3) Mail::Message initialization YAML serialization should serialize a Message with a custom delivery_handler
     Failure/Error: yaml_output = YAML.load(yaml)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./spec/mail/message_spec.rb:217:in `block (4 levels) in <top (required)>'

  4) Mail::Message initialization YAML serialization should load a serialized delivery handler
     Failure/Error: hash = YAML.load(str)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./lib/mail/message.rb:1844:in `from_yaml'
     # ./spec/mail/message_spec.rb:223:in `block (4 levels) in <top (required)>'

  5) Mail::Message initialization YAML serialization should not deserialize a delivery_handler that does not exist
     Failure/Error: yaml_hash = YAML.load(yaml)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./spec/mail/message_spec.rb:229:in `block (4 levels) in <top (required)>'

  6) Mail::Message initialization YAML serialization should deserialize parts as an instance of Mail::PartsList
     Failure/Error: yaml_hash = YAML.load(yaml)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::Body
     # ./spec/mail/message_spec.rb:237:in `block (4 levels) in <top (required)>'

  7) Mail::Message initialization YAML serialization should handle multipart mail
     Failure/Error: hash = YAML.load(str)
     
     Psych::DisallowedClass:
       Tried to load unspecified class: Mail::SMTP
     # ./lib/mail/message.rb:1844:in `from_yaml'
     # ./spec/mail/message_spec.rb:244:in `block (4 levels) in <top (required)>'

  8) Mail::Message output should raise an error and message if you try and call decoded on a multipart email
     Failure/Error: expect { mail.decoded }.to raise_error(NoMethodError, 'Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.')
     
       expected NoMethodError with "Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.", got #<NoMethodError: Can not decode an entire message, try calling #decoded on the various fields and bod...lling #decoded on the various fields and body or parts if it is a multipart message.'
               ^^^^^> with backtrace:
         # ./lib/mail/message.rb:1895:in `decoded'
         # ./spec/mail/message_spec.rb:1603:in `block (4 levels) in <top (required)>'
         # ./spec/mail/message_spec.rb:1603:in `block (3 levels) in <top (required)>'
     # ./spec/mail/message_spec.rb:1603:in `block (3 levels) in <top (required)>'

Finished in 3.24 seconds (files took 1.23 seconds to load)
1805 examples, 8 failures, 6 pending

Failed examples:

rspec ./spec/mail/message_spec.rb:197 # Mail::Message initialization YAML serialization should serialize the basic information to YAML
rspec ./spec/mail/message_spec.rb:208 # Mail::Message initialization YAML serialization should deserialize after serializing
rspec ./spec/mail/message_spec.rb:214 # Mail::Message initialization YAML serialization should serialize a Message with a custom delivery_handler
rspec ./spec/mail/message_spec.rb:221 # Mail::Message initialization YAML serialization should load a serialized delivery handler
rspec ./spec/mail/message_spec.rb:227 # Mail::Message initialization YAML serialization should not deserialize a delivery_handler that does not exist
rspec ./spec/mail/message_spec.rb:235 # Mail::Message initialization YAML serialization should deserialize parts as an instance of Mail::PartsList
rspec ./spec/mail/message_spec.rb:242 # Mail::Message initialization YAML serialization should handle multipart mail
rspec ./spec/mail/message_spec.rb:1590 # Mail::Message output should raise an error and message if you try and call decoded on a multipart email
@lewispb
Copy link
Contributor

lewispb commented Nov 9, 2021

Related: #1439

@mikel
Copy link
Owner

mikel commented Apr 26, 2022

@brian-kephart and @lewispb This should now be handled with 2.8.0.rc1, please do test and report back any issues.

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

3 participants