bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: seekable stdin test failure on OS X


From: Gary V. Vaughan
Subject: Re: seekable stdin test failure on OS X
Date: Mon, 2 Apr 2007 13:44:25 +0100

Hi Eric,

On 2 Apr 2007, at 13:20, Eric Blake wrote:
According to Gary V. Vaughan on 3/28/2007 10:47 AM:
$ make check TESTSUITEFLAGS='-v 68'
68. others.at:458: testing ...
../../tests/others.at:467: m4 -b -d  < in.m4
--- -   2007-03-28 17:36:35.000000000 +0100
+++
/Users/gary/Devo/Source/m4--devo--0/+build/tests/testsuite.dir/at- stdout
2007-03-28 17:36:35.000000000 +0100
@@ -1,2 +1 @@
-m4exit(15)
../../tests/others.at:467: exit code was 15, expected 0
68. others.at:458:  FAILED (others.at:467)

I don't know what is being tested here, so I can't debug any further.

Yuck.  I think this means that on your platform, fflush(stdin) is
neglecting to reset the underlying fd position when stdin is seekable,
which is a bug in your libc. To confirm, do you have anything like strace
or truss that you could run to see what syscalls took place?

Yes, there is ktrace which outputs the following when running test 68:

  6760 m4       GIO   fd 0 read 24 bytes
       "syscmd(`cat')m4exit(15)
       "
  6760 m4       RET   read 24/0x18
  6760 m4       CALL  lseek(0,0,0x1)
  6760 m4       RET   lseek 24/0x18
  6760 m4       CALL  sigaction(0x2,0xbfffece0,0xbfffed3c)
  6760 m4       RET   sigaction 0
  6760 m4       CALL  sigaction(0x3,0xbfffece0,0xbfffed30)
  6760 m4       RET   sigaction 0
  6760 m4       CALL  sigprocmask(0x1,0xbfffed58,0xbfffed54)
  6760 m4       RET   sigprocmask 0
  6760 m4       CALL  fork
  6760 m4       RET   fork 6777/0x1a79
  6760 m4       CALL  wait4(0x1a79,0xbfffed5c,0,0)
  6760 m4       RET   wait4 6777/0x1a79
  6760 m4       CALL  sigaction(0x2,0xbfffece0,0)
  6760 m4       RET   sigaction 0
  6760 m4       CALL  sigaction(0x3,0xbfffece0,0)
  6760 m4       RET   sigaction 0
  6760 m4       CALL  sigprocmask(0x3,0xbfffed54,0)
  6760 m4       RET   sigprocmask 0
  6760 m4       CALL  fstat(0x1,0xbfffecc0)
  6760 m4       RET   fstat 0
  6760 m4       CALL  fstat(0x2,0xbfffec60)
  6760 m4       RET   fstat 0
  6760 m4       CALL  lseek(0,0,0x1)
  6760 m4       RET   lseek 24/0x18
  6760 m4       CALL  close(0x1)
  6760 m4       RET   close 0
  6760 m4       CALL  close(0x2)
  6760 m4       RET   close 0
  6760 m4       CALL  exit(0xf)

The fork and wait must be the syscmd, and the lseek(0,0,0x1) that returns
24 is the seek on stdin from fflush.  What does that mean though?

We may end up having to write an autoconf test that can detect this
brokenness in libc, and based on that test, add additional calls to fseek if using fflush alone is inadequate for m4 to follow the POSIX rules of
how to handle seekable input streams.

Bleh!

Cheers,
        Gary
--
  ())_.              Email me: address@hidden
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912




Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]