Actions
Feature #13300
closedStrip chroot path from $LOADED_FEATURES when calling Dir.chroot
Status:
Rejected
Assignee:
-
Target version:
-
Description
Currently, Dir.chroot
doesn't modify $LOADED_FEATURES
, leading
to a situation where Kernel#require
will attempt to load the same
file twice, or a different file not at all because it thinks it
is already loaded.
With this example code:
require 'fileutils'
File.write('baz.rb', 'A = 1')
require './baz'
pwd = Dir.pwd
Dir.chroot(pwd)
require './baz'
FileUtils.mkdir_p(pwd)
File.write(File.join(pwd, 'baz.rb'), '$a = 2')
require "#{pwd}/baz"
warn "$a => #{$a.inspect}" unless $a == 2
Previous output on stderr:
/baz.rb:1: warning: already initialized constant A
/home/billg/baz.rb:1: warning: previous definition of A was here
$a => nil
With this patch, no output on stderr.
Files
Actions
Like0
Like0Like0Like0Like0