You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #756 injects -imacros external/toolchains_llvm++llvm+llvm_toolchain/redacted_dates.h into unfiltered_compile_flags. The path is sandbox-relative, which is fine for normal cc_library/cc_binary actions but breaks consumers that re-serialize toolchain flags into out-of-sandbox compiler invocations.
The most common surface: rules_rustcargo_build_script actions invoking cc-rs when --strategy=CargoBuildScriptRun=local is set. cc-rs calls cc_wrapper.sh with the toolchain's flags but resolves CWD outside the sandbox where external/... paths don't exist.
Reproducer
Any Rust target whose dep graph pulls a *-sys crate with a C build script (ring, libtcmalloc-sys, snmalloc-sys, etc.) plus:
The sandbox-relative path is correct for in-sandbox actions but unusable for any consumer that doesn't have cxx_builtin_include_files in its runfiles. rules_rustcargo_build_script_runner doesn't propagate cxx_builtin_include_files to local-strategy invocations.
PR #756's docstring foresaw this: "tools that re-serialize the toolchain's compile flags into their own build scripts (rules_foreign_cc make/cmake builds, embedded compiler-flag strings) drop the quotes" — the new -imacros form doesn't have the quote-loss bug but instead has an analogous file-path-loss bug for the same class of consumers.
Proposed fixes (pick one)
Feature flag: Add a `disable_date_redaction` toolchain feature (default off). Consumers can enable it to skip the -imacros redacted_dates_path block. Smallest API surface; opt-in; ships immediately.
Bazel runfile path propagation: cooperate with rules_rust to propagate cxx_builtin_include_files to local-strategy cargo_build_script. Out of scope here.
Happy to send a PR implementing option 1 (disable_date_redaction feature) if maintainers want.
Summary
PR #756 injects
-imacros external/toolchains_llvm++llvm+llvm_toolchain/redacted_dates.hintounfiltered_compile_flags. The path is sandbox-relative, which is fine for normalcc_library/cc_binaryactions but breaks consumers that re-serialize toolchain flags into out-of-sandbox compiler invocations.The most common surface:
rules_rustcargo_build_scriptactions invokingcc-rswhen--strategy=CargoBuildScriptRun=localis set.cc-rscallscc_wrapper.shwith the toolchain's flags but resolves CWD outside the sandbox whereexternal/...paths don't exist.Reproducer
Any Rust target whose dep graph pulls a
*-syscrate with a C build script (ring,libtcmalloc-sys,snmalloc-sys, etc.) plus:(
--strategy=CargoBuildScriptRun=localis the recommended workaround for thelibtcmalloc-syssandbox-symlink issue, perrules_rustdiscussion.)Failure
Reproduces on darwin-aarch64 + linux-x86_64.
v1.8.0(just released) carries PR #756, so every consumer that bumps pastv1.7.0is affected.Cause
toolchain/internal/configure.bzl:841:The sandbox-relative path is correct for in-sandbox actions but unusable for any consumer that doesn't have
cxx_builtin_include_filesin its runfiles.rules_rustcargo_build_script_runnerdoesn't propagatecxx_builtin_include_filesto local-strategy invocations.PR #756's docstring foresaw this: "tools that re-serialize the toolchain's compile flags into their own build scripts (rules_foreign_cc make/cmake builds, embedded compiler-flag strings) drop the quotes" — the new
-imacrosform doesn't have the quote-loss bug but instead has an analogous file-path-loss bug for the same class of consumers.Proposed fixes (pick one)
-imacros redacted_dates_pathblock. Smallest API surface; opt-in; ships immediately.redacted_dates_path = str(rctx.path("redacted_dates.h")). Bakes machine-specific path into config — breaks remote execution cache.cxx_builtin_include_filesto local-strategy cargo_build_script. Out of scope here.Happy to send a PR implementing option 1 (
disable_date_redactionfeature) if maintainers want.Environment