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
Recursive fs.readdirSync tries to recurse into Unix domain socket #52159
That code has been wrong for a long time. Didn't matter when it was just used for module loading, since it would end up being "module not found", but using it here exposes the problem.
Activity
bakkot commentedon Mar 20, 2024
Amusingly this works if you pass
withFileTypes: true, which indicates that the problem is these lines.Edit: Ah, yeah, looks like this is wrong.
s->st_mode & S_IFDIRwill return1for sockets because the mask for sockets is a superset of the mask for directories. The correct test for directories is(s->st_mode & S_IFMT) == S_IFDIR.That code has been wrong for a long time. Didn't matter when it was just used for module loading, since it would end up being "module not found", but using it here exposes the problem.
theanarkh commentedon Mar 20, 2024
I think
!!(s->st_mode & S_IFDIR)should be changed toS_ISDIR(s->st_mode)innode_file.cc.src: use `S_ISDIR` to check if the file is a directory
src: use `S_ISDIR` to check if the file is a directory
src: use `S_ISDIR` to check if the file is a directory