diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go index 6a0135b70b0..87df3122d4e 100644 --- a/src/os/dir_unix.go +++ b/src/os/dir_unix.go @@ -112,7 +112,8 @@ func (f *File) readdir(n int, mode readdirMode) (names []string, dirents []DirEn // or might expose a remote file system which does not have the concept // of inodes. Therefore, we cannot make the assumption that it is safe // to skip entries with zero inodes. - if ino == 0 && runtime.GOOS != "wasip1" { + // Some Linux filesystems (old XFS, FUSE) can return valid files with zero inodes. + if ino == 0 && runtime.GOOS != "linux" && runtime.GOOS != "wasip1" { continue } const namoff = uint64(unsafe.Offsetof(syscall.Dirent{}.Name)) diff --git a/src/syscall/dirent.go b/src/syscall/dirent.go index c12b1193356..00946412703 100644 --- a/src/syscall/dirent.go +++ b/src/syscall/dirent.go @@ -73,8 +73,8 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, break } // See src/os/dir_unix.go for the reason why this condition is - // excluded on wasip1. - if ino == 0 && runtime.GOOS != "wasip1" { // File absent in directory. + // excluded on wasip1 and linux. + if ino == 0 && runtime.GOOS != "linux" && runtime.GOOS != "wasip1" { // File absent in directory. continue } const namoff = uint64(unsafe.Offsetof(Dirent{}.Name))