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

[install] Use file argument for actions, not template substitution #16252

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Dec 18, 2021

Towards #7331.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added status: do not merge priority: medium status: do not review release notes: none This pull request should not be mentioned in the release notes labels Dec 18, 2021
@jwnimmer-tri
Copy link
Collaborator Author

@drake-jenkins-bot mac-big-sur-clang-bazel-experimental-release please

@jwnimmer-tri
Copy link
Collaborator Author

+@rpoyner-tri for feature review, please.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform), needs at least two assigned reviewers (waiting on @jwnimmer-tri)


CMakeLists.txt, line 446 at r1 (raw file):

endif()

# N.B. If you are testing the CMake API and making changes to `install.py`,

s/install.py/installer.py/


tools/install/test/install_meta_test.py, line 1 at r1 (raw file):

"""Tests the behavior of targets that use `install.py`."""

s/install.py/installer.py/


tools/install/installer.py, line 454 at r1 (raw file):

    with open(args.actions, "r", encoding="utf-8") as f:
        actions = f.read()
    exec(actions)

I'd like to see some harm reduction here, like input validation (currently only 2 operations need be supported), or values of global or local dictionaries that would limit arbitrary execution.

@jwnimmer-tri jwnimmer-tri force-pushed the untemplate-install-py-in branch from 2b0e5c5 to fbf1358 Compare December 20, 2021 15:09
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform), needs at least two assigned reviewers (waiting on @rpoyner-tri)


CMakeLists.txt, line 446 at r1 (raw file):

Previously, rpoyner-tri (Rick Poyner (rico)) wrote…

s/install.py/installer.py/

Done.


tools/install/test/install_meta_test.py, line 1 at r1 (raw file):

Previously, rpoyner-tri (Rick Poyner (rico)) wrote…

s/install.py/installer.py/

Done.


tools/install/installer.py, line 454 at r1 (raw file):

Previously, rpoyner-tri (Rick Poyner (rico)) wrote…

I'd like to see some harm reduction here, like input validation (currently only 2 operations need be supported), or values of global or local dictionaries that would limit arbitrary execution.

Done via TODO. I'm on the same page as you here, but I wanted to keep the template-vs-argument change small. I agree that we should rework the actions file specification in the future.

@jwnimmer-tri
Copy link
Collaborator Author

+@ggould-tri for platform review per schedule, please.

Copy link
Contributor

@ggould-tri ggould-tri left a comment

Choose a reason for hiding this comment

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

:lgtm: ; one nit.

Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform) (waiting on @jwnimmer-tri and @rpoyner-tri)


tools/install/install.bzl, line 499 at r2 (raw file):

            "#!/bin/bash",
            "tools/install/installer --actions {} \"$@\"".format(
                actions_file.short_path,

minor: shlex.quote(actions_file.short_path) would be safer.
For extremely relative definitions of "safer".

If skylark doesn't have shlex then as a fallback quoting the {} would get most of the benefit.

@jwnimmer-tri jwnimmer-tri force-pushed the untemplate-install-py-in branch from fbf1358 to fa0b3b9 Compare December 20, 2021 16:38
Copy link
Contributor

@ggould-tri ggould-tri left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform) (waiting on @rpoyner-tri)

Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform) (waiting on @rpoyner-tri)


tools/install/install.bzl, line 499 at r2 (raw file):

Previously, ggould-tri wrote…

minor: shlex.quote(actions_file.short_path) would be safer.
For extremely relative definitions of "safer".

If skylark doesn't have shlex then as a fallback quoting the {} would get most of the benefit.

Done.

If someone puts a shell character into their bazel target name, I'll let them keep the pieces.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform) (waiting on @jwnimmer-tri)

@jwnimmer-tri
Copy link
Collaborator Author

@rpoyner-tri this PR still needs your emoji, when you're ready.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),ggould-tri(platform) (waiting on @jwnimmer-tri)

@rpoyner-tri rpoyner-tri merged commit b4723a6 into RobotLocomotion:master Dec 20, 2021
@jwnimmer-tri jwnimmer-tri deleted the untemplate-install-py-in branch December 20, 2021 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants