History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-882
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Thomas E Enebo
Reporter: Raphael Valyi
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

Rails ActionMailer broken. This error is critical because it's actually failing in trivial string manipulation.

Created: 24/Apr/07 07:42 PM   Updated: 06/May/07 09:49 PM
Component/s: None
Affects Version/s: JRuby 0.9.9
Fix Version/s: JRuby 1.0.0RC1

Time Tracking:
Not Specified

Environment: JRuby 0.9.9, java version "1.6.0_01", Linux Kernel 2.6.20 (Ubuntu Feisty)

Testcase included: yes


 Description  « Hide
Was sending e-mail using Actiion mail and msmtp (working with MRI and possibly working with JRuby 0.9.8, yet I'm not 100% sure about that last one), got that stack:
TMail FATAL: encoder scan fail
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:316:in `scanadd'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:260:in `text'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/header.rb:169:in `do_accept'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/header.rb:134:in `accept'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:98:in `accept'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:66:in `ordered_each'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:100:in `each'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:240:in `ordered_each'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:100:in `each'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:242:in `ordered_each'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:100:in `accept'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:66:in `with_multipart_encoding'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/mail.rb:105:in `accept'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:66:in `accept_strategy'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/vendor/tmail/encode.rb:55:in `encoded'
/home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:447:in `deliver!'

Actually, a lower level bug lie inside the scanadd method in that TMail module.
To highlight the bug, simply open try this in irb, then in jirb. Jirb will raise the exception, irb won't.
I'm a bit surprised because all what we do here is really trivial: only parsing Strings...
It's so trivial code that you we can expect this bug has already be open somewhere else (but I didn't find).

    def scanadd( str, force = false )
      types = ''
      strs = []

      until str.empty?
        if m = /\A[^\e\t\r\n ]+/.match(str)
          types << (force ? 'j' : 'a')
          strs.push m[0]

        elsif m = /\A[\t\r\n ]+/.match(str)
          types << 's'
          strs.push m[0]

        elsif m = /\A\e../.match(str)
          esc = m[0]
          str = m.post_match
          if esc != "\e(B" and m = /\A[^\e]+/.match(str)
            types << 'j'
            strs.push m[0]
          end

        else
          raise 'TMail FATAL: encoder scan fail'
        end
        (str = m.post_match) unless m.nil?
      end
   end

scanadd("password reminder")

result in jirb:

RuntimeError: TMail FATAL: encoder scan fail
        from (irb):23:in `scanadd'
        from (irb):2:in `binding'


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Thomas E Enebo - 26/Apr/07 12:31 PM
Fixed in commit 3565

Charles Oliver Nutter - 06/May/07 09:49 PM
Closing for 1.0RC1