Hi Eric, On HP-UX 11, I got these test failures:
test-ftell.c:85: assertion failed ./test-ftell.sh[3]: 9644 Abort FAIL: test-ftell.sh test-ftello.c:93: assertion failed ./test-ftello.sh[3]: 9648 Abort FAIL: test-ftello.sh In fact, when reading from a regular file, after the fseek, the file position is 120 instead of 3. Since none of ftell, fseek, ungetc are overridden by glibc, this looks like a HP-UX bug to me. I'm categorizing it as "known bug", and disabling this part of the tests. 2008-04-13 Bruno Haible <[EMAIL PROTECTED]> Work around a HP-UX stdio bug. * tests/test-ftell.c (main): Disable the fseek/ftell test on HP-UX. * tests/test-ftello.c (main): Likewise. * doc/posix-functions/ftell.texi: Mention HP-UX bug. * doc/posix-functions/ftello.texi: Likewise. *** doc/posix-functions/ftell.texi.orig 2008-04-13 21:38:43.000000000 +0200 --- doc/posix-functions/ftell.texi 2008-04-13 21:37:58.000000000 +0200 *************** *** 10,15 **** --- 10,19 ---- @itemize @item This function mistakenly succeeds on pipes on some platforms: mingw. + @item + This function produces incorrect results immediately after @code{fseek} on some + platforms: + HP-UX 11. @end itemize Portability problems not fixed by Gnulib: *** doc/posix-functions/ftello.texi.orig 2008-04-13 21:38:43.000000000 +0200 --- doc/posix-functions/ftello.texi 2008-04-13 21:37:59.000000000 +0200 *************** *** 15,20 **** --- 15,24 ---- The declaration of @code{ftello} in @code{<stdio.h>} is not enabled by default on some platforms: glibc 2.3.6. @item + This function produces incorrect results immediately after @code{fseek} on some + platforms: + HP-UX 11. + @item This function fails on seekable stdin, stdout, and stderr: cygwin <= 1.5.24. @end itemize *** tests/test-ftell.c.orig 2008-04-13 21:38:43.000000000 +0200 --- tests/test-ftell.c 2008-04-13 21:35:15.000000000 +0200 *************** *** 80,88 **** --- 80,90 ---- ASSERT (ch == '@'); ASSERT (ftell (stdin) == 3); + #if !defined __hpux /* HP-UX 11 has a known bug here */ /* Test ftell after ungetc without read. */ ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); ASSERT (ftell (stdin) == 3); + #endif ch = ungetc ('~', stdin); ASSERT (ch == '~'); *** tests/test-ftello.c.orig 2008-04-13 21:38:43.000000000 +0200 --- tests/test-ftello.c 2008-04-13 21:35:13.000000000 +0200 *************** *** 88,97 **** --- 88,99 ---- ASSERT (ftell (stdin) == 3); ASSERT (ftello (stdin) == 3); + #if !defined __hpux /* HP-UX 11 has a known bug here */ /* Test ftell after ungetc without read. */ ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); ASSERT (ftell (stdin) == 3); ASSERT (ftello (stdin) == 3); + #endif ch = ungetc ('~', stdin); ASSERT (ch == '~');