Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MoarVM exception with constants, so, try, and cglobal #2191

Open
Kaiepi opened this issue Aug 7, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Kaiepi
Copy link
Contributor

commented Aug 7, 2018

The Problem

In Net::LibIDN2, I had some code that was intended to determine if the version of the library installed included LibIDN compatibility functions:

constant LIB = 'idn2';
constant IDN2_IDN_COMPAT = so try cglobal(LIB, 'idn2_to_ascii_8z', Pointer);

Expected Behavior

IDN2_IDN_COMPAT should be True if the library has the function, otherwise it should be False.

Actual Behavior

On systems where the version of LibIDN2 doesn't include the LibIDN compatibility functions (such as Ubuntu), it throws this exception:

Missing serialize REPR function for REPR VMException (BOOTException)

Steps to Reproduce

Install the v0.04 release of Net::LibIDN2 from here and run $ PERL6LIB=lib prove -e perl6 t/. I haven't been able to find a way to replicate the issue with simpler code.

Environment

  • Operating system:
    OpenBSD bastille.kennel.qt 6.3 GENERIC.MP#4 amd64
  • Compiler version (perl6 -v):
    This is Rakudo version 2018.06-348-g36d37cbc8 built on MoarVM version 2018.05-469-gecff5b47c
    implementing Perl 6.c.
@zoffixznet

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2018

This has the same underlying cause as #1490

You can repro it by serializing an exception:

<Zoffix_> e: BEGIN 'sandbox/A38'.IO.mkdir.add('Foo.pm6').spurt: 「constant z = (try require YourMom)」; use lib 'sandbox/A38'; use Foo;
<evalable6> Zoffix_, rakudo-moar 1cd654a22: OUTPUT: «(exit code 1) ===SORRY!===␤Missing serialize REPR function for REPR VMException (BOOTException)␤»

And you can avoid the bug by adding BEGIN $! = Nil after that constant.

@Kaiepi

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

I've already avoided the bug by checking the version of LibIDN2 instead of creating the constant. The compatibility functions aren't available before v2.0.0, which is available with IDN2_VERSION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.