Skip to content

Instantly share code, notes, and snippets.

@usev6
Created July 5, 2016 19:42
Show Gist options
  • Save usev6/ab0d3f9c6bba17acd9a1b0b8be9c74ca to your computer and use it in GitHub Desktop.
Save usev6/ab0d3f9c6bba17acd9a1b0b8be9c74ca to your computer and use it in GitHub Desktop.
Module loading on rakudo-j broken
$ ./perl6-j -Ilib -e 'use Test'
===SORRY!===
This type cannot unbox to a native string
$ ./perl6-j -e 'use NoSuchModule'
===SORRY!===
This type cannot unbox to a native string
$ RAKUDO_MODULE_DEBUG=1 ./perl6-j -Ilib -e 'use Test'
43108 RMD: Loading settings CORE
43108 RMD: Setting up default paths: . blib
43108 RMD: going to load Perl6::BOOTSTRAP
43108 RMD: Settings CORE loaded
295 43108 RMD: Attempting 'Test' as a pragma
95 43108 RMD: 'Test' is not a valid pragma
26 43108 RMD: Attempting to load 'Test'
19 43108 RMD: Late loading 'Test'
23 43108 RMD: Parsing specs: lib
32 43108 RMD: Parsing specs:
15 43108 RMD: Parsing specs: .
17 43108 RMD: Parsing specs: blib
23 43108 RMD: Parsing specs: /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/install/share/nqp/lib
===SORRY!===
This type cannot unbox to a native string
./perl6-j --ll-exception -Ilib -e 'use Test'
This type cannot unbox to a native string
in normalize (gen/jvm/CORE.setting:37671)
in (gen/jvm/CORE.setting:37679)
in setup-repositories (gen/jvm/CORE.setting:37678)
in (gen/jvm/CORE.setting:38890)
in INITIALIZE-DYNAMIC (gen/jvm/CORE.setting:3555)
in (gen/jvm/CORE.setting:570)
in (gen/jvm/CORE.setting:568)
in DYNAMIC (gen/jvm/CORE.setting:562)
in head (gen/jvm/CORE.setting:37757)
in load_module (src/Perl6/World.nqp:1190)
in do_pragma_or_load_module (src/Perl6/World.nqp:1120)
in statement_control:sym<use> (src/Perl6/Grammar.nqp:1549)
in !protoregex (gen/jvm/stage2/QRegex.nqp:1379)
in statement_control (src/Perl6/Grammar.nqp)
in statement (src/Perl6/Grammar.nqp:1244)
in statementlist (src/Perl6/Grammar.nqp:1173)
in LANG (gen/jvm/stage2/NQPHLL.nqp:785)
in FOREIGN_LANG (src/Perl6/Grammar.nqp:1563)
in comp_unit (src/Perl6/Grammar.nqp:1157)
in TOP (src/Perl6/Grammar.nqp:460)
in parse (gen/jvm/stage2/QRegex.nqp:2093)
in parse (gen/jvm/stage2/NQPHLL.nqp:1488)
in compile (gen/jvm/stage2/NQPHLL.nqp:1444)
in eval (gen/jvm/stage2/NQPHLL.nqp:1180)
in (gen/jvm/stage2/NQPHLL.nqp:1288)
in command_eval (gen/jvm/stage2/NQPHLL.nqp:1285)
in command_eval (src/Perl6/Compiler.nqp:27)
in command_line (gen/jvm/stage2/NQPHLL.nqp:1269)
in MAIN (gen/jvm/main.nqp:37)
in <mainline> (gen/jvm/main.nqp:33)
in (gen/jvm/main.nqp)
The problem seems to be in src/core/CompUnit/RepositoryRegistry.pm line 125
nqp::join('#', $parts)
where $parts is a BOOTArray
@usev6
Copy link
Author

usev6 commented Jul 5, 2016

diff --git a/src/core/CompUnit/RepositoryRegistry.pm b/src/core/CompUnit/RepositoryRegistry.pm
index 1e02697..d2d747e 100644
--- a/src/core/CompUnit/RepositoryRegistry.pm
+++ b/src/core/CompUnit/RepositoryRegistry.pm
@@ -121,7 +121,7 @@ class CompUnit::RepositoryRegistry {
         sub normalize(\spec){
             my $parts := nqp::split('#', spec);
             my $path := nqp::elems($parts) - 1;
-            nqp::bindpos($parts, $path, $SPEC.canonpath(nqp::atpos($parts, $path)));
+            nqp::bindpos($parts, $path, nqp::unbox_s($SPEC.canonpath(nqp::atpos($parts, $path))));
             nqp::join('#', $parts)
         };

$ ./perl6-j -Ilib -e 'use Test; say 42'
42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment