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 >)
> uname -a
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