-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Rethink recursive
flag (and design more generally) for fs.rmdir
#34278
Comments
I have vague recollections that something similar may have been mentioned during the recent OpenJS World Collaborator summit during the Tooling group's session cc @nodejs/tooling |
cc @nodejs/fs as well |
@CxRes Thanks for opening this, I've been meaning to do this, but didn't make it a priority. I agree with @CxRes on his points, but would just like to add a bit more clarity. For me the biggest problem with the current system is that
Each of these things could well be their own separate option, and the error-swallowing and retry options would be equally useful for non-recursive For that reason, |
cc @bcoe |
I made a PR #28208 to add I was opposed to adding it as a flag to The Tooling Group is discussing making more |
a few thoughts:
|
@boneskull Thanks for chiming in!!! Just to clarify a couple of points in response to your thoughts:
|
Not saying it's wise or unwise, or even something we've continued to actually do, but the
|
In the case of the default options I think this is still (mostly?) true. I don't have any objection to accepting an option to deviate from the normal mode of operation. I also don't object to moving recursive functions to separate names, though this will increase the number of functions exported by |
I didn't highlight this well in my earlier post; to be perfectly clear, you can delete a file with |
We were just discussing this issue in the Tooling Group meeting today. We do agree that being able to use |
Correction on my earlier post, I said:
This is partially untrue. Retry logic is off by default (unlike |
if unlink can fail for the same reason on win32, perhaps that would want a maxRetries flag too. but I don’t see anything particularly heinous about an option that needs a second option to do anything. silently ignoring it is maybe a problem, but it just depends how much type validation node wants to be doing. |
@RyanZim @CxRes I think it would be fairly disruptive to remove the We originally explored introducing rimraf as its own method and could not reach consensus, @cjihrig unblocked the logjam on the discussion by putting forward a candidate PR with the functionality as it is today. tldr; both approaches were explored.
I think if it helped EDITED: basically, given it's experimental, I think we should be open to considering breaking changes to rimdir recursive, e.g., error handling, I'm less convinced we should split it off of rmdir, just in the name of matching POSIX. |
Started composing this before @iansu commented; hence the slight disconnect. I watched the discussion about this at the @nodejs/tooling meeting today (recording: https://www.youtube.com/watch?v=ndCLeX40g6Q); a few comments:
Those are my thoughts; things don't have to be completely done my way, but at bare minimum, we need to stop deleting files with recursive Retry logic is less of an issue; should maybe consider porting it to plain |
I was listening to the @nodejs/tooling meeting as well. One suggestion, that seems to have been not discussed is the possibility of splitting Also what would be a good way to get in touch with the @nodejs/tooling group? There is another inconsistency issue that's driving me nuts that falls squarely in that domain. |
One possibility is to open an issue in the https://github.com/nodejs/tooling repository. |
@RyanZim That's possible but I don't think we can say this based on npm stats alone. A project using |
At the moment, recursive |
@RyanZim sorry for misunderstanding. |
After discussions with the tooling group, and with the TSC, we ultimately did decide to introduce We are however, not opting to remove the
|
This was missed in commit 35b17d9. Refs: nodejs#34278 Refs: nodejs#35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This was missed in commit 35b17d9. Refs: #34278 Refs: #35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu> PR-URL: #36131 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This was missed in commit 35b17d9. Refs: #34278 Refs: #35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu> PR-URL: #36131 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This was missed in commit 35b17d9. Refs: #34278 Refs: #35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu> PR-URL: #36131 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This was missed in commit 35b17d9. Refs: #34278 Refs: #35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu> PR-URL: #36131 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This was missed in commit 35b17d9. Refs: #34278 Refs: #35171 Signed-off-by: Anders Kaseorg <andersk@mit.edu> PR-URL: #36131 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs#34278 PR-URL: nodejs#35171 Reviewed-By: Christopher Hiller <boneskull@boneskull.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Is your feature request related to a problem? Please describe.
We (@me and @RyanZim) have concerns regarding API direction for
fs.rmdir
flags.Up till now node's fs API was modeled closely to POSIX. The new flags for
fs.rmdir
, in particular, therecursive
flag is a break from this tradition. It is especially odd thatrmdir
can delete a file. Other difficulties include not knowing if you are deleting a file/folder that does not already exist because errors are not reported in recursive mode (at least users should be able to opt out of this behaviour).We refer you to our discussion at fs-extra which builds on fs (subsequent to the PR being closed).
jprichardson/node-fs-extra#785
Describe the solution you'd like
A
fs.rm
consistent with POSIXrm
. This would meanfs.rm
will have the recursive semantics instead offs.rmdir
which will remain a lower level function.Describe alternatives you've considered
One alternative would be to implement recursive semantics in user land, though I personally feel that we should use/expose OS API's maximally through node. We are open to other suggestions. This is a good time to address this issue while the feature is still experimental!
The text was updated successfully, but these errors were encountered: