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

Re: [sup-devel] use-console-gem branch



William Morgan, 2011-01-23 06:30:
> If anyone wants to give it a go, I'd love to hear your
> results. Please report Ruby version and OS as well.

Debian 5.0.8
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

--- NoMethodError from thread: load threads for thread-index-mode
undefined method `force_encoding' for nil:NilClass
/home/terotil/src/sup/lib/sup/person.rb:18:in `force_encoding'
/home/terotil/src/sup/lib/sup/message.rb:154:in `load_from_index!'
/home/terotil/src/sup/lib/sup/message.rb:154:in `map'
/home/terotil/src/sup/lib/sup/message.rb:154:in `load_from_index!'
/home/terotil/src/sup/lib/sup/index.rb:219:in `build_message'
/home/terotil/src/sup/lib/sup/index.rb:155:in `each_id_by_date'
/home/terotil/src/sup/lib/sup/thread.rb:338:in `call'
/home/terotil/src/sup/lib/sup/thread.rb:338:in `load_n_threads'
/home/terotil/src/sup/lib/sup/index.rb:155:in `each_id_by_date'
/home/terotil/src/sup/lib/sup/index.rb:250:in `each_id'
/home/terotil/src/sup/lib/sup/index.rb:250:in `each'
/home/terotil/src/sup/lib/sup/index.rb:250:in `each_id'
/home/terotil/src/sup/lib/sup/index.rb:155:in `each_id_by_date'
/home/terotil/src/sup/lib/sup/thread.rb:334:in `load_n_threads'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:640:in `__unprotected_load_n_threads'
(eval):12:in `load_n_threads'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:624:in `load_n_threads_background'
/home/terotil/src/sup/lib/sup.rb:81:in `reporting_thread'
/home/terotil/src/sup/lib/sup.rb:79:in `initialize'
/home/terotil/src/sup/lib/sup.rb:79:in `new'
/home/terotil/src/sup/lib/sup.rb:79:in `reporting_thread'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:623:in `load_n_threads_background'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:694:in `__unprotected_load_threads'
(eval):12:in `load_threads'
/home/terotil/src/sup/bin/sup:195

This was due to Person#name being set to nil on some cases.  I got rid
of it like this

diff --git a/lib/sup/person.rb b/lib/sup/person.rb
index ee23fc5..83fc60f 100644
--- a/lib/sup/person.rb
+++ b/lib/sup/person.rb
@@ -9,6 +9,8 @@ class Person
     @name = if name
       name = name.strip.gsub(/\s+/, " ")
       name =~ /^(['"]\s*)(.*?)(\s*["'])$/ ? $2 : name
+    else
+      ""
     end

     @email = email.strip.gsub(/\s+/, " ").downcase
@@ -103,7 +105,7 @@ class Person
       when /((\S+?)@\S+)/
         [$2, $1]
       else
-        [nil, s]
+        ["", s]
       end

     Person.new name, email

Only to have it crash later on.  ;)

--- ArgumentError from thread: load threads for thread-index-mode
malformed string: invalid multibyte character at position 79
/usr/lib/ruby/gems/1.8/gems/console-0.3/lib/console/string.rb:27:in `display_width'
/usr/lib/ruby/gems/1.8/gems/console-0.3/lib/console/string.rb:27:in `display_width'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:226:in `draw_line_from_array'
/home/terotil/src/sup/lib/sup/util.rb:608:in `each_with_index'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:224:in `each'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:224:in `each_with_index'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:224:in `draw_line_from_array'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:199:in `draw_line'
/home/terotil/src/sup/lib/sup/modes/line-cursor-mode.rb:52:in `draw_line'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:46:in `draw'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:46:in `each'
/home/terotil/src/sup/lib/sup/modes/scroll-mode.rb:46:in `draw'
/home/terotil/src/sup/lib/sup/modes/line-cursor-mode.rb:37:in `draw'
/home/terotil/src/sup/lib/sup/buffer.rb:119:in `draw'
/home/terotil/src/sup/lib/sup/buffer.rb:103:in `redraw'
/home/terotil/src/sup/lib/sup/buffer.rb:336:in `draw_screen'
/home/terotil/src/sup/lib/sup/buffer.rb:766:in `clear'
/home/terotil/src/sup/lib/sup/util.rb:611:in `send'
/home/terotil/src/sup/lib/sup/util.rb:611:in `method_missing'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:653:in `__unprotected_load_n_threads'
(eval):12:in `load_n_threads'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:624:in `load_n_threads_background'
/home/terotil/src/sup/lib/sup.rb:81:in `reporting_thread'
/home/terotil/src/sup/lib/sup.rb:79:in `initialize'
/home/terotil/src/sup/lib/sup.rb:79:in `new'
/home/terotil/src/sup/lib/sup.rb:79:in `reporting_thread'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:623:in `load_n_threads_background'
/home/terotil/src/sup/lib/sup/modes/thread-index-mode.rb:694:in `__unprotected_load_threads'
(eval):12:in `load_threads'
/home/terotil/src/sup/bin/sup:195

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel