Subject: [sup-talk] ArgumentError from thread: poll after loading inbox

From: [email-masked] (Richard Sandilands)
Date: Mon, 7 Sep 2009 21:47:53 +1000

Am tracking 'next' branch and moved to Xapian earlier today.

I had Sup running when I slept my OS X laptop by shutting the lid.
Upon awakening, Sup raised the following error. Upon trying to run Sup
again from the prompt, the same error re-occurs:

I'm populating my local Maildirs using getmail from Gmail via POP.

===========
--- ArgumentError from thread: poll after loading inbox
expecting a symbol
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/label.rb:64:in `<<'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `send'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `method_missing'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/xapian_index.rb:114:in
`sync_message'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in
`each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in
`each_key'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in
`each'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/xapian_index.rb:114:in
`sync_message'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/xapian_index.rb:87:in `add_message'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `send'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `method_missing'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:166:in `add_new_message'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:110:in `do_poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:152:in `each_message_from'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/maildir.rb:160:in `each'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/maildir.rb:157:in `upto'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/maildir.rb:157:in `each'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:560:in `send'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:560:in `__pass'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:547:in `method_missing'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:140:in `each_message_from'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:93:in `do_poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:81:in `each'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:81:in `do_poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:80:in `synchronize'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:80:in `do_poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `send'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `method_missing'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/poll-mode.rb:15:in `poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/poll.rb:48:in `poll'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `send'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/util.rb:520:in `method_missing'
/Users/richard/src/mainline/bin/sup:196
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:77:in `reporting_thread'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `initialize'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `new'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `reporting_thread'
/Users/richard/src/mainline/bin/sup:196
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:669:in
`call'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:669:in
`__unprotected_load_threads'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:610:in
`call'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:610:in
`load_n_threads_background'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:77:in `reporting_thread'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `initialize'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `new'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup.rb:75:in `reporting_thread'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:608:in
`load_n_threads_background'
/Library/Ruby/Gems/1.8/gems/sup-999/lib/sup/modes/thread-index-mode.rb:679:in
`__unprotected_load_threads'
(eval):12:in `load_threads'
/Users/richard/src/mainline/bin/sup:196
==============

-- 
Richard

---

From: [email-masked] (William Morgan)
Date: Tue, 08 Sep 2009 13:38:35 -0700

> Am tracking 'next' branch and moved to Xapian earlier today.

Do you have a before-add-message hook? If so, I'm sorry to say that you
will have to regenerate your index to fix this. There was a problem with
next for a while that allowed that hook to add non-symbol labels to
messages, and those got serialized into Xapian's index.

If not, regenerating it will probably help, but it would be good to find
the source of the non-symbol labels.
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Richard Sandilands)
Date: Wed, 9 Sep 2009 07:13:07 +1000

> messages, and those got serialized into Xapian's index.

I do indeed, as follows:

   if message.subj =~ /\[sup-talk\]/
    message.add_label "sup"
    message.add_label "list"
  end

> the source of the non-symbol labels.

I do have some labels prepended with an ! to force them to sort to the
top of the 'L' list - such as '!followup', '!hold' etc. Could that be
an issue?

-- 
Richard

---

From: [email-masked] (William Morgan)
Date: Wed, 09 Sep 2009 07:20:03 -0700

> I do indeed, as follows:

Excellent.

> top of the 'L' list - such as '!followup', '!hold' etc. Could that be

Nope, it was the hook above. (Which is fine, btw, it just triggered
something bad.) You will need to regenerate the index and everything
should be fine. Sorry about that.

If you don't have a recent dumpfile, you may have to apply the following
patch to get sup-dump to work. Then you should be able to git fetch,
reset the head to origin/next, and run `sup-sync --restored --restore
<dumpfile> --all-sources`.

Let me know if you run into problems.

diff --git a/lib/sup/label.rb b/lib/sup/label.rb
index 67474c2..b94474d 100644
--- a/lib/sup/label.rb
+++ b/lib/sup/label.rb
@@ -61,7 +61,7 @@ class LabelManager
   end
 
   def << t
-    raise ArgumentError, "expecting a symbol" unless t.is_a? Symbol
+    t = t.to_sym
     unless @labels.member?(t) || RESERVED_LABELS.member?(t)
       @labels[t] = true
-- 
William <wmorgan-sup at masanjin.net>