Skip to content

Commit 697963f

Browse files
committed
Fix patching of preinitialized paths
* We must add the same String instance to `paths_starting_with_home` to String#replace it later. Fixes 61f0f80. * Use Truffle::Ropes.flatten_rope to avoid keeping a SubstringRope referencing the original Rope containing the build-time path. (cherry picked from commit a9b3243)
1 parent bd41a98 commit 697963f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/ruby/truffleruby/post-boot/post-boot.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@
7676
[$LOAD_PATH, $LOADED_FEATURES].each do |array|
7777
array.each do |path|
7878
if path.start_with?(old_home)
79-
paths_starting_with_home << path[old_home.size..-1]
79+
path.replace Truffle::Ropes.flatten_rope(path[old_home.size..-1])
80+
paths_starting_with_home << path
81+
else
82+
raise "Path #{path.inspect} in $LOAD_PATH or $LOADED_FEATURES was expected to start with #{old_home}"
8083
end
8184
end
8285
end

0 commit comments

Comments
 (0)