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

rbenv spins out of control if neiter greadlink nor readlink is available #389

Closed
jf647 opened this issue May 10, 2013 · 5 comments
Closed

Comments

@jf647
Copy link

jf647 commented May 10, 2013

I'm familiar with the patch to use greadlink on Solaris instead of readlink:

#43

The problem I have is that greadlink doesn't appear to be a standard Solaris utility, and rbenv behaves very poorly when neither readlink nor greadlink is available.

This is a gist of 'rbenv versions' on Linux:

https://gist.github.com/jf647/f39ff6cab054d6b6f52a

And this is the same command on Solaris without readlink or greadlink installed.

https://gist.github.com/jf647/c28f8b35fcfba8c94952

As you can see, when it attempts to use greadlink or readlink, it comes back with the bare command rather than something qualified. That gets re-execed, and we loop forever.

I'm not sure where the author of the original pull request found greadlink. Possibly it came from OpenCSW's coreutils:

http://www.opencsw.org/search/coreutils/

Which installs greadlink in /opt/csw/bin, but it certainly won't be available on a stock system. coreutils is also available from www.sunfreeware.com, though the maintainer of that site is switching to a freemium model. While coreutils is available for free (with registration) right now, there's no guarantee it will continue to be so.

The fix is either to clearly document the requirement (especially as not having it installed can take down a production server in minutes by using up all available memory) or improve rbenv so that in the absence of readlink or greadlink rbenv quits with an error.

@sstephenson
Copy link
Contributor

Thanks for the report. I agree we should fail fast with an error if neither readlink nor greadlink is available. Would you like to work on a patch?

@jf647
Copy link
Author

jf647 commented May 10, 2013

I'll take a whack at it. Hopefully I'll have a pull req up by end of day.

@sstephenson
Copy link
Contributor

Thank you!

@jf647
Copy link
Author

jf647 commented May 10, 2013

I decided to set up a preflight check function rather than just enhance resolve_link. Because resolve_link is used in expansion, exiting from it in case of failure doesn't stop the main script.

precheck() may prove useful for other similar situations in the future.

@mislav
Copy link
Member

mislav commented May 10, 2013

Thanks for reporting this. Closing in favor of your pull request #390

BTW you can use http://defunkt.io/hub to transform your issues to pull-requests from the command-line

@mislav mislav closed this as completed May 10, 2013
mislav pushed a commit that referenced this issue Jun 7, 2013
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes #389
sheerun pushed a commit to sheerun/rbenv that referenced this issue Jul 31, 2013
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes rbenv#389
dolmen pushed a commit to dolmen/plenv that referenced this issue Oct 30, 2013
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of
the worker script in libexec.

Ref. tokuhirom#58
rbenv/rbenv@81bb14e
rbenv/rbenv#389
cehoffman pushed a commit to cehoffman/rbenv that referenced this issue Apr 8, 2014
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes rbenv#389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants