[BUG] takes -1, not 0, arguments

R

Ramzi Ferchichi

Hi,
I got this bug on my system running Ubuntu (breezy):

/usr/lib/ruby/1.8/date/format.rb:598: [BUG] unknown node type 0
ruby 1.8.3 (2005-06-23) [i486-linux]

Tested the same code with ruby 1.8.2 (2004-12-25) [sparc-solaris2.9]
and got the following instead:

1) Error:
test_correct_login_event(TC_POSPresenter):
RuntimeError: POSModel::manager? takes -1, not 0, arguments
./test/mockposmodel.rb:34:in `method_missing'
./lib/pospresenter.rb:127:in `update'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:184:in `each'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'
./test/mockposview.rb:111:in `raise_login_event'
./test/tc_pospresenter.rb:301:in `test_correct_login_event'

I saw that the "node type 0" bug had been reported several times but
did not find anything on the second error message (takes -1, not 0,
arguments). Wanted to report this in case the second error message
could give further information about the bug.
 
T

Tanaka Akira

Ramzi Ferchichi said:
I got this bug on my system running Ubuntu (breezy):

/usr/lib/ruby/1.8/date/format.rb:598: [BUG] unknown node type 0
ruby 1.8.3 (2005-06-23) [i486-linux]

Although the bug is too hard to fix without a script to reproduce it,
following patch may show bit more information.

Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.616.2.114
diff -u -p -r1.616.2.114 eval.c
--- eval.c 29 Jul 2005 01:00:07 -0000 1.616.2.114
+++ eval.c 30 Jul 2005 03:13:02 -0000
@@ -2806,7 +2806,15 @@ unknown_node(node)
NODE *volatile node;
{
ruby_current_node = 0;
- rb_bug("unknown node type %d", nd_type(node));
+ if (node->flags == 0) {
+ rb_bug("terminated node (0x%lx)", node);
+ }
+ else if (BUILTIN_TYPE(node) != T_NODE) {
+ rb_bug("not a node 0x%02lx (0x%lx)", BUILTIN_TYPE(node), node);
+ }
+ else {
+ rb_bug("unknown node type %d (0x%lx)", nd_type(node), node);
+ }
}

static VALUE
 
D

Daniel Berger

Ramzi said:
Hi,
I got this bug on my system running Ubuntu (breezy):

/usr/lib/ruby/1.8/date/format.rb:598: [BUG] unknown node type 0
ruby 1.8.3 (2005-06-23) [i486-linux]

Tested the same code with ruby 1.8.2 (2004-12-25) [sparc-solaris2.9]
and got the following instead:

1) Error:
test_correct_login_event(TC_POSPresenter):
RuntimeError: POSModel::manager? takes -1, not 0, arguments
./test/mockposmodel.rb:34:in `method_missing'
./lib/pospresenter.rb:127:in `update'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:184:in `each'
/home/olda9867/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'
./test/mockposview.rb:111:in `raise_login_event'
./test/tc_pospresenter.rb:301:in `test_correct_login_event'

I saw that the "node type 0" bug had been reported several times but
did not find anything on the second error message (takes -1, not 0,
arguments). Wanted to report this in case the second error message
could give further information about the bug.

Can you show us the code please?

Dan
 
O

olof sivertsson

I worked with the thread creator when we got this error. Later we
realized that the output in the case when it does not crash ("takes
-1, not 0, arguments") is of course (a bug) from our own code. Oops...

The weird thing is that the crash only occurs on his Ubuntu (breezy)
laptop and not on my Ubuntu (breezy) installation at home or our
Solaris workstations.

Anyway, thanks for the patch, we shall try to find time to test it.

-Olof


Ramzi Ferchichi said:
I got this bug on my system running Ubuntu (breezy):

/usr/lib/ruby/1.8/date/format.rb:598: [BUG] unknown node type 0
ruby 1.8.3 (2005-06-23) [i486-linux]
=20
Although the bug is too hard to fix without a script to reproduce it,
following patch may show bit more information.
=20
Index: eval.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /src/ruby/eval.c,v
retrieving revision 1.616.2.114
diff -u -p -r1.616.2.114 eval.c
--- eval.c 29 Jul 2005 01:00:07 -0000 1.616.2.114
+++ eval.c 30 Jul 2005 03:13:02 -0000
@@ -2806,7 +2806,15 @@ unknown_node(node)
NODE *volatile node;
{
ruby_current_node =3D 0;
- rb_bug("unknown node type %d", nd_type(node));
+ if (node->flags =3D=3D 0) {
+ rb_bug("terminated node (0x%lx)", node);
+ }
+ else if (BUILTIN_TYPE(node) !=3D T_NODE) {
+ rb_bug("not a node 0x%02lx (0x%lx)", BUILTIN_TYPE(node), node);
+ }
+ else {
+ rb_bug("unknown node type %d (0x%lx)", nd_type(node), node);
+ }
}
=20
static VALUE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top