Multiple open Handles for the same file don't share metadata, meaning the inode can get out of sync.
Repro:
import * as fs from '@zenfs/core/promises'; // more readable
await fs.writeFile('example.txt', 'Hello World');
const a = fs.open('example.txt', 'r+');
const b = fs.open('example.txt', 'r+');
await a.truncate(5); // Contents are now "Hello"
const { size } = await b.stat();
assert.equal(size, 5); // fails because `b` doesn't have the updated metadata from `a`
The fix for this is to have Handles share their inode via a semi-global cache, which can be keyed using the FS' uuid and the file's ino.
Multiple open
Handles for the same file don't share metadata, meaning the inode can get out of sync.Repro:
The fix for this is to have
Handles share theirinodevia a semi-global cache, which can be keyed using the FS'uuidand the file'sino.