piet@cs.ruu.nl (Piet van Oostrum) (01/16/91)
>>>>> In message <1991Jan11.133837@cs.utwente.nl>, belinfan@cs.utwente.nl (Axel Belinfante) (AB) writes: AB> I tried to compile perl 3.41 on a hp9000s300 machine, running hp-ux 7.0. AB> It compiles ok, as long as i don't try to compile it with -O AB> (if i do, cc hangs in eval.c). AB> The problems start when i run `make test'. AB> test op.read fails, the other tests run ok: >> % op.read >> 1..4 >> ok 1 >> ok 2 >> not ok 3 >> not ok 4 I experienced the same problem. Even more strangely, the test also failed on pl 41 and on an old perl pl 18. I traced it with adb, and found that the read after the seek(20000) returned a full buffer of zero bytes. I finally traced it down to the perl directory being on a NFS mounted filesystem. So I bet you have your perl directory also on NFS. When I run the test from the machine where perl was located the problem disappeared. It seems that the HP-UX implementation of NFS returns a full buffer of zero bytes if you do a lseek after the end of file, followed by a read. I would say this is a bug. The problem does not appear to be in the server as it works correctly from other machines (e.g. a Sun), even if the actual file system is on a HP. Here is a short C program that duplicates the problem: #include <stdio.h> main() { /* Note : use an NFS mounted file */ FILE * f = fopen ("/usr/staff/src/perl3.0/README", "r"); int i, n; char buf[80]; fseek (f, 20000L, 0); n = fread (buf, 1,5,f); printf ("%d: ", n); for (i=0; i<n; i++) { printf ("%x ", buf[i]); } printf ("\n"); } -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')