FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
We need to change the modification time of all files (including directories, symlinks, fifos and sockets) in a given directory. Trying to change the modification time of a unix domain socket file always fails with the following Exception:
java.nio.file.FileSystemException: /tmp/mysocket: No such device or address
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixPath.openForAttributeAccess(UnixPath.java:787)
at sun.nio.fs.UnixFileAttributeViews$Basic.setTimes(UnixFileAttributeViews.java:74)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a unix domain socket file, e.g. with the following command:
nc -lU /tmp/mysocket
(note: only the netcat-openbsd variant supports the -U option)
Then try to run the program given in the test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should update the modification time of the socket file because unix domain socket is just a normal file with a modification time that can be changed.
ACTUAL -
The exception above is thrown.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileTime;
import java.util.logging.Level;
import java.util.logging.Logger;
public class UnixDomainSocketTest {
public static void main(String[] args) {
Path socket = FileSystems.getDefault().getPath("/tmp/mysocket");
BasicFileAttributeView attributeView = Files.getFileAttributeView(
socket, BasicFileAttributeView.class);
FileTime fileTime = FileTime.fromMillis(System.currentTimeMillis());
try {
attributeView.setTimes(fileTime, null, null);
} catch (IOException ex) {
Logger.getLogger(UnixDomainSocketTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
---------- END SOURCE ----------
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
We need to change the modification time of all files (including directories, symlinks, fifos and sockets) in a given directory. Trying to change the modification time of a unix domain socket file always fails with the following Exception:
java.nio.file.FileSystemException: /tmp/mysocket: No such device or address
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixPath.openForAttributeAccess(UnixPath.java:787)
at sun.nio.fs.UnixFileAttributeViews$Basic.setTimes(UnixFileAttributeViews.java:74)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a unix domain socket file, e.g. with the following command:
nc -lU /tmp/mysocket
(note: only the netcat-openbsd variant supports the -U option)
Then try to run the program given in the test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should update the modification time of the socket file because unix domain socket is just a normal file with a modification time that can be changed.
ACTUAL -
The exception above is thrown.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileTime;
import java.util.logging.Level;
import java.util.logging.Logger;
public class UnixDomainSocketTest {
public static void main(String[] args) {
Path socket = FileSystems.getDefault().getPath("/tmp/mysocket");
BasicFileAttributeView attributeView = Files.getFileAttributeView(
socket, BasicFileAttributeView.class);
FileTime fileTime = FileTime.fromMillis(System.currentTimeMillis());
try {
attributeView.setTimes(fileTime, null, null);
} catch (IOException ex) {
Logger.getLogger(UnixDomainSocketTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
---------- END SOURCE ----------