From 1d27ccb849c628469cdd30b28d84b418671a383a Mon Sep 17 00:00:00 2001 From: Markus Hofbauer Date: Thu, 13 Nov 2025 11:41:09 -0800 Subject: [PATCH] Flip incompatible_strict_action_env Work towards https://github.com/bazel-contrib/SIG-rules-authors/issues/42. Fixes https://github.com/bazelbuild/bazel/issues/7026 Closes #26587. PiperOrigin-RevId: 831944371 Change-Id: I397faa463a709b2367d5a6eebc678077c4029bbb --- .../devtools/build/lib/bazel/rules/BazelRuleClassProvider.java | 2 +- .../devtools/build/lib/remote/options/RemoteOptions.java | 3 +-- src/test/shell/bazel/bazel_test_test.sh | 2 +- src/test/shell/bazel/starlark_repository_test.sh | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java index ec45041b5631be..6907f4d845118b 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java @@ -73,7 +73,7 @@ public static class StrictActionEnvOptions extends FragmentOptions { @Option( name = "incompatible_strict_action_env", oldName = "experimental_strict_action_env", - defaultValue = "false", + defaultValue = "true", documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE}, diff --git a/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java b/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java index 50108c95233611..e8a91ea8738bc6 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java +++ b/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java @@ -739,8 +739,7 @@ public RemoteOutputsStrategyConverter() { + " affected actions.\n\n" + "In order to successfully use this feature, you likely want to set a custom" + " --host_platform together with --experimental_platform_in_output_dir (to normalize" - + " output prefixes) and --incompatible_strict_action_env (to normalize environment" - + " variables).") + + " output prefixes).") public Scrubber scrubber; @Option( diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index 7bd2f97ac1b741..333867208df207 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -346,7 +346,7 @@ EOF # With --action_env=PATH, the local PATH is forwarded to the test. PATH=$PATH:$PWD/scripts bazel test //testing:t1 -s --run_under=hello \ - --test_output=all >& $TEST_log || fail "Expected success" + --test_output=all --action_env=PATH >& $TEST_log || fail "Expected success" expect_log 'hello script!!! testing/t1' # We need to forward the PATH to make it work. diff --git a/src/test/shell/bazel/starlark_repository_test.sh b/src/test/shell/bazel/starlark_repository_test.sh index 1b0a7a2f5b6b47..00791c5f150097 100755 --- a/src/test/shell/bazel/starlark_repository_test.sh +++ b/src/test/shell/bazel/starlark_repository_test.sh @@ -2897,7 +2897,7 @@ EOF repo_cache_dir=$TEST_TMPDIR/repository_cache trap 'rm -rf ${repo_cache_dir}' EXIT - bazel build --repository_cache="$repo_cache_dir" \ + bazel build --repository_cache="$repo_cache_dir" --action_env=PATH \ //:unique_hashes >& $TEST_log || fail "expected bazel to succeed" assert_equals 1 "$(wc -l < bazel-bin/unique_hashes | tr -d ' ')" assert_equals $sha "$(cat bazel-bin/unique_hashes)"