Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] RMail chokes on broken headers
@ 2009-10-12 23:22 Tero Tilus
  2009-10-15 13:11 ` William Morgan
  0 siblings, 1 reply; 5+ messages in thread
From: Tero Tilus @ 2009-10-12 23:22 UTC (permalink / raw)
  To: sup-talk

RMail::Header#content_type breaks when it encounters broken
Content-Type and takes sup-sync down with it

/usr/lib/ruby/gems/1.8/gems/rmail-1.0.0/lib/rmail/header.rb:537:in `content_type': undefined method `downcase' for nil:NilClass (NoMethodError)
        from /home/terotil/src/sup/lib/sup/message.rb:439:in `message_to_chunks'
        from /home/terotil/src/sup/lib/sup/message.rb:239:in `load_from_source!'
        from /home/terotil/src/sup/lib/sup/message.rb:335:in `build_from_source'
        from /home/terotil/src/sup/lib/sup/poll.rb:160:in `each_message_from'

Worked around it this way

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index f9f87de..5ff3e48 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -436,7 +436,7 @@ private
       end
 
       chunks
-    elsif m.header.content_type && m.header.content_type.downcase == "message/rfc822"
+    elsif (m.header.content_type == "message/rfc822" rescue false) # rmail 1.0.0 may choke on broken content-type header, FIXME: fix rmail
       if m.body
         payload = RMail::Parser.read(m.body)
         from = payload.header.from.first ? payload.header.from.first.format : ""
@@ -456,7 +456,7 @@ private
         debug "no body for message/rfc822 enclosure; skipping"
         []
       end
-    elsif m.header.content_type && m.header.content_type.downcase == "application/pgp" && m.body
+    elsif (m.header.content_type.downcase == "application/pgp" rescue false) && m.body # rmail 1.0.0 may choke on broken content-type header, FIXME: fix rmail
       ## apparently some versions of Thunderbird generate encryped email that
       ## does not follow RFC3156, e.g. messages with X-Enigmail-Version: 0.95.0
       ## they have no MIME multipart and just set the body content type to

The problem itself is inside RMail.  I reported it.
http://rubyforge.org/tracker/index.php?func=detail&aid=27282&group_id=446&atid=1754

RMail looks abandoned.  Development is pretty much stalled.  No
functional changes since 2004-04-27.  None of the reported bugs have
been fixed.  Might it be worth to think about switching to another
mail lib?  TMail author's http://github.com/mikel/mail/ looks
promising.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] RMail chokes on broken headers
  2009-10-12 23:22 [sup-talk] RMail chokes on broken headers Tero Tilus
@ 2009-10-15 13:11 ` William Morgan
  2009-10-29 23:02   ` Mariano Mara
  0 siblings, 1 reply; 5+ messages in thread
From: William Morgan @ 2009-10-15 13:11 UTC (permalink / raw)
  To: sup-talk

Reformatted excerpts from Tero Tilus's message of 2009-10-12:
> RMail looks abandoned.  Development is pretty much stalled.  No
> functional changes since 2004-04-27.  None of the reported bugs have
> been fixed.  Might it be worth to think about switching to another
> mail lib?  TMail author's http://github.com/mikel/mail/ looks
> promising.

Yeah, this is certainly an option. But it seems like a lot of work. And
every day our set of rmail workarounds grows more robust. :)

Not to say I wouldn't accept a patch that magically did this all for me,
of course.
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] RMail chokes on broken headers
  2009-10-15 13:11 ` William Morgan
@ 2009-10-29 23:02   ` Mariano Mara
  2009-10-30 21:50     ` William Morgan
  0 siblings, 1 reply; 5+ messages in thread
From: Mariano Mara @ 2009-10-29 23:02 UTC (permalink / raw)
  To: sup-talk


[-- Attachment #1.1: Type: text/plain, Size: 4213 bytes --]

2009/10/15 William Morgan <wmorgan-sup@masanjin.net>

> Reformatted excerpts from Tero Tilus's message of 2009-10-12:
> > RMail looks abandoned.  Development is pretty much stalled.  No
> > functional changes since 2004-04-27.  None of the reported bugs have
> > been fixed.  Might it be worth to think about switching to another
> > mail lib?  TMail author's http://github.com/mikel/mail/ looks
> > promising.
>
> Yeah, this is certainly an option. But it seems like a lot of work. And
> every day our set of rmail workarounds grows more robust. :)
>
> Not to say I wouldn't accept a patch that magically did this all for me,
> of course.
> --


Hi there, I'm facing the same error as reported by Tero. I applied the
modifications he sent, however it's failing in another place and my total
ignorance of Ruby prevents me from fixing it. Would anyone be so kind to
suggest a workaround?

Below is the complete exception recorded.

TIA,
Mariano

--- NoMethodError from thread: poll after loading inbox
undefined method `downcase' for nil:NilClass
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:502:in
`message_to_chunks'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:435:in
`message_to_chunks'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:435:in `map'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:435:in
`message_to_chunks'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:239:in
`load_from_source!'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/message.rb:335:in
`build_from_source'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:145:in
`each_message_from'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/maildir.rb:160:in `each'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/maildir.rb:157:in `upto'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/maildir.rb:157:in `each'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:560:in `send'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:560:in `__pass'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:547:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:139:in
`each_message_from'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:93:in `do_poll'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:81:in `each'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:81:in `do_poll'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:80:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:80:in `do_poll'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:520:in `send'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:520:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/poll-mode.rb:15:in `poll'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/poll.rb:48:in `poll'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:520:in `send'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/util.rb:520:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/bin/sup:196
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:77:in `reporting_thread'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `initialize'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `new'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `reporting_thread'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/bin/sup:196
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:669:in
`call'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:669:in
`__unprotected_load_threads'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:610:in
`call'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:610:in
`load_n_threads_background'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:77:in `reporting_thread'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `initialize'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `new'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup.rb:75:in `reporting_thread'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:608:in
`load_n_threads_background'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/lib/sup/modes/thread-index-mode.rb:679:in
`__unprotected_load_threads'
(eval):12:in `load_threads'
/usr/lib/ruby/gems/1.8/gems/sup-0.9/bin/sup:196
/usr/bin/sup:19:in `load'
/usr/bin/sup:19

[-- Attachment #1.2: Type: text/html, Size: 5074 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] RMail chokes on broken headers
  2009-10-29 23:02   ` Mariano Mara
@ 2009-10-30 21:50     ` William Morgan
  2009-10-31 20:18       ` Mariano Mara
  0 siblings, 1 reply; 5+ messages in thread
From: William Morgan @ 2009-10-30 21:50 UTC (permalink / raw)
  To: sup-talk

Reformatted excerpts from Mariano Mara's message of 2009-10-29:
> Hi there, I'm facing the same error as reported by Tero. I applied the
> modifications he sent, however it's failing in another place and my
> total ignorance of Ruby prevents me from fixing it. Would anyone be so
> kind to suggest a workaround?

This is fixed in git master. Maybe I should release an 0.9.1.
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [sup-talk] RMail chokes on broken headers
  2009-10-30 21:50     ` William Morgan
@ 2009-10-31 20:18       ` Mariano Mara
  0 siblings, 0 replies; 5+ messages in thread
From: Mariano Mara @ 2009-10-31 20:18 UTC (permalink / raw)
  To: sup-talk


[-- Attachment #1.1: Type: text/plain, Size: 555 bytes --]

2009/10/30 William Morgan <wmorgan-sup@masanjin.net>

> Reformatted excerpts from Mariano Mara's message of 2009-10-29:
> > Hi there, I'm facing the same error as reported by Tero. I applied the
> > modifications he sent, however it's failing in another place and my
> > total ignorance of Ruby prevents me from fixing it. Would anyone be so
> > kind to suggest a workaround?
>
> This is fixed in git master. Maybe I should release an 0.9.1.
> --
> William <wmorgan-sup@masanjin.net>
>

Thanks a lot! It would be great if you could release 0.9.1

Mariano

[-- Attachment #1.2: Type: text/html, Size: 999 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-31 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 23:22 [sup-talk] RMail chokes on broken headers Tero Tilus
2009-10-15 13:11 ` William Morgan
2009-10-29 23:02   ` Mariano Mara
2009-10-30 21:50     ` William Morgan
2009-10-31 20:18       ` Mariano Mara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox