-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Ralf Wildenhues on 12/16/2006 8:00 AM: > Hi Eric, all, > > This new test fails for me on GNU/Linux x86 (Debian testing). > > Cheers, > Ralf > > # -*- compilation -*- > 63. others.at:458: testing ... > ../../m4/tests/others.at:466: m4 -b -d < in.m4 > ../../m4/tests/others.at:473: (m4; cat) < in.m4 > --- - 2006-12-15 11:20:25.790977000 +0100 > +++ /tmp/build/tests/testsuite.dir/at-stdout 2006-12-15 11:20:25.000000000 > +0100 > @@ -1,2 +1 @@ > -trailing data
Solaris 8 gets this particular test correct, as does CVS cygwin. So your failure report means that we have just uncovered a glibc bug. POSIX requires the following behavior when stdin is seekable: $ echo 1 2 3 | tr ' ' '\n' > file $ (sed -ne 1q; cat) < file 2 3 But glibc mistakenly optimizes exit() and fails to close stdin: $ strace sed -ne 1q < file 2>&1 | tail mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7db9000 read(0, "1\n2\n3\n", 4096) = 6 open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=21544, ...}) = 0 mmap2(NULL, 21544, PROT_READ, MAP_SHARED, 3, 0) = 0xb7db3000 close(3) = 0 close(1) = 0 close(2) = 0 exit_group(0) = ? Process 11905 detached Oops - fd 0 was never closed, let alone reset to the last unbuffered offset, so the cat process is starting from the wrong offset. It is this same bug that is breaking the m4 test. I will file a glibc bug report. In the meantime, gnulib can probably work around this bug. m4 already uses the closeout module. I think close_stdout be updated to flush and close stdin for the benefit of implementations (like glibc, or like cygwin 1.5.22 and earlier) where exit() is broken because it fails to reset the fd offset of seekable stdin. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFhEwb84KuGfSFAYARApFgAJ4lwD3R7oIrdmHMbpblNY1emAyBGQCfUoQM deH6nC9zy7SoJoGeEd0JPCs= =8Nd6 -----END PGP SIGNATURE----- _______________________________________________ Bug-m4 mailing list Bug-m4@gnu.org http://lists.gnu.org/mailman/listinfo/bug-m4