[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
/dev/random java trouble
- To: ports_(_at_)_openbsd_(_dot_)_org
- Subject: /dev/random java trouble
- From: experte <leopold-bloom_(_at_)_foni_(_dot_)_net>
- Date: Wed, 12 Dec 2001 23:57:08 +0000
Hi!
When trying to use mindterm from the ports-collection (a JAVA-based
ssh-client for X) which worked fine under OpenBSD2.9 i got this
errror-message:
$ /usr/local/jdk1.3.1-linux/bin/java -classpath\
/usr/local/jdk1.3.1-linux/lib/classes.zip:mindtermfull.jar\
mindbright.application.MindTerm
...
java.lang.Error: Error in RandomSeed, while reading /dev/random
at fp.yu(JAX)
at fp.yt(JAX)
at fp.ys(JAX)
at fp.yq(JAX)
at fd.ww(JAX)
at ep.ur(JAX)
at ep.run(JAX)
at java.lang.Thread.run(Thread.java:484)
Thank you for using MindTerm...
$
This happends both with jdk1.1.8 and 1.3.1. I tried it with a version of
mindterm not from ports with the same results (The error-messages is a little
different but also complains about /dev/random). As far as i can see,
/dev/random was worked over between 2.9 and 3.0.(/usr/src/sys/dev/rnd.c).
So I guess the linux or freebsd-emulation may be partly broken. I'm not sure
about the exact point of failure but i wrote a little sample java proc to
prove my suggestion:
$ cat wont.java
import java.util.*;
import java.io.*;
class wont {
public static void main(String args[]) {
Random x = new Random();
int i = x.nextInt();
System.out.println("value: " + i);
try {
FileInputStream f = new
FileInputStream("/dev/random");
int z = f.read();
System.out.println("/dev/random says: " + z);
}
catch(IOException e) {
e.printStackTrace();
}
}
}
$
This is what i get under OpenBSD.3.0:
$ /usr/local/jdk1.1.8/bin/javac wont.java
$ /usr/local/jdk1.1.8/bin/java wont
value: 1497353992
java.io.IOException: read error
at wont.main(wont.java:11)
$ /usr/local/jdk1.3.1-linux/bin/java wont
value: -1971096046
java.io.IOException: Input/output error
at java.io.FileInputStream.read(Native Method)
at wont.main(wont.java:11)
$
The same brilliant piece of code runs nicely on a slakware-3-something.
Since i upgraded all my machines to 3.0, i can't prove that it works under
2.9 but i think so.
Note that it works with /dev/urandom on OpenBSD 3.0).
Thanks in advance
Alf
Visit your host, monkey.org