Skip to content

[WASMFS] Workaround for missing directory rename in OPFS #24227

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rickg-hcl
Copy link

@rickg-hcl rickg-hcl commented Apr 30, 2025

Fixes: #24162

In September of 2021, we really needed to OPFS for our emscripten app, so we undertook the challenge and built a component that we could integrate into our emscripten fork that would provide OPFS support, but only for the calls that we used. We have been shipping it since July of 2022. We did this because the full emscripten support for OPFS seemed to be taking longer than we could afford.

Recently, we noticed that the WASMFS support had gone from pre-release to ready, so we started evaluating using that instead of our side component. There appears to be only 3 issues blocking us:

#24123
#24141
#24162

The first two of these we can work around. The third is the lack of support in OPFS for renaming directories.
We had implemented a workaround in our side component. It involves just copying the directories and moving the files into them, recursively. This PR is just a port of that workaround into the wasfms structure. if/when OPFS ever supports the move() method on a directory handle, it will be used instead of this workaround with no code change needed.

I’ve tested this PR with our application and it works the same as our original solution.

@sbc100 sbc100 requested a review from tlively April 30, 2025 20:45
@sbc100
Copy link
Collaborator

sbc100 commented Apr 30, 2025

Could you update the PR title and description with something a little more descriptive? Is there an open bug for this fix?

@rickg-hcl
Copy link
Author

I updated the description. This is a "fix" for #24162 in that it works around the missing directory rename functionality in opfs.

@sbc100 sbc100 changed the title 21462 - work around directory rename [WASMFS] Workaround for missing directory rename in OPFS Apr 30, 2025
@sbc100 sbc100 added the wasmfs label Apr 30, 2025
@tlively
Copy link
Member

tlively commented May 1, 2025

Can you please update the PR description to describe the problem (e.g. the reason the backend does not already support directory renames) and the solution (e.g. what you are doing in the workaround and what limitations the approach might have)? That will help contextualize the code for review.

@rickg-hcl
Copy link
Author

updated description and refreshed branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasmfs opfs rename directory fails with busy
3 participants