[BUG] unknown node type 0 in 1.8.0

Hi,

I think I discovered a bug in Ruby 1.8.0:

uehli@ueh-h bug2 $ ruby -v
ruby 1.8.0 (2003-01-27) [i686-linux]

uehli@ueh-h bug2 $ ruby extconf.rb
[BUG] unknown node type 0
ruby 1.8.0 (2003-01-27) [i686-linux]
Aborted

The executed script is the (slightly modified) extconf.rb of the Ruby OpenGL
extension. I tried to narrow down the bug but as soon as I comment a single
line of the source out the bug seems to disappear.

So here is the script (sorry for the length!):

extconf.rb

···

==========================================

$Date: 2001/12/01 05:24:58 $

$Author: yoshi $

require “rbconfig”
Config::CONFIG.each do |k,v| Config::MAKEFILE_CONFIG[k] = v.dup end
require “mkmf”

gl_libname = “”
glu_libname = “”
glut_libname = “”

modules = “”
ogl_flg = false
glut_flg = false

File.unlink(“Makefile”) if (FileTest.exist? “Makefile”)
File.unlink(“Makefile.ogl”) if (FileTest.exist? “Makefile.ogl”)
File.unlink(“Makefile.glut”) if (FileTest.exist? “Makefile.glut”)

if (/cygwin/ =~ PLATFORM)
$CFLAGS=“-DWIN32”
gl_libname = “opengl32”
glu_libname = “glu32”
glut_libname = “glut32”
elsif (/mswin32/ =~ PLATFORM)
$CFLAGS=“-DWIN32”
gl_libname = “opengl32”
glu_libname = “glu32”
glut_libname = “glut32”
else
$CFLAGS += " -I."

dir_config(“x11”, “/usr/X11R6”)

$libs = append_library($libs, “Xmu”)
$libs = append_library($libs, “X11”)
gl_libname = “GL”
glu_libname = “GLU”
glut_libname = “glut”
end

$objs = [“glu.o”, “ogl.o”, “rbogl.o”]
#have_library(“pthread”, “pthread_create”)
(have_library(gl_libname, “glEnd”) || have_library(“Mesa”+gl_libname, nil)) &&
(have_library(glu_libname, “gluDisk”) || have_library(“Mesa”+glu_libname,
nil)) &&
create_makefile(“opengl”)
if (FileTest.exist? “Makefile”)
open(“Makefile”) {|f|
open(“Makefile.ogl”, “w”) {|wfile|
wfile.write(f.read)
}
}
File.unlink(“Makefile”)
modules = modules + “opengl.#{CONFIG[‘DLEXT’]}”
ogl_flg = true
else
p “can’t create OpenGL module!”
exit 1
end

$objs = [“glut.o”]
have_library(“Xi”, “XAllowDeviceEvents”) &&
have_library(“Xext”, “XMITMiscGetBugMode”) &&
have_library(“Xmu”, “XmuAddCloseDisplayHook”)
have_library(glut_libname, nil) &&
create_makefile(“glut”)
if (FileTest.exist? “Makefile”)
open(“Makefile”) {|f|
open(“Makefile.glut”, “w”) {|wfile|
wfile.write(f.read)
}
}
File.unlink(“Makefile”)
modules = "glut.#{CONFIG[‘DLEXT’]} " + modules
glut_flg = true
end

open(“Makefile”, “w”) {|f|
f.write <<“MAKEFILE”
SHELL = /bin/sh
all: #{modules}

opengl.#{CONFIG[‘DLEXT’]}: rbogl.c ogl.c glu.c rbogl.h
@echo Now Making opengl extend module
@$(MAKE) -f Makefile.ogl

glut.#{CONFIG[‘DLEXT’]}: glut.c
@echo Now Making glut extend module
@$(MAKE) -f Makefile.glut

clean:
@rm -f *.o *.so *.sl *.a
@rm -f $(TARGET).lib $(TARGET).exp
@rm -f core ruby$(EXEEXT) ~
@rm -f Makefile.ogl Makefile.glut
@rm -f Makefile extconf.h conftest.

install: #{modules}
#{“\t@$(MAKE) -f Makefile.ogl install” if (ogl_flg)}
#{“\t@$(MAKE) -f Makefile.glut install” if (glut_flg)}

site-install: #{modules}
#{“\t@$(MAKE) -f Makefile.ogl site-install” if (ogl_flg)}
#{“\t@$(MAKE) -f Makefile.glut site-install” if (glut_flg)}
MAKEFILE
}

==========================================

Note that there must be EXACTLY 2 empty lines at the end (as above), else the
bug disappears too.

Here is the stack trace:

(gdb) info stack
#0 0x400a1031 in kill () from /lib/libc.so.6
#1 0x400a0c28 in raise () from /lib/libc.so.6
#2 0x400a272b in abort () from /lib/libc.so.6
#3 0x080c7829 in rb_bug (fmt=0x0) at error.c:174
#4 0x08058a51 in rb_eval (self=1075661308, n=0x0) at eval.c:3427
#5 0x0805b7d3 in rb_call0 (klass=1075666208, recv=1075661308, id=9865, oid=0,
argc=0, argv=0xbfffeb70, body=0x4022dce0, nosuper=0) at eval.c:4743
#6 0x0805bd51 in rb_call (klass=1075666208, recv=1075661308, mid=9865,
argc=2, argv=0xbfffeb68, scope=1) at eval.c:4833
#7 0x08056de2 in rb_eval (self=1075661308, n=0x0) at eval.c:2789
#8 0x080554f0 in rb_eval (self=1075661308, n=0x0) at eval.c:2251
#9 0x08053446 in ruby_exec () at eval.c:1314
#10 0x08053484 in ruby_run () at eval.c:1335
#11 0x080514f5 in main (argc=0, argv=0x0, envp=0xbffff760) at main.c:50
#12 0x4008ce34 in __libc_start_main () from /lib/libc.so.6

I could reproduce the bug on two Linux boxes and it’s not the first time I ran
into that bug but I could not get hold of that nasty thing before.

Thanks for your help.
– Thomas

Hi,

···

In message “[BUG] unknown node type 0 in 1.8.0” on 03/01/31, Thomas Uehlinger uehli@bluewin.ch writes:

The executed script is the (slightly modified) extconf.rb of the Ruby OpenGL
extension. I tried to narrow down the bug but as soon as I comment a single
line of the source out the bug seems to disappear.

So here is the script (sorry for the length!):

Could you show me where to get the whole extension source?
I’m working on it, but can’t reproduce your error so far.

						matz.

It’s from dfltweb1.onamae.com – このドメインはお名前.comで取得されています。. But keep in mind
that I modified the extconf.rb!!
Additionally, I don’t think that will be of much help for you because the bug
also occurs if I copy the extconf.rb to an empty directory.
As far as I can tell from my limited experience it’s likely a bug in the
parser or in the process of AST-walking, considering that the bug also
occured for completely different scripts (sorry I did not keep them!).

–Thomas

···

On Friday 31 January 2003 10:06, Yukihiro Matsumoto wrote:

on 03/01/31, Thomas Uehlinger <uehli@bluewin.ch> writes:

The executed script is the (slightly modified) extconf.rb of the Ruby
OpenGL extension. I tried to narrow down the bug but as soon as I comment
a single line of the source out the bug seems to disappear.

So here is the script (sorry for the length!):

Could you show me where to get the whole extension source?
I’m working on it, but can’t reproduce your error so far.