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.
This PR retries
rename
upon gettingEACCES
. I've included data about how many retries are likely necessary.On my system (WSL1 Ubuntu 20.04, omitting hardware details), the
EACCES
issue makes it impossible to use esy to install any of the Dream examples or use Dream's quick start. As the data below shows, every installation is expected to fail withEACCES
, if it is not worked around.The underlying
EACCES
issue seems to be a long-standing problem on WSL1 (microsoft/WSL#1529, microsoft/WSL#3395), and I think we do have to work around it in esy. I'm not sure what is causing theEACCES
exactly. I think there are two main classes of possibilities:rename
. I think the self-interaction is due to WSL rather than Lwt or another library. Since I compiled esy on WSL, it is using Lwt's Unix (rather than Windows) C code. Since the Unix code seems to work fine on Linux and Mac, this suggests a WSL issue.I built esy with this patch under WSL and ran clean
esy install
s in Dream's full-stack ReScript example, using this script:The example was checked out into NTFS. The system was freshly restarted, and VSCode (or anything similar) was not running.
I used a version of this patch with a print showing the number of attempts before
rename
succeeds, and got the following results from 5 runs:Based on this, I naively estimated that if a
rename
needs more than 1 attempt, the number of attempts needed decays by a factor of 4 at each step. I set the limit on the number of attempts naively to 8, thus expecting one failure in about 500esy install
attempts of the Dream ReScript example, under all these simplified assumptions.The delay between attempts is (over) one second, so this means that upon legitimate
EACCES
, users will have to wait eight seconds to get an error message. I think there are two ways to address this:rename
whenrename
fails. Do we have a recursive copy available in esy or its dependencies? Is it fine to leave the source directory intact?EACCES
on WSL, giving users a hint about potential VSCode or other watchers, and what else they can try to solve the problem.Closes #1363.
Probably fixes #1097, some of the reports after the first one.
Probably fixes #1083.
Probably fixes #593, but I haven't looked into non-WSL Windows yet.
Probably fixes aantron/dream#63.
cc @bryphe, @rizo, @jordwalke, @iMplode-nZ, @a-c-sreedhar-reddy, @srirajshukla, @andreypopp