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
π Bug Report β Runtime APIs: node:fs: lstat, readlink, readdir and realpath fail on paths through a symlinked directoryΒ #8811
When a path uses a directory that is symlinked, lstat, readlink, readdir and realpath all fail or return the wrong result, while Node.js follows the link. readFile and stat on the same paths already work. I tested it on workerd 1.20261121.1.
fs.mkdirSync('/tmp/r/store/pkg',{recursive: true});fs.writeFileSync('/tmp/r/store/pkg/package.json','{}');fs.symlinkSync('/tmp/r/store/pkg/package.json','/tmp/r/store/pkg/main');fs.mkdirSync('/tmp/r/node_modules');fs.symlinkSync('/tmp/r/store/pkg','/tmp/r/node_modules/pkg');fs.symlinkSync('/tmp/r/node_modules/pkg','/tmp/r/again');// Node.js returns the file's stats, workerd errors with ENOENTfs.lstatSync('/tmp/r/node_modules/pkg/package.json');// Node.js returns '/tmp/r/store/pkg/package.json', workerd errors with ENOENTfs.readlinkSync('/tmp/r/node_modules/pkg/main');// Node.js returns ['main', 'package.json'], workerd errors with EINVALfs.readdirSync('/tmp/r/node_modules/pkg');// Node.js returns '/tmp/r/store/pkg/package.json', workerd errors with ENOENTfs.realpathSync('/tmp/r/node_modules/pkg/package.json');// Node.js returns '/tmp/r/store/pkg', workerd returns '/tmp/r/node_modules/pkg'fs.realpathSync('/tmp/r/again');
The problem is that none of these calls follow a link in the middle of a path. readdir also doesn't follow a link at the end of the path, and realpath resolves at most one link. This for instance breaks pnpm-like layouts, where all the packages are links.
Activity