Repository navigation
Conversation
fbuild host tools are moving to cosmocc Actually Portable Executables: one binary per tool for Windows, macOS and Linux on x86_64 and aarch64. Unix kernels can't exec an APE without a binfmt handler (NixOS ships none), so every spawn failed with "Exec format error". - platform::ape detects the APE magic and launches `<loader> <image> args`. fbuild provides the loader from the image itself: the Linux ELF loader, the macOS x86_64 Mach-O loader, or ape-m1.c compiled once with cc on Apple Silicon. Loaders are validated and installed content-addressed into an owner-only, exec-capable cache, with a sealed memfd as the last resort on Linux (raw syscall, so the glibc 2.17 floor holds). - The loader is also exposed as `ape` first on the child's PATH, so APE programs a tool spawns itself (gcc -> cc1/as) resolve too. - A process-wide fork lock keeps freshly written loaders from failing with ETXTBSY under parallel spawns. - zccache spawns compilers itself, so FbuildZccacheService hands it a `#!/bin/sh` shim that keeps the compiler's name and execs the loader on the original image. - Tool lookup accepts tool, tool.exe and tool.com on every host (non-native spellings only when they are APE). Zip extraction restores the APE exec bit. Registry files without `system`, and tools.json "any", count as universal. - Direct Command::new tool spawns move to process::command/tokio_command. Tests: the hello-world cosmocc fixture via run_command and process::command, hostile envs, tampered caches, symlinked and world-writable cache dirs, 48-way concurrent first spawns, and an opt-in all-APE cosmocc gcc toolchain through run_command and embedded zccache (cold miss then warm hit). Validated on Ubuntu, Debian, Fedora, Alpine, Arch (x64, root and user), aarch64 under qemu-user, and Windows tool-resolution logic under wine. Refs #1629
…inventory, keep exact-name DLL lookup on PATH - process::command/tokio_command carry allow-direct-spawn markers (they are the sanctioned constructors). - Move the new registry-system and APE staged-install tests into their own files to stay under the 1000-LOC limit. - Regenerate ci/platform_boundary_research.tsv. - esp_qemu: find_on_path is also used for libiconv-2.dll; the tool-name expansion (.exe/.com/APE-only extensionless) never matches a DLL, which broke hydrate_windows_runtime on Windows. Keep an exact-name lookup and use find_tool_on_path only for the qemu binary.
…/raw prefix compares Dylint (ban_std_pathbuf, ban_file_based_locks, ban_unrooted_tempdir, ban_raw_path_prefix_compare) rejected the new APE and tool-lookup code. - platform::ape and executable tool helpers carry NormalizedPath; callers in PathBuf-allowlisted files convert with into_path_buf(). - Loader installs use create+truncate on a pid/sequence-unique temp name in an owner-only dir instead of create_new. - Drop the $TMPDIR cache candidate. Binaries register fbuild's cache root via ape::set_default_cache_root(get_cache_root()/ape) (daemon + CLI startup); XDG/~/.cache, the runtime dir and the Linux memfd remain fallbacks. - memfd detection is an exact-identity is_anonymous() check, not a /proc/self prefix compare.
…, ETXTBSY retry, docs - native shim embeds the APE image's len/mtime so an in-place compiler upgrade changes the shim zccache fingerprints. - process::shared_fork_guard is public; the allowlisted direct spawns (riscv probe, gdb, clang tools) fork under it. - run_command* retry ETXTBSY for APE launches (third-party spawners such as zccache fork without fbuild's lock). - README/platform docs describe the macOS loaders and current cache dirs.
…ly foreign addr2line; merge main - teensy_loader_cli lookup searches the requesting CLI's PATH first (deploy_teensy.rs). - Installs extracted before APE support get their APE exec bits repaired once (ape_perms.rs, .fbuild-ape-perms-v1 marker); fresh installs write the marker. - derive_addr2line_path accepts a non-native sibling only when it is an APE. - Refresh boundary inventory after merging main.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dfebd9d to
f8ac127
Compare
|
Status check (2026-11-19): BLOCKED, left open as a draft. Nothing was changed. Not actively driven. The last commit on this branch is Why it cannot simply land:
The dependency is not the blocker. running-process What remains to land this:
A maintainer needs to decide whether to finish this migration or close it in favour of the merged #1633 loader. |
|
Decision (2026-11-20): port the delegation onto Strategies considered
Evidence on
Why a fresh PR and not a rebase of this branch The 28 conflicts reported on 2026-11-19 come from merging the whole stale branch, including its old merges of Risk Process spawning on Linux, Windows and macOS, the fork lock, and containment are all touched. The real cosmocc tests are |
|
Closing as superseded by #2132, which merged to #2132 is this migration ported onto current Validation of what landed:
Branches:
|
fbuild currently owns an APE loader and gives embedded zccache a shell shim. Delegate detection and launch planning to running-process 4.10.16, and pin zccache to the validated commit from forge-ci/zccache#1887 (merged), which uses kernal-api 0.1.26. Embedded compiles now receive the original compiler path.
The adapter preserves FBUILD_APE_LOADER, FBUILD_APE_CACHE_DIR, FBCACHE_DIR, FBUILD_CACHE_DIR and the registered application cache, including fallback order. Spawn helpers share the canonical fork lock without recursively acquiring it. Package lookup, executable permission repair and owner-thread containment from #1633 remain intact.
This is stacked on #1633 so its newer work remains in the ancestry and this PR shows only the migration.
Validation: workspace tests, workspace clippy with warnings denied, all workspace Dylints, platform-boundary checks and the single-reviewer clud-review passed. All nine adapter tests passed, including hostile environments, registered-cache fallback and 48 concurrent first launches. Both real cosmocc compiler integration tests passed with the final dependency pin, including embedded zccache cold miss/warm hit.
The six unreferenced old loader files have now been removed safely in an isolated local worktree (
0841f49a); the cleanup has passed review and all nine adapter tests. These resumed commits are not pushed yet. Final validation andci-fullremain required for this platform-sensitive migration.The first full CI run on
562a07fee23c788c06f8d1cf4edcce753460262cpassed every job except Windows: https://github.com/FastLED/fbuild/actions/runs/37146132601. It exposed relative executable resolution against the parent cwd in the hostile-environment fixture.Commit
6ff4f9074b441d3d7d922b126213a841119ffb86resolves explicit relative paths against the requested child cwd, preserving OS symlink traversal and bare-name search. All 330 fbuild-core tests pass locally, including the unchanged hostile fixture and a real symlink regression; clippy, targeted Dylint and review pass. Windows validation on the corrected candidate: https://github.com/FastLED/fbuild/actions/runs/37148075175.Resumed integration checkpoint (2026-10-22; local commits pending push)
The parent #1633 conflicts with current main and its old local gate failed. The final migration branch now integrates current main, retaining the parent's universal package/tool discovery and executable-permission support together with the running-process delegation. Once final review and gates pass, this draft can target main with the complete migration; #1633 can be superseded after that lands.
find_binary_accepts_a_nested_ape_comin the current test module.2c9b6353. The mandatory full gate is queued behind the existing fbuild clone gate. These resumed commits are not pushed; no final-head hosted or native-platform success is claimed.