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
Blob created by openAsBlob changes contents after chdir #67282
fs.openAsBlob('x') in a directory containing a file named x, then process.chdir to a different directory containing such a file with the same same size and same nanoseconds part on its mtime (presumably this is always satisfied on filesystems without high-precision mtimes), then read.
Runnable repro (from Claude):
'use strict';constfs=require('fs');constos=require('os');constpath=require('path');constroot=fs.mkdtempSync(path.join(os.tmpdir(),'blob-bug-'));consta=path.join(root,'a');constb=path.join(root,'b');fs.mkdirSync(a);fs.mkdirSync(b);fs.writeFileSync(path.join(a,'x'),'from-a');fs.writeFileSync(path.join(b,'x'),'from-b');// Same size as a/x.constt=1_700_000_000;fs.utimesSync(path.join(a,'x'),t,t);// Same size, mtime an hour later but tv_nsec still 0.fs.utimesSync(path.join(b,'x'),t+3600,t+3600);(async()=>{process.chdir(a);constblob=awaitfs.openAsBlob('x');console.log('before chdir:',awaitblob.text());// from-aprocess.chdir(b);console.log('after chdir: ',awaitblob.text());// from-bfs.rmSync(root,{recursive: true});})();
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
Once opened, the blob should not care if you later chdir.
Activity