Subject: [sup-talk] mbox date fail

From: Mike Kelly <[email-masked]>
Date: Fri, 23 Oct 2009 17:13:35 -0400

Hi,

I seem to be caught in a bit of a catch-22. I can't reliably use mbox
because of shortcomings in its format. And, I can't use maildir because
sup-sync-back doesn't support it.

More specifically, I seem to come across this much more often that I
should. It's caused by someone starting a line of their message with
"From". For example:

  ...
  X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.0
  Status: 
  X-Keywords:                                                             
       
  Content-Length: 1742

  From the ticket he states that 1.2.3.4 is the IP:

  ...

That yields this exception:

  [Fri Oct 23 17:07:00 -0400 2009] unlocking
/usr/home/staff/mike/.sup/lock...
  /usr/local/lib/ruby/1.8/time.rb:184:in `local': argument out of range
(ArgumentError)
        from /usr/local/lib/ruby/1.8/time.rb:184:in `make_time'
        from /usr/local/lib/ruby/1.8/time.rb:243:in `parse'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mbox.rb:15:in
`is_break_line?'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mbox/loader.rb:165:in
`next'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mbox/loader.rb:145:in
`synchronize'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/mbox/loader.rb:145:in
`next'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/source.rb:103:in
`each'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:560:in
`send'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:560:in
`__pass'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:547:in
`method_missing'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/poll.rb:139:in
`each_message_from'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:520:in
`send'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/lib/sup/util.rb:520:in
`method_missing'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:146
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:141:in
`each'
        from
/usr/home/staff/mike/lib/ruby/gems/1.8/gems/sup-999/bin/sup-sync:141
        from /usr/home/staff/mike/lib/ruby/gems/1.8/bin/sup-sync:19:in
`load'
        from /usr/home/staff/mike/lib/ruby/gems/1.8/bin/sup-sync:19

Is there much of anything that I can do to mitigate this problem, aside
from manually altering every offending message?

It seems like the messages' Content-Length header should be used to skip
past the body and ignore the offending Froms? Or, at least, if that sort of
ArgumentError is thrown, maybe it should be caught and handled better?

I'm running current master (2dfd378b616243d03203e49f5ee29636051d3cbf).

Thanks.

-- 
Mike Kelly
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: William Morgan <[email-masked]>
Date: Sun, 01 Nov 2009 10:46:33 -0800

Reformatted excerpts from Mike Kelly's message of 2009-10-23:
> Is there much of anything that I can do to mitigate this problem,
> aside from manually altering every offending message?

I've fixed this in master. Can you try again, please?

> It seems like the messages' Content-Length header should be used to
> skip past the body and ignore the offending Froms?

This is an option, but I'm avoiding it, because Content-Length is not
guaranteed to be there, and not guaranteed to be correct.

> Or, at least, if that sort of

Yep, that's what I've done. I couldn't get my local system to throw
ArgumentError, even with your example, but if it's possible, it's
possible, and should be caught.
-- 
William <[email-masked]>
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Mike Kelly <[email-masked]>
Date: Sun, 1 Nov 2009 18:30:07 -0500

On Sun, 01 Nov 2009 10:46:33 -0800

> possible, and should be caught.

Yep, that seems to help. Thanks! (I altered the example slightly for
anonymity reasons, that might have invalidated it as a test case).

-- 
Mike Kelly