Bug 18940

Summary: Reading from stdin using linux-jdk-1.2.2 under Linux emulation fails
Product: Base System Reporter: markush <markush>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description markush 2000-06-01 13:50:00 UTC
Several people on the freebsd-java mailing list have reported problems with
reading from standard input in linux-jdk-1.2.2. The problem is that input does
not seem to be "sent" to the java process running under Linux emulation, which
means that the Java program blocks in the i/o read operation (even though there
is input to be read).

Fix: There was a patch (for 3.x) posted to the freebsd-java mailing list some months
ago, but it is unclear why the patch works and if it causes any undesired side
effects (since it removes a lot of code). 

Marcel Moolenaar (Linux emulation maintainer) has seen the patch but is not sure
if it's safe to remove the code that the patch wants to remove.

John Rochesters original patch for 3.x (only the patch for linux_file.c is relevant
in the posting):
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=22905+0+archive/2000/freebsd-java/20000220.freebsd-java

Here's the same patch adapted for 4.0-STABLE (May 29th):
How-To-Repeat: 
Using the Java-snippet below, a dot character should be printed on a line for itself
for each character that has been read in from stdin. This will not happen on a broken
system (a few dots might be output, but after that it's blocked).

(Read.java)
-8<------------------------------------------
import java.io.*;

public class Read {
    public static void main(String[] args) {
        try {
            while (System.in.read() != -1) {
                System.out.println(".");
            }
        } catch (IOException e) {
            System.err.println(e);
        }
    }
}
-8<------------------------------------------
Comment 1 Mike Barcroft freebsd_committer freebsd_triage 2001-07-22 04:03:52 UTC
State Changed
From-To: open->feedback


Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE?
Comment 2 Maxim Sobolev freebsd_committer freebsd_triage 2001-10-08 13:50:08 UTC
State Changed
From-To: feedback->closed

Feedback timeout.