`make check' hangs, when the source directory is read-only

Hello!

I’m building platform-specific Ruby-binaries (1.8.7-p174) for each of
our several platforms based on a single source-code directory, that’s
available read-only.

The build is fine (except in the win32ole directory, which I had to
remove). `make test’ succeeds:

:/tmp/ruby-1.8.7-p174-x86_64-pc-linux-gnu (203) make test

test succeeded

However, when I try to `make check’, I get:

:/tmp/ruby-1.8.7-p174-x86_64-pc-linux-gnu (204) make check

test succeeded
./miniruby -I/src/PUBruby/ruby-1.8.7-p174/lib -I.ext/common -I./-
-r/src/PUBruby/ruby-1.8.7-p174/ext/purelib.rb
/src/PUBruby/ruby-1.8.7-p174/runruby.rb --extout=.ext –
“/src/PUBruby/ruby-1.8.7-p174/test/runner.rb”
–basedir="/src/PUBruby/ruby-1.8.7-p174/test" --runner=console

Launching `top’ in another window I can see the ruby process spinning…
I left it running for 3 hours, and it accumulated 3 hours of CPU time…

Please, advise. Thanks!

I’m building platform-specific Ruby-binaries (1.8.7-p174) for each of
our several platforms based on a single source-code directory, that’s
available read-only.

Actually, never mind… Something else must be wrong. I copied the
source tree locally and ran the build there – the most vanilla way to
build things.

`make check’ – as well as a single random test – still spins…

Running under strace shows:

strace ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb
./runruby.rb --extout=.ext – “./test/runner.rb” --basedir="./test"
test/soap/test_basetype.rb

lots of output

open("/tmp/ruby-1.8.7-p174-x86_64-pc-linux-gnu/test/soap/test_basetype.rb",
O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=27077, …}) = 0
close(3) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
open("/tmp/ruby-1.8.7-p174-x86_64-pc-linux-gnu/test/soap/test_basetype.rb",
O_RDONLY) = 3
close(3) = 0
open("/tmp/ruby-1.8.7-p174-x86_64-pc-linux-gnu/test/soap/test_basetype.rb",
O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=27077, …}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2b1f51586000
read(3, “require ‘test/unit’\nrequire 'soa”…, 4096) = 4096
read(3, “34567890123456789012345678901234”…, 4096) = 4096
<- HANG ->

This is on an RHEL-5.4 machine (RedHat’s own older version of Ruby NOT
installed), x86_64. The configure was run thus:

env CC=gcc44 CFLAGS="-O2 -pipe -march=nocona" ./configure
–prefix=/usr/local/pub/ruby__1.8.7-p174
–mandir=/usr/local/pub/ruby__1.8.7-p174/man --enable-pthread
–disable-install-doc

The C-compiler (gcc44) is gcc version 4.4.0 20090514 (Red Hat 4.4.0-6)
(GCC).

Міхаіл Т. wrote:

The C-compiler (gcc44) is gcc version 4.4.0 20090514 (Red Hat 4.4.0-6)
(GCC).

Simply recompiling from scratch using gcc-4.1.2 solved the hanging
problem for me. The check is now running (outputting a dot as
progress-report).

Alternatively, using gcc-4.4.0, but with less aggressive optimization
(-O1 instead of -O2) avoids the problem as well.

Increasing the compiler warnings level (-Wall), one can see a lot of
negative comments, including a bunch of strict-aliasing violations…

Indeed, this was is already discussed in:

https://bugzilla.redhat.com/show_bug.cgi?id=489990

The bug is in Ruby…

The work-around is to disable strict-aliasing, when compiling. For gcc
users, this is done with -fno-strict-aliasing after the -O2 optimization
flag (see attached patch).

After rebuilding this way, I can get `make check’ to start and proceed
(the errors it reports now are the same as with other compilers and
platforms).

Other (non-gcc) compilers are on their own…

    -mi