Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!ig!uwmcsd1!dogie!rhesus!bin From: bin@rhesus.primate.wisc.edu (Brain in Neutral) Newsgroups: comp.sources.bugs Subject: perl uncovers Ultrix 1.2 bug? Message-ID: <274@rhesus.primate.wisc.edu> Date: 4 Feb 88 15:16:54 GMT Organization: UW-Madison Primate Center Lines: 46 This is on a VAX 8200 running Ultrix 1.2. It seems to me that file reads after eof mess up the file pointer. If ftell is called after eof on a file is reached, it returns the correct answer. If fgets (fgetc, etc.) is called again, it returns NULL (as it should), but ftell returns a different value! I discovered this because it makes perl fail the io.tell validation program, tests 3 and 12. The problem is illustrated by the following short program. # include main () { FILE *f; char buf[BUFSIZ]; int i; f = fopen ("/etc/passwd", "r"); while (fgets (buf, BUFSIZ, f) != NULL) { /* empty */ } printf ("tell = %D\n", ftell (f)); for (i = 0; i < 10; ++i) { fgets (buf, BUFSIZ, f); printf ("tell = %D\n", ftell (f)); } } On our system /etc/passwd look like this: -rw-r--r-- 1 root 8783 Feb 3 14:38 /etc/passwd The result of running the above program is: tell = 8783 tell = 8784 tell = 8785 tell = 8786 tell = 8787 tell = 8788 tell = 8789 tell = 8790 tell = 8791 tell = 8792 tell = 8793