whatwg / fs

File System Standard
https://fs.spec.whatwg.org/
Other
237 stars 20 forks source link

Require an exclusive lock in removeEntry() #73

Open a-sully opened 2 years ago

a-sully commented 2 years ago

For the sake of backwards compatibility, removeEntry() currently only requires acquiring a shared lock in Chromium (though this is not specified). This means that you cannot remove a file with an open Access Handle, but you can remove a file with an open WritableFileStream. See https://github.com/whatwg/fs/issues/34#issuecomment-1273961101 for context.

The removeEntry() method should take an exclusive lock, matching #9. At least until we change the locking paradigm to not be based on "exclusive" and "shared" locks in #34.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

a-sully commented 1 year ago

Update: removeEntry() has been taking an exclusive lock on Chromium browsers for a while now. See https://crbug.com/1254078

This PR is also incorrect as written, since the lock should not be on the directory itself but on the child being removed. I'll update that before sending for review...

Anyways, I filed #138 to track updating updating the spec both for removeEntry() and remove()