Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] respond_to? needs include_private argument
@ 2008-06-18 20:25 Decklin Foster
  2008-06-18 22:21 ` Richard Heycock
  2008-06-19 17:55 ` William Morgan
  0 siblings, 2 replies; 4+ messages in thread
From: Decklin Foster @ 2008-06-18 20:25 UTC (permalink / raw)


Sup started mysteriously bailing out on me today after an apt-get
update with stuff like this:

--- ArgumentError from thread: main
wrong number of arguments (2 for 1)
/usr/lib/ruby/1.8/sup/index.rb:424:in `respond_to?'
/usr/lib/ruby/1.8/sup/index.rb:424:in `flatten'
/usr/lib/ruby/1.8/sup/index.rb:424:in `load_sources'
/usr/lib/ruby/1.8/sup/index.rb:108:in `load'
/usr/lib/ruby/1.8/sup/util.rb:497:in `send'
/usr/lib/ruby/1.8/sup/util.rb:497:in `method_missing'
/usr/bin/sup:122

I did some digging and it seems like when Array#flatten, in attempting
to figure out if it can flatten some list element recursively, sends
it :respond_to? with both arguments -- I didn't even know there was a
second one (defaults to false; see docs). But this only happened recently
or something.

Here's somewhere else this came up:
http://www.ruby-forum.com/topic/154938

So, the fix is exactly the same. Should work fine on old Ruby as well.
Weep for our poor one-liner methods; they just weren't cut out for this
harsh world...

Also: Hi everyone. I am the future Debian maintainer of sup.

---
 lib/sup/util.rb |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index ceaf0b8..9909022 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -108,7 +108,9 @@ class Module
   def defer_all_other_method_calls_to obj
     class_eval %{
       def method_missing meth, *a, &b; @#{obj}.send meth, *a, &b; end
-      def respond_to? meth; @#{obj}.respond_to?(meth); end
+      def respond_to?(m, include_private = false)
+        @#{obj}.respond_to?(m, include_private)
+      end
     }
   end
 end
@@ -527,7 +529,9 @@ class Recoverable
   def to_yaml x; __pass :to_yaml, x; end
   def is_a? c; @o.is_a? c; end
 
-  def respond_to? m; @o.respond_to? m end
+  def respond_to?(m, include_private=false)
+    @o.respond_to?(m, include_private)
+  end
 
   def __pass m, *a, &b
     begin
-- 
1.5.5.3


-- 
Decklin Foster <dfoster at wjh.harvard.edu>
1208 William James Hall - Affective Neuroscience Lab
806 WJH, Social Neuroscience and Psychopathology Lab
Home: decklin at red-bean.com / Mobile: +1 860 978 4848


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

* [sup-talk] [PATCH] respond_to? needs include_private argument
  2008-06-18 20:25 [sup-talk] [PATCH] respond_to? needs include_private argument Decklin Foster
@ 2008-06-18 22:21 ` Richard Heycock
  2008-06-19  0:35   ` Richard Heycock
  2008-06-19 17:55 ` William Morgan
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Heycock @ 2008-06-18 22:21 UTC (permalink / raw)


Are you using ruby 1.8.7? I found this.

rgh

Excerpts from Decklin Foster's message of Thu Jun 19 06:25:56 +1000 2008:
> Sup started mysteriously bailing out on me today after an apt-get
> update with stuff like this:
> 
> --- ArgumentError from thread: main
> wrong number of arguments (2 for 1)
> /usr/lib/ruby/1.8/sup/index.rb:424:in `respond_to?'
> /usr/lib/ruby/1.8/sup/index.rb:424:in `flatten'
> /usr/lib/ruby/1.8/sup/index.rb:424:in `load_sources'
> /usr/lib/ruby/1.8/sup/index.rb:108:in `load'
> /usr/lib/ruby/1.8/sup/util.rb:497:in `send'
> /usr/lib/ruby/1.8/sup/util.rb:497:in `method_missing'
> /usr/bin/sup:122
> 
> I did some digging and it seems like when Array#flatten, in attempting
> to figure out if it can flatten some list element recursively, sends
> it :respond_to? with both arguments -- I didn't even know there was a
> second one (defaults to false; see docs). But this only happened recently
> or something.
> 
> Here's somewhere else this came up:
> http://www.ruby-forum.com/topic/154938
> 
> So, the fix is exactly the same. Should work fine on old Ruby as well.
> Weep for our poor one-liner methods; they just weren't cut out for this
> harsh world...
> 
> Also: Hi everyone. I am the future Debian maintainer of sup.
> 
> ---
>  lib/sup/util.rb |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/sup/util.rb b/lib/sup/util.rb
> index ceaf0b8..9909022 100644
> --- a/lib/sup/util.rb
> +++ b/lib/sup/util.rb
> @@ -108,7 +108,9 @@ class Module
>    def defer_all_other_method_calls_to obj
>      class_eval %{
>        def method_missing meth, *a, &b; @#{obj}.send meth, *a, &b; end
> -      def respond_to? meth; @#{obj}.respond_to?(meth); end
> +      def respond_to?(m, include_private = false)
> +        @#{obj}.respond_to?(m, include_private)
> +      end
>      }
>    end
>  end
> @@ -527,7 +529,9 @@ class Recoverable
>    def to_yaml x; __pass :to_yaml, x; end
>    def is_a? c; @o.is_a? c; end
>  
> -  def respond_to? m; @o.respond_to? m end
> +  def respond_to?(m, include_private=false)
> +    @o.respond_to?(m, include_private)
> +  end
>  
>    def __pass m, *a, &b
>      begin

-- 
+61 (0) 410 646 369
[e]:  rgh at neoss.com.au
[im]: rgh at jabber.org

You're worried criminals will continue to penetrate into cyberspace, and
I'm worried complexity, poor design and mismanagement will be there to meet
them - Marcus Ranum


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

* [sup-talk] [PATCH] respond_to? needs include_private argument
  2008-06-18 22:21 ` Richard Heycock
@ 2008-06-19  0:35   ` Richard Heycock
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Heycock @ 2008-06-19  0:35 UTC (permalink / raw)


Please disregard my last. I really mustn't reply to emails before my morning
coffee!

rgh

<snip>

-- 
+61 (0) 410 646 369
[e]:  rgh at neoss.com.au
[im]: rgh at jabber.org

You're worried criminals will continue to penetrate into cyberspace, and
I'm worried complexity, poor design and mismanagement will be there to meet
them - Marcus Ranum


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

* [sup-talk] [PATCH] respond_to? needs include_private argument
  2008-06-18 20:25 [sup-talk] [PATCH] respond_to? needs include_private argument Decklin Foster
  2008-06-18 22:21 ` Richard Heycock
@ 2008-06-19 17:55 ` William Morgan
  1 sibling, 0 replies; 4+ messages in thread
From: William Morgan @ 2008-06-19 17:55 UTC (permalink / raw)


Reformatted excerpts from Decklin Foster's message of 2008-06-18:
> I did some digging and it seems like when Array#flatten, in attempting
> to figure out if it can flatten some list element recursively, sends
> it :respond_to? with both arguments -- I didn't even know there was a
> second one (defaults to false; see docs). But this only happened recently
> or something.

That makes sense. Either the second argument, or the fact that
Array#flatten uses both arguments, is what's changed in 1.8.7.

I've merged the patch directly into master.

> Also: Hi everyone. I am the future Debian maintainer of sup.

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


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

end of thread, other threads:[~2008-06-19 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-18 20:25 [sup-talk] [PATCH] respond_to? needs include_private argument Decklin Foster
2008-06-18 22:21 ` Richard Heycock
2008-06-19  0:35   ` Richard Heycock
2008-06-19 17:55 ` William Morgan

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