Problem building Ruby 1.8.2-rc with pthread on HPUX

A

Alexey Verkhovsky

I was trying to build Ruby 1.8.2 on HPUX today. Simple "./configure;
make" works fine. However, when I try to make it with --enable-pthread,
bootstrap Ruby (make calls it "miniruby") throws SIGBUS.

It goes like this:

QTE shell session (prompt replaced with >)
HP-UX hppc701 B.11.11 U 9000/800 ...
model 9000/800/rp7410

configure --enable-pthread --prefix=${HOME}/ruby
...skipped...configure finishes successfully...
make clean; make
...compilation of all .c sources goes without errors...
/fetuser1.pc701/fet/tst/alexeyv/ruby-1.8.2/lib/shellwords.rb:50: [BUG]
Bus Error
ruby 1.8.2 (2004-07-16) [hppa2.0w-hpux11.11]

sh: 16258 Abort(coredump)
*** Error exit code 134
UNQTE

If I drop --enable-pthread from ./configure options, then the build
succeeds. Unfortunately, without pthread DBD driver for Oracle crashes
because it is linked with pthread, and on HPUX (like on most other
Unixes) the main binary (ruby/bin/ruby in this case) must be linked with
pthread if it uses shared libraries dependent on it.

The Ruby code where SIGBUS is reported looks like this:

QTE shell session
less -N shellwords.rb

22 #
23 # Split text into an array of tokens in the same way the UNIX
Bourne
24 # shell does.
25 #
26 # See the +Shellwords+ module documentation for an example.
27 #
28 def shellwords(line)
29 line = String.new(line) rescue
30 raise(ArgumentError, "Argument must be a string")
31 line.lstrip!
32 words = []
33 until line.empty?
34 field = ''
35 loop do
36 if line.sub!(/\A"(([^"\\]|\\.)*)"/, '') then
37 snippet = $1.gsub(/\\(.)/, '\1')
38 elsif line =~ /\A"/ then
39 raise ArgumentError, "Unmatched double quote: #{line}"
40 elsif line.sub!(/\A'([^']*)'/, '') then
41 snippet = $1
42 elsif line =~ /\A'/ then
43 raise ArgumentError, "Unmatched single quote: #{line}"
44 elsif line.sub!(/\A\\(.)/, '') then
45 snippet = $1
46 elsif line.sub!(/\A([^\s\\'"]+)/, '') then
47 snippet = $1
48 else
49 line.lstrip!
50 break <<<<<<<<<<<<<<<<<<<<<<<<< Bus Error happens
here (???)
51 end
52 field.concat(snippet)
53 end
54 words.push(field)
55 end
56 words
57 end
UNQTE

Can anyone shed some light on this, or have I encountered something
previously unknown?

Best regards,
Alexey Verkhovsky
 
A

Alexey Verkhovsky

I was trying to build Ruby 1.8.2 on HPUX today. Simple "./configure;
make" works fine. However, when I try to make it with --enable-pthread,
bootstrap Ruby (make calls it "miniruby") throws SIGBUS.

I still have no luck with this story. By now this list is my last hope,
else I have to go back to Tcl :(((

Some more details on the problem:

1. Ruby 1.8.1 behaves the same as 1.8.2-rc

2. Here is the stack trace at the time of SIGBUS:
gdb miniruby core
HP gdb 3.1 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.
..
Core was generated by `miniruby'.
Program terminated with signal 6, Aborted.

(gdb) where
#0 0xc020c718 in kill+0x10 () from /usr/lib/libc.2
#1 0xc01a6de4 in raise+0x24 () from /usr/lib/libc.2
#2 0xc01e7348 in abort_C+0x160 () from /usr/lib/libc.2
#3 0xc01e73a4 in abort+0x1c () from /usr/lib/libc.2
#4 0x5f4ec in rb_bug (fmt=0x149dc8 "Bus Error") at error.c:199
#5 0xd5180 in sigbus (sig=10) at signal.c:409
#6 <signal handler called>
#7 0x23080 in rb_eval (self=1074818488, n=0x40107328) at eval.c:2825
#8 0x21a00 in rb_eval (self=1761613200, n=0x2) at eval.c:2532
#9 0x2b464 in rb_yield_0 (val=6, self=1074818488, klass=0, flags=0,
avalue=0) at eval.c:4337
#10 0x2b720 in rb_f_loop () at eval.c:4394
#11 0x2e174 in call_cfunc (func=0x400064b2 <rb_f_loop>, recv=1074818488,
len=0, argc=0, argv=0x0) at eval.c:4935
#12 0x2efcc in rb_call0 (klass=1074091120, recv=1074818488, id=3937,
oid=3937, argc=0, argv=0x0, body=0x400533a0, nosuper=0)
at eval.c:5066
#13 0x30134 in rb_call (klass=1074091120, recv=1074818488, mid=3937,
argc=0, argv=0x0, scope=1) at eval.c:5287
#14 0x24ce4 in rb_eval (self=1074818488, n=0x40107118) at eval.c:3091
#15 0x22e5c in rb_eval (self=Cannot access memory at address 0xffffd9dc
) at eval.c:2796
Cannot access memory at address 0xffffd9ec
(gdb)

3. Miniruby actually works (to some extent)
miniruby -e "puts 'aaa'"
aaa

4. With a few debug prints added to the lib/shellwords.rb:
Original input= ''--enable-shared' '--enable-pthread'
Begin iteration. Line= ''--enable-shared' '--enable-pthread'
Begin iteration. Line= ' '--enable-pthread'

Just before SIGBUS line= ''--enable-pthread'

{$HOME}/ruby-1.8.1/lib/shellwords.rb:53: [BUG] Bus Error
ruby 1.8.1 (2003-12-25) [hppa2.0w-hpux11.11]

sh: 5684 Abort(coredump)
*** Error exit code 134

The SIGBUS happens when executing break statement immediately after puts
"Just before SIGBUS"

I've searched through ruby-talk archives and tried adding -Aa and/or
-D_HPUX_SOURCES flags to CFLAGS. This doesn't help.

If I configure without --enable-pthread, everything builds and works
fine and dandy.

SOS

Best regards,
Alexey Verkhovsky
 
A

Austin Ziegler

I was trying to build Ruby 1.8.2 on HPUX today. Simple "./configure;
make" works fine. However, when I try to make it with --enable-pthread,
bootstrap Ruby (make calls it "miniruby") throws SIGBUS.

As far as I can tell, I'm experiencing the same thing.

-austin
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top