fs: treat std::errc::permission_denied as EPERM error#64017
Open
louiellan wants to merge 1 commit into
Open
Conversation
In the thrown exception, `std::errc::permission_denied` is already treated as an `EPERM` error, but it is not included in one of the omittable errors when retrying the `RmSync` operation. This commit includes it. This also fixes the `retryDelay` calculation on Windows where the `retryDelay` is divided by `1000` but the win32's `Sleep` function takes the argument as an `ms` unit, dividing the supplied `ms` unit further to a much smaller delay. Signed-off-by: louiellan <louie.lou.llaneta@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64016
In the thrown exception,
std::errc::permission_deniedis already treated as anEPERMerror, but it is not included in one of the omittable errors when retrying theRmSyncoperation. This commit includes it.This also fixes the
retryDelaycalculation on Windows where theretryDelayis divided by1000but the win32'sSleepfunction takes the argument as anmsunit, dividing the suppliedmsunit further to a much smaller delay.I tried writing a test for this fix but node doesn't do file lock when opening a file, even if it's ran as another process, and running python as a child process in the test file yields race conditions (i.e., python does create the folder and the file to be locked but the
jstest fails because it can't do armSyncbecause the file and the folder does not exist)But I validated the reproducible steps mentioned in the issue with this fix, the
rmSyncnow delays the retries and is around15000ms, the same as the asynchronousfs.rm