Merge pull request #17196 from Homebrew/bundle-install-euid

utils/gems: handle mismatching EUID and UID for bundle installs
This commit is contained in:
Bo Anderson 2024-06-18 15:13:53 +01:00 committed by GitHub
commit 15dc911e41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,6 @@ module Homebrew
Homebrew.forget_user_gem_groups!
end
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
Homebrew.install_bundler_gems!(groups:)
end
end

View File

@ -300,7 +300,12 @@ module Homebrew
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
end)
if $CHILD_STATUS.success?
true
else
message = <<~EOS