-
Notifications
You must be signed in to change notification settings - Fork 575
build.rs stdout creates non-deterministic issues #2974
Description
The build script runner infers "execroot" from $CWD. This "execroot" includes sandbox-specific paths which get included in stdout. For instance, when building cc-rs:
...
ARFLAGS = None
running: ZERO_AR_DATE="1" "/usr/bin/ar" "cq" "/var/tmp/bazel-output/sandbox/linux-sandbox/3676/execroot/_main/bazel-out/k8-opt/bin/external/crate_index__psm-0.1.21/_bs.out_dir/libpsm_s.a" "/var/tmp/bazel-output/sandbox/linux-sandbox/3676/execroot/_main/bazel-out/k8-opt/bin/external/crate_index__psm-0.1.21/_bs.out_dir/src/arch/x86_64.o"
exit status: 0
running: "/usr/bin/ar" "s" "/var/tmp/bazel-output/sandbox/linux-sandbox/3676/execroot/_main/bazel-out/k8-opt/bin/external/crate_index__psm-0.1.21/_bs.out_dir/libpsm_s.a"
exit status: 0
cargo:rustc-link-lib=static=psm_s
cargo:rustc-link-search=native=/var/tmp/bazel-output/sandbox/linux-sandbox/3676/execroot/_main/bazel-out/k8-opt/bin/external/crate_index__psm-0.1.21/_bs.out_dir
This path part is variable and changes from build to build: /var/tmp/bazel-output/sandbox/linux-sandbox/3676. When converted to build script outputs (rules_rust's understanding of cargo:rustc-...-style lines) this build-specific "execroot" is redacted.
The raw (sandbox path dependent) stdout however is written as is as an output, and the output is tracked by bazel. In some cases this can be fixed in the create itself, so that e.g. OUT_DIR is not actually used (see here, here and here for instance).
However in general, what is the benefit of keeping stdout.log in the build outputs? Would it make sense to disable this in general and make it opt-in (potentially on a crate by crate basis)?