Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.expand_path should fail if ENV['HOME'] isn't an absolute path #1163

Closed
nirvdrum opened this Issue Oct 24, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@nirvdrum
Copy link
Contributor

nirvdrum commented Oct 24, 2013

I ran into a corner case with File.expand_path that's causing a test failure with fog. I guess if ENV['HOME'] isn't an absolute path, MRI will fail to expand a path containing '~'.

$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

irb(main):001:0> ENV['HOME'] = '.'
=> "."
irb(main):002:0> File.expand_path('~/.fog')
ArgumentError: non-absolute home
    from (irb):3:in `expand_path'
    from (irb):3
    from /home/nirvdrum/.rbenv/versions/2.0.0-p247/bin/irb:12:in `<main>'
$ ruby --version
jruby 1.7.6 (1.9.3p392) 2013-10-22 6004147 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [linux-amd64]

irb(main):001:0> ENV['HOME'] = '.'
=> "."
irb(main):002:0> File.expand_path('~/.fog')
=> "/home/nirvdrum/dev/workspaces/fog/.fog

enebo added a commit that referenced this issue Oct 24, 2013

enebo added a commit that referenced this issue Oct 24, 2013

@enebo enebo closed this in f72b75b Oct 24, 2013

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Oct 24, 2013

Very simple missing checks but this code gets uglier and uglier...a nice 9k cleanup refactoring of expand_path code for someone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.