Project

General

Profile

Actions

Bug #3171

closed

require '~/file.rb does not expand path before storing in $"

Added by brixen (Brian Shirai) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
1.8.8
[ruby-core:29610]

Description

=begin
Calling 'require "~/file.rb"' does not expand the path before storing it in $". However, 'require "~/file"' does expand the path. In both cases, the path is expanded for FILE.

$ cat ~/file.rb
puts FILE

$ ruby1.8.7 -v -e 'require "~/file"; p $"'
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.8.0]
/Users/brian/file.rb
["enumerator.so", "/Users/brian/file.rb"]

$ ruby1.8.7 -v -e 'require "~/file.rb"; p $"'
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.8.0]
/Users/brian/file.rb
["enumerator.so", "~/file.rb"]

This bug has been fixed in 1.9.2, but I could not find a specific ticket for it. The fix should be backported to 1.8.

$ ruby1.9 -v -e 'require "~/file"; p $".grep(/file/)'
ruby 1.9.2dev (2010-03-30 trunk 27097) [i386-darwin9.8.0]
/Users/brian/file.rb
["/Users/brian/file.rb"]

$ ruby1.9 -v -e 'require "~/file.rb"; p $".grep(/file/)'
ruby 1.9.2dev (2010-03-30 trunk 27097) [i386-darwin9.8.0]
/Users/brian/file.rb
["/Users/brian/file.rb"]

Thanks,
Brian
=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 14 years ago

  • Category set to core
  • ruby -v set to 1.8.8

=begin
It's impossible to backport from 1.9 as-is, so moved to Bug.
=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27398.
Brian, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0