Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up the semantics of Command.arguments[0] #210

Merged
merged 1 commit into from
Apr 12, 2022

Conversation

EdSchouten
Copy link
Collaborator

@EdSchouten EdSchouten commented Nov 12, 2021

Bazel Buildfarm, Buildgrid and Buildbarn all perform resolution relative
to the working directory of an action; not the input root directory.
Instead of requiring that all implementations are updated, we should
consider just altering the spec.

Performing resolution relative to the input root directory can also be
very tricky, as it means that argv[0] as visible to the calling process
must also be rewritten. Applications may get confused otherwise. For
example, consider the case where the working directory is "foo" and
argv[0] is "bar/baz". In that case argv[0] as visible to the calling
process must become "../bar/baz" or be made absolute. Making it absolute
is inconsistent with what Bazel does right now. Attempting to keep it
relative can be complex when symbolic links are involved.

Furthermore, the specification doesn't mention what kind of path
separators are used for argv[0]. The only reasonable solution here is to
use path separators that are native to the host, as successive arguments
also need to be provided in that form.

EDIT: As discussed on the mailing list, let's re-add PATH resolution. RBE, Buildbarn and Bazel Buildfarm all do that right now.

@google-cla google-cla bot added the cla: yes Pull requests whose authors are covered by a CLA with Google. label Nov 12, 2021
@EdSchouten EdSchouten force-pushed the eschouten/20211112-argv0 branch from 8fedefa to 3773a16 Compare November 12, 2021 16:27
@EdSchouten EdSchouten force-pushed the eschouten/20211112-argv0 branch from 3773a16 to b6c86e1 Compare January 11, 2022 13:07
@EdSchouten EdSchouten force-pushed the eschouten/20211112-argv0 branch 2 times, most recently from 8b41954 to e81f7e3 Compare January 14, 2022 16:37
Copy link
Contributor

@mostynb mostynb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bergsieker bergsieker removed the request for review from buchgr February 10, 2022 22:25
Bazel Buildfarm, Buildgrid and Buildbarn all perform resolution relative
to the working directory of an action; not the input root directory.
Instead of requiring that all implementations are updated, we should
consider just altering the spec.

Performing resolution relative to the input root directory can also be
very tricky, as it means that argv[0] as visible to the calling process
must also be rewritten. Applications may get confused otherwise. For
example, consider the case where the working directory is "foo" and
argv[0] is "bar/baz". In that case argv[0] as visible to the calling
process must become "../bar/baz" or be made absolute. Making it absolute
is inconsistent with what Bazel does right now. Attempting to keep it
relative can be complex when symbolic links are involved.

Furthermore, the specification doesn't mention what kind of path
separators are used for argv[0]. The only reasonable solution here is to
use path separators that are native to the host, as successive arguments
also need to be provided in that form.
@EdSchouten EdSchouten force-pushed the eschouten/20211112-argv0 branch from e81f7e3 to 3d0b812 Compare February 16, 2022 11:06
@EdSchouten
Copy link
Collaborator Author

Hey @ulfjack, could you approve this PR if you're fine with the latest version?

@bergsieker bergsieker merged commit e956416 into bazelbuild:main Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Pull requests whose authors are covered by a CLA with Google.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants