Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] tiny fix for sup-faked message id's crashing sup-sync
@ 2007-10-30  1:55 Brendan O'Connor
  2007-11-02  2:35 ` William Morgan
       [not found] ` <321bb12900151bd3@IMSS-WIN>
  0 siblings, 2 replies; 4+ messages in thread
From: Brendan O'Connor @ 2007-10-30  1:55 UTC (permalink / raw)


Hello all --

After a tiny bugfix off SVN 650, I'm importing gmail imap!  Very exciting!

I hate it when I add a puts or logging statement and it messes up
ruby's returning conventions, returning nil that clobbers something
elsewhere.  Glad to see it happens to other people too :)

Index: lib/sup/message.rb
===================================================================
--- lib/sup/message.rb  (revision 650)
+++ lib/sup/message.rb  (working copy)
@@ -62,8 +62,8 @@
       if header["message-id"]
         sanitize_message_id header["message-id"]
       else
+        Redwood::log "faking message-id for message from #@from: #@id"
         "sup-faked-" + Digest::MD5.hexdigest(raw_header)
-        Redwood::log "faking message-id for message from #@from: #@id"
       end

     date = header["date"]

................... for reference the error was later, after the
Message's id was nil:

$ sup-sync

...

[Mon Oct 29 17:16:12 -0700 2007] faking message-id for message from
Mail Delivery Subsystem <mailer-daemon at googlemail.com>:
[Mon Oct 29 17:16:12 -0700 2007] saving index and sources...
[Mon Oct 29 17:16:12 -0700 2007] unlocking /Users/brendano/.sup/lock...
/Users/brendano/sw/sup/lib/sup/index.rb:323:in `initialize': can't
convert nil into String (TypeError)
        from /Users/brendano/sw/sup/lib/sup/index.rb:323:in `new'
        from /Users/brendano/sw/sup/lib/sup/index.rb:323:in `load_entry_for_id'
        from /Users/brendano/sw/sup/lib/sup/util.rb:395:in `send'
        from /Users/brendano/sw/sup/lib/sup/util.rb:395:in `method_missing'
        from /Users/brendano/sw/sup/lib/sup/poll.rb:149:in `add_messages_from'
        from /Users/brendano/sw/sup/lib/sup/imap.rb:174:in `each'
        from /Users/brendano/sw/sup/lib/sup/imap.rb:163:in `upto'
        from /Users/brendano/sw/sup/lib/sup/imap.rb:163:in `each'
        from /Users/brendano/sw/sup/lib/sup/util.rb:431:in `send'
        from /Users/brendano/sw/sup/lib/sup/util.rb:431:in `__pass'
        from /Users/brendano/sw/sup/lib/sup/util.rb:420:in `method_missing'
        from /Users/brendano/sw/sup/lib/sup/poll.rb:133:in `add_messages_from'
        from /Users/brendano/sw/sup/lib/sup/util.rb:395:in `send'
        from /Users/brendano/sw/sup/lib/sup/util.rb:395:in `method_missing'
        from /Users/brendano/sw/sup/bin/sup-sync:133
        from /Users/brendano/sw/sup/bin/sup-sync:128:in `each'
        from /Users/brendano/sw/sup/bin/sup-sync:128
Rats, that failed. You may have to do it manually.


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

* [sup-talk] tiny fix for sup-faked message id's crashing sup-sync
  2007-10-30  1:55 [sup-talk] tiny fix for sup-faked message id's crashing sup-sync Brendan O'Connor
@ 2007-11-02  2:35 ` William Morgan
       [not found] ` <321bb12900151bd3@IMSS-WIN>
  1 sibling, 0 replies; 4+ messages in thread
From: William Morgan @ 2007-11-02  2:35 UTC (permalink / raw)


Excerpts from Brendan O'Connor's message of Mon Oct 29 18:55:59 -0700 2007:
> After a tiny bugfix off SVN 650, I'm importing gmail imap!  Very
> exciting!

Great news.

> I hate it when I add a puts or logging statement and it messes up
> ruby's returning conventions, returning nil that clobbers something
> elsewhere. Glad to see it happens to other people too :)

Ruby is flawless. I am to blame. Applied, thanks!

-- 
William <wmorgan-sup at masanjin.net>


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

* [sup-talk] tiny fix for sup-faked message id's crashing sup-sync
       [not found] ` <321bb12900151bd3@IMSS-WIN>
@ 2007-11-02 10:01   ` Marcus Williams
  2007-11-02 15:17     ` William Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Marcus Williams @ 2007-11-02 10:01 UTC (permalink / raw)


On 02/11/2007 William Morgan wrote:
> > I hate it when I add a puts or logging statement and it messes up
> > > ruby's returning conventions, returning nil that clobbers something
> > > elsewhere. Glad to see it happens to other people too :)
> 
> Ruby is flawless. I am to blame. Applied, thanks!

... you may want to remove the @id from the log message - wont this 
always be nil at this point (as it gets assigned by this block)?

Marcus


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

* [sup-talk] tiny fix for sup-faked message id's crashing sup-sync
  2007-11-02 10:01   ` Marcus Williams
@ 2007-11-02 15:17     ` William Morgan
  0 siblings, 0 replies; 4+ messages in thread
From: William Morgan @ 2007-11-02 15:17 UTC (permalink / raw)


Excerpts from Marcus Williams's message of Fri Nov 02 03:01:16 -0700 2007:
> ... you may want to remove the @id from the log message - wont this 
> always be nil at this point (as it gets assigned by this block)?

Good point. A chance to use my k combinator! Check this out:

  --- lib/sup/message.rb  (revision 658)
  +++ lib/sup/message.rb  (working copy)
  @@ -62,8 +62,9 @@
         if header["message-id"]
           sanitize_message_id header["message-id"]
         else
  -        Redwood::log "faking message-id for message from #@from: #@id"
  -        "sup-faked-" + Digest::MD5.hexdigest(raw_header)
  +        returning("sup-faked-" + Digest::MD5.hexdigest(raw_header)) do |id|
  +          Redwood::log "faking message-id for message from #@from: #{id}"
  +        end
         end
       
       date = header["date"]

God I love this language.

-- 
William <wmorgan-sup at masanjin.net>


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

end of thread, other threads:[~2007-11-02 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-30  1:55 [sup-talk] tiny fix for sup-faked message id's crashing sup-sync Brendan O'Connor
2007-11-02  2:35 ` William Morgan
     [not found] ` <321bb12900151bd3@IMSS-WIN>
2007-11-02 10:01   ` Marcus Williams
2007-11-02 15:17     ` William Morgan

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