develooper Front page | perl.perl5.porters | Postings from May 2008

eval "require Foo" with binary-incompatible XS modules

Thread Next
Niko Tyni
May 15, 2008 17:07
eval "require Foo" with binary-incompatible XS modules
Message ID:
[Resending because the original still hasn't reached the list after six days
 or so. Apologies if this ends up as a duplicate.]

Hi p5p,

we're currently doing the 5.8.8 -> 5.10.0 transition in Debian, and the
binary incompatibility in the XS module interface is biting us in an
unexpected way.

In a nutshell, it's possible during the upgrade to temporarily end up
in a state where perl is still 5.8.8, but some XS modules are already
the new ones (ie. built for 5.10.0).

The package scripts try to fail gracefully in situations like this by
doing effectively an 'eval "require Locale::gettext"' or the like.
Unfortunately this doesn't work: the require succeeds but the dynamic
linker kills the script off immediately afterwards because of a
symbol lookup error.

This can be circumvented by setting $ENV{PERL_DL_NONLAZY}=1 before
the eval, so it's arguably a feature. I'm wondering if it would make
sense for Perl to do this automatically inside all eval statements.
After all, the user is using the eval because he wants to catch
exceptions immediately.

If this is obviously too intrusive or otherwise broken, please hit me
with a cluebat. In that case, I think the eval entry in perlfunc.pod
could mention the issue.

I can take a shot at a patch for either case, I'd just like to know
which is the right thing to do.

Details on the Debian issue can be found at <>,
cc'd as .

# perl -e 'local $ENV{PERL_DL_NONLAZY}=0; eval "require Locale::gettext"; print "got: $@" if $@; exit 0'; echo $?
perl: symbol lookup error: /usr/lib/perl5/auto/Locale/gettext/ undefined symbol: Perl_Istack_sp_ptr

# perl -e 'local $ENV{PERL_DL_NONLAZY}=1; eval "require Locale::gettext"; print "got: $@" if $@; exit 0'; echo $?
got: Can't load '/usr/lib/perl5/auto/Locale/gettext/' for module Locale::gettext: /usr/lib/perl5/auto/Locale/gettext/ undefined symbol: Perl_Imarkstack_ptr_ptr at /usr/lib/perl/5.8/ line 225.
 at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.

Niko Tyni

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About