-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
fs: simplify copy operations and more cleanups #31038
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
6bc122d
to
920e442
Compare
I noticed late that there's actually a test added in #635 that checks that inherited properties are checked as well as fs option (this will likely not work everywhere but at least in streams). I decided to remove the failing test. I think it's a good idea not to fall back to the prototype but this seems to be a breaking change. |
@nodejs/fs |
Removing the |
This is mainly a minor refactoring to reduce the code overhead with the side effect of removing support for prototype properties in passed through options. Copying options is mostly done for enumerable own properties and prototype properties are ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I‘m not sure I understand the breaking change. Can you please articulate it further? What would break?
@mcollina inherited object properties won't be accepted as options anymore. So if you do e.g.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think doing a breaking change for a refactoring is worth it in this case.
@mcollina the question is if we want to officially support inherited properties or not. I was quite surprised when I noticed the failure that we allowed something like that. AFAIK we do not have any guarantees of supporting inherited properties in any other API. We partially prevent this actively to prevent attacks based on prototype pollution and there are open PRs to do this even more: #30008 and #30063. I guess it might be a good for the @nodejs/tsc to weight in if we want to generically support inherited properties or if we should instead actively recommend against relying on any prototype properties while passing through options. I am fine to close this if others want to keep the current behavior. // cc @watson |
I'm happy with the change as long as it is clearly spelled out and it's a direction we would like the project to go. |
8ae28ff
to
2935f72
Compare
@lundibundi everybody can add the tsc-agenda tag. May I ask to formulate a question to the tsc when you do so? Are you asking for a vote on this? My take on the -1 is on the breakage for the sake of a refactoring, which is the description of this PR. |
I think the question would be (only partially related to this PR): AFAIK none of our APIs provide any explicit guarantees of supporting inherited properties in @BridgeAR could you please clarify if the above is correct? (feel free to just edit this comment) |
This is just a minor refactoring to reduce the code overhead.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes