UNITCHECK and require

Discussion in 'Perl Misc' started by Adrien BARREAU, Jun 12, 2013.

  1. Hi all.

    I just found a way to kill my Perl and I don't find anything about that.
    Here it is:

    =====
    $ perl --version

    This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
    (with 61 registered patches, see perl -V for more detail)


    $ cat death.pm
    package death;
    UNITCHECK { require stuff; }
    1;

    $ cat stuff.pm
    package stuff;
    1;

    $ perl -e 'use death; print "ok\n";'
    $ perl -e 'require death; print "ok\n";'
    Segmentation fault
    =====

    Well, perhaps trying to require something in a UNITCHECK is not a good idea.
    But still, segfault...

    That's strange that the "use" version does not actually display anything
    at all, although that seems to be quite random.

    Does anybody have any piece of information about that?


    Adrien.
    Adrien BARREAU, Jun 12, 2013
    #1
    1. Advertising

  2. On 06/12/2013 06:09 PM, Ben Morrow wrote:

    >
    > For the record, I suspect this is the same bug as
    > https://rt.perl.org/rt3/Public/Bug/Display.html?id=70614 . It doesn't
    > look the same until you remember that 'require' is really just a
    > variation of string-eval.
    >
    > Ben
    >


    I can reproduce something strange behaviours like that:

    =====
    $ cat death.pm
    package death;
    UNITCHECK { eval '' }
    1;

    $ perl -e 'require death; print "ok\n"'
    $
    # ---

    $ cat death.pm
    package death;
    UNITCHECK { eval {} }
    1;

    $ perl -e 'require death; print "ok\n"'
    ok
    =====

    No segfault, but nothing either with an eval-string.
    Strange...

    Adrien.
    Adrien BARREAU, Jun 12, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Don
    Replies:
    2
    Views:
    418
    Ralph Henneberg
    Dec 10, 2003
  2. jens Jensen
    Replies:
    0
    Views:
    529
    jens Jensen
    May 2, 2006
  3. Replies:
    4
    Views:
    274
    Fuzzyman
    Dec 23, 2004
  4. cungar
    Replies:
    0
    Views:
    365
    cungar
    Nov 8, 2007
  5. Tobias Peters

    "require and subdirectories" problem

    Tobias Peters, Sep 9, 2003, in forum: Ruby
    Replies:
    2
    Views:
    71
    Idan Sofer
    Sep 9, 2003
Loading...

Share This Page