bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Action in default shell environment can't locate executable using client $PATH variable

Open slyrz opened this issue 7 years ago • 3 comments

Description of the problem:

I have an action like

# `example` is a command in a directory of the caller's $PATH variable
ctx.actions.run(
  executable = 'example', 
  use_default_shell_env = True,
  ...
)

that fails with

src/main/tools/linux-sandbox-pid1.cc:427: "execvp(example, ...)": No such file or directory

unless --action_env=PATH gets passed to the build command. Alternatively, using an absolute path name for the executable works as well.

The action used to work with previous bazel versions.

What operating system are you running Bazel on?

Ubuntu 18.04

What's the output of bazel info release?

release 0.21.0

Have you found anything relevant by searching the web?

Originally posted in https://github.com/bazelbuild/bazel/issues/7026#issuecomment-453738095

slyrz avatar Jan 12 '19 20:01 slyrz

I believe this is https://github.com/bazelbuild/bazel/issues/7026? --incompatible_strict_action_env was just reverted to false today. Could you try doing that as well?

jmmv avatar Jan 18 '19 18:01 jmmv

@jmmv Thanks for your comment. Disabling this option works. So far the following two invocations make the build pass under bazel version 0.21:

  1. bazel build --action_env=PATH <target>
  2. bazel build --incompatible_strict_action_env=false <target>

I share your opinion that this issue here is just an effect of #7026. Shall we close this one?

slyrz avatar Jan 20 '19 20:01 slyrz

Yes! Thanks.

jmmv avatar Jan 24 '19 20:01 jmmv