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

                 Key: JRUBY-882
                 URL: http://jira.codehaus.org/browse/JRUBY-882
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 0.9.9
         Environment: JRuby 0.9.9, java version "1.6.0_01", Linux Kernel 2.6.20 
(Ubuntu Feisty)
            Reporter: Raphael Valyi
            Assignee: Thomas E Enebo
            Priority: Critical


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:
{noformat}
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!'
{noformat}

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).

{noformat}
    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")
{noformat}

result in jirb:
{noformat}
RuntimeError: TMail FATAL: encoder scan fail
        from (irb):23:in `scanadd'
        from (irb):2:in `binding'
{noformat}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to