Skip to content

tap-new: use run_as_real_uid: instead of Utils::UID.drop_euid#21839

Draft
carlocab wants to merge 1 commit intono-drop_euidfrom
rm-drop_euid
Draft

tap-new: use run_as_real_uid: instead of Utils::UID.drop_euid#21839
carlocab wants to merge 1 commit intono-drop_euidfrom
rm-drop_euid

Conversation

@carlocab
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Now that SystemCommand supports run_as_real_uid:, replace the
Utils::UID.drop_euid block in tap-new with system_command! calls
using run_as_real_uid: true, and remove the now-unused drop_euid method.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com


As seen above, I used Claude to generate this PR. I reviewed the diff and ran brew lgtm manually.

This is a follow-up to #21838. We should remove Utils::UID.drop_euid because it is prone to race conditions.

Now that `SystemCommand` supports `run_as_real_uid:`, replace the
`Utils::UID.drop_euid` block in `tap-new` with `system_command!` calls
using `run_as_real_uid: true`, and remove the now-unused `drop_euid` method.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates brew tap-new to avoid process-wide EUID switching by using SystemCommand’s run_as_real_uid: option for the git operations that should run as the real UID, and removes the now-unused Utils::UID.drop_euid helper.

Changes:

  • Replace the Utils::UID.drop_euid block in tap-new with system_command! calls using run_as_real_uid: true.
  • Add SystemCommand::Mixin usage to tap-new to support the new command invocation.
  • Remove Utils::UID.drop_euid from utils/uid.rb now that it has no callers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/utils/uid.rb Removes the drop_euid helper now that callers have migrated away from process-wide EUID changes.
Library/Homebrew/dev-cmd/tap-new.rb Runs git commands via system_command! with run_as_real_uid: true to avoid EUID race conditions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Makes sense!

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

Successfully merging this pull request may close these issues.

3 participants