John,
Op za 13 nov. 2021 om 00:40 schreef John Millikin <
jmil...@stripe.com>:
> Changing the resolution of non-absolute argv[0] from input_root to workingdir seems like a breaking change for the implementations that are currently in compliance with the spec.
That's why I'm trying to get an inventory of what existing
implementations do. Here's another data point: Goma Server also
resolves relative to the working directory and respects $PATH:
https://chromium.googlesource.com/infra/goma/server/+/refs/heads/main/remoteexec/exec.go#738
So far I haven't been able to find a single implementation that does
resolve the path relative to the input root. I am very interested in
hearing what EngFlow does, for example. It may be the case that "the
implementations that are currently in compliance with the spec" is, in
fact, the empty set. If that is the case, then it would be a complete
waste of time for everyone involved to stick to the spec and require
that everyone follows suit. It simply means that the spec was written
in a non-intuitive way.
I think that discussing whether we should permit PATH resolution is
worth having, considering that Bazel Buildfarm on Windows and
Buildgrid deviate from the rest.
I think you are providing an argument here for why we *should* in fact
support PATH resolution: Bazel already does it for local execution. I
wouldn't consider it predictable if local execution (at least through
Bazel) has semantics that differ from how remote execution works. I
disagree with your statement that PATH resolution is unpredictable:
- The Remote Execution protocol allows specifying environment
variables. I think that almost everyone that runs a somewhat serious
remote execution setup enables --incompatible_strict_action_env in
combination with --action_env=PATH=.... If we require that PATH
resolution must consider the value of PATH specified in the Command
message, then the list of paths to consider on a remote worker is
fully predictable.
- There is always a way to prevent PATH lookups: prepend relative
paths with "./"
Sure, this doesn't rule out that PATH resolution doesn't always yield
the same results, but that implies some form of non-deterministic
worker configuration that is no different from running a fleet of
workers that have deviating file system contents, kernel versions, CPU
frequencies or memory sizes. It's up to cluster operators to prevent
this from happening.
> Clients that want behavior to be "whatever the shell does" can wrap their command in their preferred shell prior to submitting it to the remote execution service.
Slight nitpick: Whether we do PATH resolution is unrelated to the
subject of shell interpreters, as shell interpreters aren't the only
tools that process PATH. This is about whether we want to use libc
functions execv() or execvp(). POSIX provides pretty clear semantics
for those functions and how they process the PATH environment
variable:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
Let's make sure the discussion remains focused on that.
--
Ed Schouten <
e...@nuxi.nl>