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

install-bundler-gems: change_privilege when necessary. #17178

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Apr 29, 2024

This ensures that gems are able to be installed when using e.g. ruby -I in their installation scripts.

Leaving this as draft for now as I'm not convinced this is the right approach; this should be a temporary change just for bundle install. I was unclear how to do that though CC @Bo98 for help when you're back.

@MikeMcQuaid MikeMcQuaid requested a review from Bo98 April 29, 2024 16:32
@@ -296,6 +296,7 @@ def install_bundler_gems!(only_warn_on_failure: false, setup_path: true, groups:
end

bundle_installed = if bundle_install_required
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
Copy link
Member

Choose a reason for hiding this comment

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

Seems correct. I think you can make this temporary by doing something like

begin
  original_uid = Process.uid
  Process::UID.change_privilege(Process.euid)
  ...
ensure
  Process::UID.change_privilege(original_uid)
end

Copy link
Member Author

Choose a reason for hiding this comment

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

@carlocab Unfortunately we get Error: Operation not permitted on the latter call. I've scoped this to brew install-bundler-gems instead for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Bo98 When you're back could do with your help figuring out how to do this better for bundle install.

This ensures that gems are able to be installed when using e.g.
`ruby -I` in their installation scripts.
@MikeMcQuaid MikeMcQuaid changed the title utils/gems: change_privilege when necessary. install-bundler-gems: change_privilege when necessary. Apr 30, 2024
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review April 30, 2024 08:22
@MikeMcQuaid MikeMcQuaid merged commit d474060 into master Apr 30, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the gems_change_privilege branch April 30, 2024 09:08
@github-actions github-actions bot added the outdated PR was locked due to age label May 31, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants