Skip to content

Commit 01b7505

Browse files
authored
Set PATH to something invalid (#40)
This makes sure that if mojo attempts to find something on the PATH it fails. Everything it needs should come through the environment variables. This is a safety net for it trying to find the system linker or linker driver.
1 parent 59fde9b commit 01b7505

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mojo/mojo_library.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def _mojo_library_implementation(ctx):
3939
progress_message = "%{label} building mojo package",
4040
env = {
4141
"MODULAR_CRASH_REPORTING_ENABLED": "false",
42+
"PATH": "/dev/null", # Avoid using the host's PATH
4243
"TEST_TMPDIR": ".", # Make sure any cache files are written to somewhere bazel will cleanup
4344
},
4445
use_default_shell_env = True,

mojo/private/mojo_binary_test.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def _mojo_binary_test_implementation(ctx, *, shared_library = False):
126126
"MODULAR_MOJO_MAX_COMPILERRT_PATH": "/dev/null", # Make sure this fails if accessed
127127
"MODULAR_MOJO_MAX_LINKER_DRIVER": "/dev/null", # Make sure this fails if accessed
128128
"MODULAR_MOJO_MAX_LLD_PATH": mojo_toolchain.lld.path,
129+
"PATH": "/dev/null", # Avoid using the host's PATH
129130
"TEST_TMPDIR": ".",
130131
},
131132
use_default_shell_env = True,

0 commit comments

Comments
 (0)