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

feat: add patch_node_fs attribute to js_binary and js_run_binary for easy opt-out #281

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

gregmagolan
Copy link
Member

No description provided.

@gregmagolan gregmagolan requested review from alexeagle and jbedard July 12, 2022 01:18
@gregmagolan gregmagolan force-pushed the opt_out_fs_patches branch 5 times, most recently from 4537e58 to fe09ce8 Compare July 12, 2022 02:46
js/private/js_run_binary.bzl Outdated Show resolved Hide resolved
js/private/test/node-patches/BUILD.bazel Show resolved Hide resolved
@gregmagolan gregmagolan changed the title feat: add patch_node_fs_api attribute to js_binary and js_run_binary for easy opt-out feat: add patch_node_fs attribute to js_binary and js_run_binary for easy opt-out Jul 12, 2022
@@ -168,6 +168,19 @@ _ATTRS = {
values = _LOG_LEVELS.keys(),
default = "error",
),
"patch_node_fs": attr.bool(
Copy link
Member

Choose a reason for hiding this comment

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

Should we try to put the word "sandbox" in the name since "patch" normally implies a bug-fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

sandbox wouldn't be accurate either since the guards prevent leaving execroot, runfiles and the sandbox. I create a pretty verbose docstring on this one. most users will never need to touch it but it does leave an easy opt-out if needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

node_fs_guards perhaps but I like "patch" as it is technically what we are doing by changing the behavior of the node fs code

Copy link
Member

Choose a reason for hiding this comment

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

I guess I'd worry that fs will become overloaded and will mean patching a lot more then the node "fs" library like the name implies 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully we won't be patching much more in node so we won't to worry about it :)

Copy link
Member

Choose a reason for hiding this comment

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

🐒 -patch

@@ -168,6 +168,19 @@ _ATTRS = {
values = _LOG_LEVELS.keys(),
default = "error",
),
"patch_node_fs": attr.bool(
Copy link
Member

Choose a reason for hiding this comment

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

The child process patch will also have a flag? patch_node_child_process?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the child process fs patches should just be implied if this is true since they are the same fs patches applied to spawn processes; just more a more robust implementation that covers the child spawn case when we get to it for 1.1

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah, you're correct... it's the same patches but just properly applied to sub-processes as well

@gregmagolan gregmagolan merged commit aaae798 into main Jul 12, 2022
@gregmagolan gregmagolan deleted the opt_out_fs_patches branch February 22, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants