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

Installing system Ruby should check permissions before compiling #326

Closed
rennex opened this issue Oct 16, 2018 · 2 comments
Closed

Installing system Ruby should check permissions before compiling #326

rennex opened this issue Oct 16, 2018 · 2 comments
Assignees
Milestone

Comments

@rennex
Copy link

rennex commented Oct 16, 2018

I used ruby-install --system --latest ruby, and after some minutes of compilation, it failed:

Permission denied @ rb_sysopen - /usr/local/share/man/man1/ruby.1 (Errno::EACCES)

Without digging too deep, I assume this happened because I didn't use sudo. Running the command again with sudo succeeded, but it meant downloading the tarball again and waiting for the recompilation. Maybe there was a way to resume the previous attempt, but finding that out from docs would've taken longer :)

So I would suggest checking in the beginning if sudo will be needed and hasn't been used, before spending time doing lots of work. Or alternatively, let the user enter their password into sudo when that's needed.

@postmodern postmodern self-assigned this Jan 7, 2022
@postmodern
Copy link
Owner

Going to close since I couldn't come up with a solution that covers all edge cases (ex: ruby-install --install-dir /usr/local, ruby-install --install-dir /some/other/dir, or when /usr/local is writable by a special user group that the user belongs to or a file-system ACL, etc). Even if I wrote a function which checks if each parent directory is writable, that could still be fooled by symlinks. Plus, ruby-build does check permissions before compiling either. I ended up just changing the example in the README to be sudo ruby-install --system ....

@postmodern postmodern closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2025
@postmodern
Copy link
Owner

Ended up adding a basic permissions check that recursively tests the installation directory's parent directories for writability (see eeb4575). This will catch when you run ruby-install --system without sudo. This will be released in 0.10.0.

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

No branches or pull requests

3 participants