Skip to content

sandbox: allow writing xcrun db - #23748

Merged
MikeMcQuaid merged 1 commit into
mainfrom
allow-xcrundb
Sep 3, 2026
Merged

sandbox: allow writing xcrun db#23748
MikeMcQuaid merged 1 commit into
mainfrom
allow-xcrundb

Conversation

@cho-m

@cho-m cho-m commented Sep 2, 2026

Copy link
Copy Markdown
Member

Without permission, clang outputs multiple errors like:

clang: error: couldn't create cache file '/var/folders/*/*/T/xcrun_db-*' (errno=Operation not permitted)

Formula in following PR can reproduce this behavior

Sometimes these are non-impacting, but other times they will fail the build. One example is building nokogiri gem which fails with

gumbo.c:32:10: fatal error: 'nokogiri_gumbo.h' file not found
   32 | #include "nokogiri_gumbo.h"
      |          ^~~~~~~~~~~~~~~~~~

This had been covered by following regex when not using def fetch

allow_write path: "^/private/var/folders/[^/]+/[^/]+/[C,T]/", type: :regex

For now, went with more restrictive regex to avoid unnecessary permissions until someone confirms it is needed.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煛 Changes recommended

The regex permits broader writes than intended and lacks regression coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Allows sandboxed macOS builds to write xcrun cache database files, preventing compiler failures.

Changes:

  • Adds a targeted writable-path regex for temporary xcrun_db files.
File summaries
File Description
Library/Homebrew/extend/os/mac/sandbox.rb Adds the macOS sandbox permission.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Balanced

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/extend/os/mac/sandbox.rb Outdated
Comment thread Library/Homebrew/extend/os/mac/sandbox.rb Outdated
Without permission, clang outputs multiple errors like:
```
clang: error: couldn't create cache file
'/var/folders/*/*/T/xcrun_db-*' (errno=Operation not permitted)
```

Sometimes these are non-impacting, but other times they will fail the
build. One example is building nokogiri gem which fails with
```
gumbo.c:32:10: fatal error: 'nokogiri_gumbo.h' file not found
   32 | #include "nokogiri_gumbo.h"
      |          ^~~~~~~~~~~~~~~~~~
```

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煝 Approval recommended

The sandbox permission is narrowly scoped and covered by the updated test.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 3, 2026
Merged via the queue into main with commit 631feab Sep 3, 2026
60 of 63 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the allow-xcrundb branch September 3, 2026 08:14
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.

4 participants