Subject: [sup-talk] Sup won't start after upgrade to ruby 1.8.7

From: [email-masked] (Benjamin Kircher)
Date: Tue, 3 Jun 2008 13:05:46 +0200

Hi there,

got an exception, which is attached. I'm running the git master branch on a
Debian sid box. Today ruby and libncurses5 got updated and Sup won't start
anymore.

Please let me know if I can provide more information.

Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20080603/90330e6f/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: exception-log.txt
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20080603/90330e6f/attachment.txt>

---

From: [email-masked] (William Morgan)
Date: Tue, 03 Jun 2008 19:57:58 -0700

Reformatted excerpts from Benjamin Kircher's message of 2008-06-03:
> got an exception, which is attached. I'm running the git master branch
> on a Debian sid box. Today ruby and libncurses5 got updated and Sup
> won't start anymore.

Gah. This doesn't even make any sense:

> --- ArgumentError from thread: main
> wrong number of arguments (2 for 1)
> /home/benjamin/projects/sup/lib/sup/index.rb:422:in `respond_to?'
> /home/benjamin/projects/sup/lib/sup/index.rb:422:in `flatten'

There's no call to respond_to? in there.

I guess I should download 1.8.7 and see what they've done. Maybe Hash.[]
has changed?
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (zak kriner)
Date: Wed, 11 Jun 2008 12:21:15 -0400

After googling around, looks like ruby 1.8.7 includes an optional
argument to change the Array.flatten depth
<http://www.rubyinside.com/ruby-187-released-912.html>. The default
behavior looks like it should be the same as 1.8.6, but I get the same
error as Benjamin. Patch below restores something similar to the old
behavior, which get things up and running again on my setup
(debian/sid).

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index ceaf0b8..37c26b0 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -399,6 +399,20 @@ class Array

   def to_boolean_h; Hash[*map { |x| [x, true] }.flatten]; end

+  if RUBY_VERSION == '1.8.7'
+    def flatten
+      ret = []
+      self.each do |o|
+        if o.is_a?(Array)
+          ret.push(*(o.flatten))
+        else
+          ret << o
+        end
+      end
+      ret
+    end
+  end
+
   def last= e; self[-1] = e end
   def nonempty?; !empty? end
 end

On Tue, Jun 3, 2008 at 10:57 PM, William Morgan
<wmorgan-sup at masanjin.net> wrote:
> _______________________________________________
> sup-talk mailing list
> sup-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-talk