-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Description
In broken email messages (mostly spam) the headers aren't always encoded properly (I think?), causing sup to crash. It feeds the UTF-8 string into RMail::Header::Field.parse, which in turn defines an ASCII-8bit regex and matches the string against that. For now I've fixed it like this in rmail-sup's header.rb:
def parse(field)
field = field.dup.to_str
field.force_encoding('binary')
if field =~ EXTRACT_FIELD_NAME_RE
But I've got no idea if it's sup who should send it an ASCII string, or RMail who should coerce it into an ASCII string.
And here's the traceback. The line number in header.rb is off a bit, but you get the idea:
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/header.rb:81:in `parse'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:233:in `block in parse_header'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:229:in `each'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:229:in `parse_header'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:194:in `parse_low'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:183:in `parse'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:331:in `parse'
/var/lib/gems/1.9.1/gems/rmail-sup-1.0.1/lib/rmail/parser.rb:345:in `read'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/mbox.rb:84:in `block in load_message'
<internal:prelude>:10:in `synchronize'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/mbox.rb:74:in `load_message'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/message.rb:772:in `parsed_message'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/message.rb:261:in `load_from_source!'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/message.rb:360:in `build_from_source'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:204:in `block in poll_from'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/mbox.rb:143:in `poll'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:201:in `poll_from'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:146:in `block (2 levels) in do_poll'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:136:in `each'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:136:in `block in do_poll'
<internal:prelude>:10:in `synchronize'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:135:in `do_poll'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/util.rb:649:in `method_missing'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/modes/poll_mode.rb:15:in `poll'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:58:in `poll_with_sources'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/poll.rb:94:in `poll'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup/util.rb:649:in `method_missing'
/var/lib/gems/1.9.1/gems/sup-0.15.2/bin/sup:220:in `block (2 levels) in <module:Redwood>'
/var/lib/gems/1.9.1/gems/sup-0.15.2/lib/sup.rb:87:in `block in reporting_thread'