diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-08-27 11:26:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-27 11:26:51 +0200 |
| commit | ecb377fc4a7200d67a0f6f5ad762dfb516086ac3 (patch) | |
| tree | 29c9134d8a3f78b97cab8a5d1824495b9e42e3f9 /src | |
| parent | 693d5eaff88434a03e2300cf6665d3a309c51661 (diff) | |
| parent | a898f76dc7c5f00761814ab0c74676bb9b35cab5 (diff) | |
| download | rust-ecb377fc4a7200d67a0f6f5ad762dfb516086ac3.tar.gz rust-ecb377fc4a7200d67a0f6f5ad762dfb516086ac3.zip | |
Rollup merge of #145885 - madsmtm:lldb-inherit-tcc, r=Kobzol
Inherit TCC in debuginfo tests on macOS macOS has a system for propagating folder permissions, which LLDB disables when spawning processes, which in turn causes debuginfo tests to spam the user with repeated pop-ups asking for permissions. See the code comment for details, as well as the following video for an example of how this looks in practice: https://github.com/user-attachments/assets/1e54f5b8-9130-4b59-8e92-1db1e58fb361 I stumbled upon the incantation to fix this (`settings set target.inherit-tcc true`) while investigating slowdowns when spawning newly created binaries due to XprotectService, see [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/build.20scripts.20slow.20on.20macOS.3F). This would allow me to no longer have a `build.build-dir = "/Users/madsmtm/rust-build"` workaround in my `bootstrap.toml`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/compiletest/src/runtest/debuginfo.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 6114afdc9df..24fdbab3aec 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -395,6 +395,35 @@ impl TestCx<'_> { // We don't want to hang when calling `quit` while the process is still running let mut script_str = String::from("settings set auto-confirm true\n"); + // macOS has a system for restricting access to files and peripherals + // called Transparency, Consent, and Control (TCC), which can be + // configured using the "Security & Privacy" tab in your settings. + // + // This system is provenance-based: if Terminal.app is given access to + // your Desktop, and you launch a binary within Terminal.app, the new + // binary also has access to the files on your Desktop. + // + // By default though, LLDB launches binaries in very isolated + // contexts. This includes resetting any TCC grants that might + // otherwise have been inherited. + // + // In effect, this means that if the developer has placed the rust + // repository under one of the system-protected folders, they will get + // a pop-up _for each binary_ asking for permissions to access the + // folder - quite annoying. + // + // To avoid this, we tell LLDB to spawn processes with TCC grants + // inherited from the parent process. + // + // Setting this also avoids unnecessary overhead from XprotectService + // when running with the Developer Tool grant. + // + // TIP: If you want to allow launching `lldb ~/Desktop/my_binary` + // without being prompted, you can put this in your `~/.lldbinit` too. + if self.config.host.contains("darwin") { + script_str.push_str("settings set target.inherit-tcc true\n"); + } + // Make LLDB emit its version, so we have it documented in the test output script_str.push_str("version\n"); |
