Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

fix standalone executable when dest of symlink #4782

Merged
merged 1 commit into from
Aug 15, 2016
Merged

fix standalone executable when dest of symlink #4782

merged 1 commit into from
Aug 15, 2016

Conversation

terinjokes
Copy link
Contributor

@terinjokes terinjokes commented Jul 14, 2016

When an executable is the destination of a symlink __FILE__ contains
the path to the symlink, rather than the actual path of the current
file.

Pathname#realpath resolves symlinks to get the actual location on disk.

@segiddins
Copy link
Member

Can you add a spec covering the bug this fixes? Thanks!

@terinjokes
Copy link
Contributor Author

@segiddins Absolutely! Are there already specs for this part of the code? I looked for them, but I didn't find them, and I feel like I missed it.

@segiddins
Copy link
Member

I'll have a look next time I'm at my computer, but I feel we might have a standalone_specs.rb?

@terinjokes
Copy link
Contributor Author

@segiddins I've dded a spec to confirm that running a symlink works.

require "tmpdir"
symlink = File.expand_path("rails", Dir.mktmpdir)
File.symlink(bundled_app("bin/rails"), symlink)
expect(`#{symlink} -v`.chomp).to eql "2.3.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys_exec!("#{symlink} -v")
expect(out).to eq("2.3.2")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm paralleling the nearby test. Should I change it as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure!

@segiddins
Copy link
Member

👍 from me other than the test comments

@indirect indirect mentioned this pull request Aug 11, 2016
23 tasks
@terinjokes
Copy link
Contributor Author

@segiddins sorry I was away. I'm currently addressing the issues you brought up.

When an executable is the destination of a symlink `__FILE__` contains
the path to the symlink, rather than the actual path of the current
file.

Pathname#realpath resolves symlinks to get the actual location on disk.
@indirect
Copy link
Member

Thanks!

@homu r+

@homu
Copy link
Contributor

homu commented Aug 15, 2016

📌 Commit a14c2fb has been approved by indirect

homu added a commit that referenced this pull request Aug 15, 2016
…indirect

fix standalone executable when dest of symlink

When an executable is the destination of a symlink `__FILE__` contains
the path to the symlink, rather than the actual path of the current
file.

`Pathname#realpath` resolves symlinks to get the actual location on disk.
@homu
Copy link
Contributor

homu commented Aug 15, 2016

⌛ Testing commit a14c2fb with merge fccf3f9...

@homu
Copy link
Contributor

homu commented Aug 15, 2016

💔 Test failed - status

@segiddins
Copy link
Member

@homu retry

homu added a commit that referenced this pull request Aug 15, 2016
…indirect

fix standalone executable when dest of symlink

When an executable is the destination of a symlink `__FILE__` contains
the path to the symlink, rather than the actual path of the current
file.

`Pathname#realpath` resolves symlinks to get the actual location on disk.
@homu
Copy link
Contributor

homu commented Aug 15, 2016

⌛ Testing commit a14c2fb with merge 7c38144...

@homu
Copy link
Contributor

homu commented Aug 15, 2016

☀️ Test successful - status

@homu homu merged commit a14c2fb into rubygems:master Aug 15, 2016
@coilysiren coilysiren modified the milestone: Release Archive Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants