On SLES 11 SP1 Linux, the glibc (standard C library) was upgraded from glibc-2.11.1-0.46.1 to glibc-2.11.1-0.52.1. This included a change to the readdir_r function that is also in all newer versions of glibc.
When I tried to build the JDK on the system, I got an error where a directory was being read. Upon investigating, I found it to be a general problem with the directory processing.
If you compile and run the following snippet on such a system:
import java.io.File;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
public class tstconv {
public static void main(String[] args) throws Exception {
tstconv.testit(args[0]);
}
public static void testit(String dpath) throws Exception {
Path path = FileSystems.getDefault().getPath(dpath);
try (DirectoryStream<Path> dirStr = Files.newDirectoryStream(path)) {
for (Path entry : dirStr) {
String fileName = entry.getFileName().toString();
System.out.println(fileName);
}
}
return;
}
}
The following error occurs:
Exception in thread "main" java.nio.file.DirectoryIteratorException: java.nio.file.FileSystemException: /home/lug: Unknown error 1601332584
at sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterat or.readNextEntry(UnixDirectoryStream.java:172)
at sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterat or.hasNext(UnixDirectoryStream.java:201)
at tstconv.testit(tstconv.java:22)
at tstconv.main(tstconv.java:15)
Caused by: java.nio.file.FileSystemException: /home/lug: Unknown error 1601332584
at sun.nio.fs.UnixException.translateToIOException(Un ixException.java:91)
at sun.nio.fs.UnixException.asIOException(UnixExcepti on.java:111)
at sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterat or.readNextEntry(UnixDirectoryStream.java:171)
... 3 more
Where /home/lug was the (yes it exists) directory given on the command line. The directory is not corrupted or anything like that; I've seen this on multiple systems and for any directory.
The exception is thrown after the readdir_r native call in the JNI code.
With the old glibc version this did not occur. Has anyone else seen this?