Issue #3630 has been updated by Yui NARUSE.

Status changed from Assigned to Closed


----------------------------------------
Backport #3630: File.expand_path doesn't expand content of HOME env. variable
https://bugs.ruby-lang.org/issues/3630

Author: Tomas Matousek
Status: Closed
Priority: Low
Assignee: Yuki Sonoda
Category: 
Target version: 
ruby -v: ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]


=begin
 Dir.chdir 'C:/temp' do
   p File.expand_path("a")
 
   ENV["HOME"] = './abc/../xxx'
   p File.expand_path("~/a")
 
   ENV["HOME"] = '~/xxx'
   p File.expand_path("~/a")
 end
 
 Prints:
 
 "C:/temp/a"
 "./abc/../xxx/a"
 "~/xxx/a"
 
 I'd expect it to print:
 "C:/temp/a"
 "C:/temp/xxx/a"
 "C:/temp/~/xxx/a"
 
 The content of HOME variable should be subject to expansion. If it starts with ~/ the tilde should be treated like a regular directory name to avoid recursion.
=end



-- 
http://bugs.ruby-lang.org/