Skip to content

Instantly share code, notes, and snippets.

@usev6
Created July 11, 2016 19:35
Show Gist options
  • Save usev6/db5153f6b17a89078ebcb8ed4c44bddc to your computer and use it in GitHub Desktop.
Save usev6/db5153f6b17a89078ebcb8ed4c44bddc to your computer and use it in GitHub Desktop.
rename does not overwrite existing file on JVM
$ > Foo.pm6; ./perl6-j -I. -e 'use Foo; say "alive"'
alive
$ > Foo.pm6; ./perl6-j -I. -e 'use Foo; say "alive"'
===SORRY!===
Failed to rename '/usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86.tmp' to '/usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86': File /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86 already exists
$ > Foo.pm6; RAKUDO_MODULE_DEBUG=1 ./perl6-j -I. -e 'use Foo'
87032 RMD: Loading settings CORE
87032 RMD: Setting up default paths: . blib
87032 RMD: going to load Perl6::BOOTSTRAP
87032 RMD: Settings CORE loaded
269 87032 RMD: Attempting 'Foo' as a pragma
69 87032 RMD: 'Foo' is not a valid pragma
26 87032 RMD: Attempting to load 'Foo'
8 87032 RMD: Late loading 'Foo'
20 87032 RMD: Parsing specs: .
55 87032 RMD: Parsing specs:
17 87032 RMD: Parsing specs: .
16 87032 RMD: Parsing specs: blib
30 87032 RMD: Parsing specs: /usr/home/christian/bin/rakudo.jvm/share/nqp/lib
588 87032 RMD: try-load 7795C5BD3D21241ED31BB5DB19106B21CC622A86: /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/Foo.pm6
55 87032 RMD: Trying to load 7795C5BD3D21241ED31BB5DB19106B21CC622A86 from /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp
57 87032 RMD: Outdated precompiled /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86
mtime: Instant:1468265673
since: Instant:1468265719
147 87032 RMD: Precompiling /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/Foo.pm6 into /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86.bc
87079 RMD: Loading settings CORE
87079 RMD: Setting up default paths: . blib
87079 RMD: going to load Perl6::BOOTSTRAP
87079 RMD: Settings CORE loaded
3974 87032 RMD: Precompiled /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/Foo.pm6 into /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86.bc
9 87032 RMD: Writing dependencies and byte code to /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86.tmp
===SORRY!===
Failed to rename '/usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86.tmp' to '/usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86': File /usr/home/christian/perl6/perl6-roast-data/rakudo.jvm/.precomp/54B30A4BDF363852FC8D6905165A5E0131320458.1.468265383996E9/77/7795C5BD3D21241ED31BB5DB19106B21CC622A86 already exists
@usev6
Copy link
Author

usev6 commented Jul 11, 2016

Proposed fix: Raku/nqp#296

@usev6
Copy link
Author

usev6 commented Jul 11, 2016

To illustrate the problem with nqp-j:

$ touch foo bar
$ ./nqp-j -e 'nqp::rename("foo", "bar")'
File bar already exists
  in <mainline> (-e:1)
  in eval (gen/jvm/stage2/NQPHLL.nqp:1198)
  in  (gen/jvm/stage2/NQPHLL.nqp:1288)
  in command_eval (gen/jvm/stage2/NQPHLL.nqp:1285)
  in command_line (gen/jvm/stage2/NQPHLL.nqp:1269)
  in MAIN (gen/jvm/stage2/NQP.nqp:4143)
  in <mainline> (gen/jvm/stage2/NQP.nqp:4139)
  in  (gen/jvm/stage2/NQP.nqp)

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