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 4 commits into
base: main
Choose a base branch
from

Conversation

rickg-hcl
Copy link

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

The origin private file system does not support directory rename. I don't know why.

This PR will implement a workaround for that that will only execute after the rename attempt throws an exception, so that 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.

This is accomplished by creating new directories in the target, and moving the files into them, recursively.

One side effect is that the handle cache for the renamed directory will be cleared, since the file and directory handles will be different.

Fixes: #24162

I don't know how to fix the circleci failures that seem unrelated to this code change.

@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.

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