[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sup-talk] Recovering a busted ferret db?



Reformatted excerpts from Steven Walter's message of 2009-10-30:
> I am able to Ctrl-C sup-dump when it hangs.  Here's the ruby backtrace:
> 
> /var/lib/gems/1.8/gems/sup-0.9/lib/sup/util.rb:206:in `split': Interrupt
>         from /var/lib/gems/1.8/gems/sup-0.9/lib/sup/util.rb:206:in
> `split_on_commas'

It looks like you have some crazy long recipient email in some list
that's triggering worst-case behavior in a regexp. Can you try again
after applying this patch, please? (And I'd be curious how long the
address list was, if you find out what message is triggering this.)

diff --git a/lib/sup/person.rb b/lib/sup/person.rb
index 4b1c80b..dbedc79 100644
--- a/lib/sup/person.rb
+++ b/lib/sup/person.rb
@@ -105,6 +105,10 @@ class Person
 
   def self.from_address_list ss
     return [] if ss.nil?
+    ## #split_on_commas has some bad behavior for long strings. so here we do
+    ## something nasty and just truncate the string at the nearest comma <= 500
+    ## characters.
+    ss = ss[0, ss.rindex(",", 500)] if ss.length > 500
     ss.split_on_commas.map { |s| self.from_address s }
   end
 
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk