[DRE-maint] Bug#533304: rubygems1.8: "gem install" calls "make" on a broken Makefile

Andreas Krüger andreas.krueger at famsik.de
Wed Jun 17 13:35:14 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello, Diago

>> It is not the problem of Debian's rubygems.

I have not investigated this throughly, but I agree / my guess is this is
probably not a specific Debian problem, but upstream.

>> Since Debian is not darwin, the Makefile provided by the gem won't work.

It seems to be more complicated than that. I've done some three experiments:

To set these experiments up, I verify I can do both "gem uninstall sqlite3-ruby"
and "gem install sqlite3-ruby" with no problem. I also utilized a crude little
script to keep track of the Makefile (attached below).

First experiment: Trigger a successful "install".

Result: As far as observed via my script, the Makefile gets written twice. First
with the wrong "darwin" information. Some time later, it gets rewritten
extensively. Among other things, the "darwin" information is replaced with
"i486-linux" information.

For the second experiment, I deviously moved /usr/lib/ruby/1.8/i486-linux/ruby.h
out of the way.

Result: Of course, this causes "gem install sqlite3-ruby" to fail.

With the error message: "mkmf.rb can't find header files for ruby at
/usr/lib/ruby/ruby.h".

Wrong. This should really point to /usr/lib/ruby/1.9/i486-linux/ruby.h.

For the record: The Makefile still has the "darwin" version, it has not yet been
updated to "i486-linux".

In preparation for the third experiment, I repair
/usr/lib/ruby/1.8/i486-linux/ruby.h and check the gem now installs (it does),
and, of course, again uninstall it.

For the third experiment, "aptitude purge libsqlite3-dev" removes header files
required by "gem install sqlite3-ruby". Those out of the way, I again fire up
"gem install sqlite3-ruby".

Chaos results. The correct Makefile never gets written, what's on the disk is
still the "darwin" one. But the really bad part of this story: "make" is called
on this wrong-system "darwin" Makefile!

A rather confusing error message results:

> /usr/bin/ruby1.8 extconf.rb install sqlite3-ruby
> checking for fdatasync() in -lrt... yes
> checking for sqlite3.h... no
>
> make
> make: *** No rule to make target `ruby.h', needed by `sqlite3_api_wrap.o'.
> Stop.

In my opinion:

* "make" should never get called on a Makefile which gem could not properly
adjust to the system.

* This is buggy error handling on the part of "gem". (Probably upstream, but
that is only a guess.)

* Less importantly: If gem knows it needs to do a second write, then first write
should preferably not go to the final file name "Makefile", but to
"Makefile.prelim" or some such name.

Regards, and thank you for providing fine software,

Andreas

Here is my crude "observe the Makefile" hack:

#!/usr/bin/perl -w

use strict;

my $file = "/var/lib/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/Makefile";

my $i = 0;

system "touch /tmp/Makefile.$i";

while(1) {
    if (-f $file) {
	if(((system "cmp $file /tmp/Makefile.$i") >> 8) != 0) {
	    # They are not the same.
	    $i++;
	    system "cp $file /tmp/Makefile.$i";
	    print "Captured /tmp/Makefile.$i\n";
	} else {
            # wait 100 ms.
	    select(undef, undef, undef, 0.1);
	}
    } else {
        # wait 100 ms.
	select(undef, undef, undef, 0.1);
    }
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko48QgACgkQnWrlKaIH40AQ5QCgqygbYPorvPsHIMSfeAzRvaMu
swMAoIUVpHeJ1cpxyhOHSMlK8dWVQfvx
=k2Km
-----END PGP SIGNATURE-----






More information about the Pkg-ruby-extras-maintainers mailing list