#1686: Null PMC access in find_method('signature') using Digest/MD5 from rakudo
-----------------------------------+----------------------------------------
 Reporter:  cosimo                 |        Type:  bug   
   Status:  new                    |    Priority:  normal
Milestone:                         |   Component:  none  
  Version:  2.5.0                  |    Severity:  medium
 Keywords:  find_method signature  |        Lang:  perl6 
    Patch:                         |    Platform:  linux 
-----------------------------------+----------------------------------------
 I'm trying to use Parrot's `Digest/MD5.pbc` library from Rakudo.
 Here's the rakudo class I'm trying to use:

 {{{
 class Digest::MD5 {

      pir::load_bytecode('Digest/MD5.pbc');

      multi method md5_hex (Str $message) {

          my $md5_sum = Q:PIR {
              .local pmc md5sum, md5_sum_get
              md5sum = get_root_global ['parrot'; 'Digest'], '_md5sum'
              $P0 = find_lex '$message'
              $P1 = md5sum($P0)
              md5_sum_get = get_root_global ['parrot'; 'Digest'],
 '_md5_hex'
              %r = md5_sum_get($P1)
          };

          return $md5_sum;
      }

      multi method md5_hex (@message) {
          my Str $message = @message.join('');
          return Digest::MD5.md5_hex($message);
      }

 }
 }}}

 and here's the test code:

 {{{
 use Test;
 use Digest::MD5;

 my @cases = (
     "Hello World"  , 'b10a8db164e0754105b7a99be72e3fe5',
     "Hello World\n", 'e59ff97941044f85df5297e1c302d260',
     ["a", "b"],      '187ef4436122d1cc2f40dc2b92f0eba0',
 );

 for @cases -> $values, $md5 {

     is(
         Digest::MD5.md5_hex($values), $md5,
         "MD5 of '$values' must be '$md5'"
     );

 }

 done_testing;
 }}}

 The error message is:

 {{{
 t/test.t ... Null PMC access in find_method('signature')
   in 'Digest::MD5::md5_hex' at line 11:lib/Digest/MD5.pm
   in main program body at line 19:t/test.t
 }}}

 My rakudo is:
 {{{
 cos...@home:~/src/rakudo$ git rev-parse HEAD
 f236549628d6455e7e679559daf103df423036fe
 cos...@home:~/src/rakudo$ perl6 -v
 This compiler is built with the Parrot Compiler Toolkit, parrot revision
 47640.
 }}}

 This exact code worked with older versions of Parrot and Rakudo (like
 several months old), but now it doesn't.

 Can I do something to help with this problem?

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1686>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to