Bug #2578
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
=begin Hi, While revising the rubyspecs for Kernel#require, I noticed the following difference between 1.8 and 1.9. If $LOAD_PATH is empty, requiring a path relative to the CWD raises a LoadError on 1.8 but succeeds on 1.9. Adding any entry to $LOAD_PATH, even a nonexistent directory, causes the relative require to succeed. I've tried searching for a ticket related to this but was unable to find one. Is this a bug in 1.8? If not a bug, could you please explain the reason for the difference. $ cat a.rb puts 1 $ cat b.rb p $LOAD_PATH.clear require './a.rb' $ cat c.rb p $LOAD_PATH.clear p $LOAD_PATH << "irrelevant_dir" require './a.rb' $ ruby1.8.7 -v b.rb ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0] [] b.rb:2:in `require': no such file to load -- ./a.rb (LoadError) from b.rb:2 $ ruby1.9 -v b.rb ruby 1.9.2dev (2009-12-16 trunk 26107) [i386-darwin9.8.0] [] 1 $ ruby1.8.7 -v c.rb ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0] [] ["irrelevant_dir"] 1 $ ruby1.9 -v c.rb ruby 1.9.2dev (2009-12-16 trunk 26107) [i386-darwin9.8.0] [] ["irrelevant_dir"] 1 Thanks, Brian =end