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

utils/gems: handle mismatching EUID and UID for bundle installs #17196

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Library/Homebrew/dev-cmd/install-bundler-gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def run
Homebrew.forget_user_gem_groups!
end

Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
Homebrew.install_bundler_gems!(groups:)
end
end
Expand Down
7 changes: 6 additions & 1 deletion Library/Homebrew/utils/gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,12 @@
end

bundle_installed = if bundle_install_required
if system bundle, "install", out: :err
Process.wait(fork do
# Native build scripts fail if EUID != UID
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
exec bundle, "install", out: :err

Check warning on line 306 in Library/Homebrew/utils/gems.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/gems.rb#L306

Added line #L306 was not covered by tests
end)
if $CHILD_STATUS.success?

Check warning on line 308 in Library/Homebrew/utils/gems.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/gems.rb#L308

Added line #L308 was not covered by tests
true
else
message = <<~EOS
Expand Down