You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openAsBlob only looks at nanoseconds part of mtime to detect modifications #67283
On a filesystem with low-precision timestamps (e.g. FAT), openAsBlob a file, then edit the file but keep the size, then read from the blob. This should give NotReadableError because the file has changed, but it works because is_modified only checks tv_nsec, which is always 0 on FAT, and ignores tv_sec.
Runnable repro (from Claude), requires you to pass a path to a writable directory on a FAT volume:
'use strict';constfs=require('fs');constpath=require('path');if(process.argv.length!==3){console.error('must pass a path to a directory on a FAT volume');process.exit(1);}constdir=fs.mkdtempSync(path.join(process.argv[2],'blob-mtime-'));constfile=path.join(dir,'x');fs.writeFileSync(file,'from-a');(async()=>{constblob=awaitfs.openAsBlob(file);console.log('original: ',awaitblob.text());awaitnewPromise((r)=>setTimeout(r,2500));// Past FAT's 2s granularity.fs.writeFileSync(file,'EDITED');// Same size.console.log('mtimeNs: ',fs.statSync(file,{bigint: true}).mtimeNs);try{console.log('after rewrite: ',awaitblob.text());}catch(e){console.log('after rewrite: ',e.name);}fs.rmSync(dir,{recursive: true});})();
On MacOS you can make and mount a FAT volume like this:
Activity