ADDITIONAL SYSTEM INFORMATION :
Linux VMware-Virtual-Platform 6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 13:41:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
openjdk version "24-ea" 2025-03-18
OpenJDK Runtime Environment (build 24-ea+16-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 24-ea+16-Ubuntu-1, mixed mode, sharing)
openjdk version "1.8.0_422"
OpenJDK Runtime Environment (build 1.8.0_422-8u422-b05-1ubuntu1-b05)
OpenJDK 64-Bit Server VM (build 25.422-b05, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Methods that invoke lseek on Linux will fail if file descriptor is stdin. This does not happen on a Windows system.
Also fails on JDK 8, 11, 17, 21
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Program completes normally.
ACTUAL -
Exception in thread "main" java.io.IOException: Illegal seek
---------- BEGIN SOURCE ----------
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.Channels;
public class NIOTest {
public static void main(String[] args) throws IOException {
new FileInputStream(FileDescriptor.in).available(); // OK
new FileInputStream(FileDescriptor.in).readNBytes(4); // Fail
Channels.newInputStream(new FileInputStream(FileDescriptor.in).getChannel()).available(); // Fail
new FileInputStream(FileDescriptor.in).readAllBytes(); // Fail
}
}
---------- END SOURCE ----------
FREQUENCY : always
Linux VMware-Virtual-Platform 6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 13:41:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
openjdk version "24-ea" 2025-03-18
OpenJDK Runtime Environment (build 24-ea+16-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 24-ea+16-Ubuntu-1, mixed mode, sharing)
openjdk version "1.8.0_422"
OpenJDK Runtime Environment (build 1.8.0_422-8u422-b05-1ubuntu1-b05)
OpenJDK 64-Bit Server VM (build 25.422-b05, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Methods that invoke lseek on Linux will fail if file descriptor is stdin. This does not happen on a Windows system.
Also fails on JDK 8, 11, 17, 21
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Program completes normally.
ACTUAL -
Exception in thread "main" java.io.IOException: Illegal seek
---------- BEGIN SOURCE ----------
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.Channels;
public class NIOTest {
public static void main(String[] args) throws IOException {
new FileInputStream(FileDescriptor.in).available(); // OK
new FileInputStream(FileDescriptor.in).readNBytes(4); // Fail
Channels.newInputStream(new FileInputStream(FileDescriptor.in).getChannel()).available(); // Fail
new FileInputStream(FileDescriptor.in).readAllBytes(); // Fail
}
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-8233451 (fs) Files.newInputStream() cannot be used with character special files
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/1341b813
-
Review(master) openjdk/jdk/21673