belinfan@cs.utwente.nl (Axel Belinfante) (01/11/91)
I tried to compile perl 3.41 on a hp9000s300 machine, running hp-ux 7.0. It compiles ok, as long as i don't try to compile it with -O (if i do, cc hangs in eval.c). The problems start when i run `make test'. test op.read fails, the other tests run ok: >> % op.read >> 1..4 >> ok 1 >> ok 2 >> not ok 3 >> not ok 4 After adding addional print statements (see below) the result is: >> % op.read >> 1..4 >> ok 1 >> ok 2 >> not ok 3 >> not ok 4 >> $got :4: >> $buf :: The revised test script op.read: ----------cut here------------- #!./perl # $Header: op.read,v 3.0 89/10/18 15:30:58 lwall Locked $ print "1..4\n"; open(FOO,'op.read') || open(FOO,'t/op.read') || die "Can't open op.read"; seek(FOO,4,0); $got = read(FOO,$buf,4); print ($got == 4 ? "ok 1\n" : "not ok 1\n"); print ($buf eq "perl" ? "ok 2\n" : "not ok 2 :$buf:\n"); seek(FOO,20000,0); $got = read(FOO,$buf,4); print ($got == 0 ? "ok 3\n" : "not ok 3\n"); print ($buf eq "" ? "ok 4\n" : "not ok 4\n"); print ('$got '); print(":$got:\n"); print ('$buf '); print(":$buf:\n"); ----------cut here--------------------- Does this sound familiar, in any way? Have you a suggestion how to solve this? Thanx ahead, Axel Belinfante. (belinfan@cs.utwente.nl)
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')