bug-m4
[Top][All Lists]
Advanced

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

Re: failure with HEAD: stdin seekable


From: Eric Blake
Subject: Re: failure with HEAD: stdin seekable
Date: Sat, 16 Dec 2006 21:21:02 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 12/16/2006 12:42 PM:
> 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.

Well, Ulrich claimed the bug is in m4 (and sed, and ...), not glibc (and
while I disagree, based on the number of apps that would simultaneously be
fixed if he were to change glibc, I know better than to argue with him):
http://sources.redhat.com/bugzilla/show_bug.cgi?id=3746

> 
> 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.

It also turns out that I didn't fully port the patch from the branch,
where this was working correctly.

2006-12-16  Eric Blake  <address@hidden>

        * src/main.c (main): Check for errors when closing stdin.
        * modules/m4.c (m4exit): Missed part of previous patch: flush
        stdin before a successful exit.
        Reported by Ralf Wildenhues.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----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

iD8DBQFFhMWu84KuGfSFAYARAoKiAJ4qUkOGbbvvybawtZwEkdey4/X8ygCfQIYL
bA0lcHWw4W7kcIKD9fsbHxE=
=Kv9I
-----END PGP SIGNATURE-----
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.103
diff -u -p -r1.103 main.c
--- src/main.c  14 Nov 2006 05:58:01 -0000      1.103
+++ src/main.c  17 Dec 2006 04:17:05 -0000
@@ -776,7 +776,7 @@ main (int argc, char *const *argv, char 
      stream and detect any errors it might have encountered.  Close
      stdin if we read from it, to detect any errors.  */
   m4_debug_set_output (context, NULL);
-  if (read_stdin && fclose (stdin) == EOF)
+  if (read_stdin && close_stream (stdin) == EOF)
     m4_error (context, 0, errno, _("error closing stdin"));
 
   exit_status = m4_get_exit_status (context);
Index: modules/m4.c
===================================================================
RCS file: /sources/m4/m4/modules/m4.c,v
retrieving revision 1.94
diff -u -p -r1.94 m4.c
--- modules/m4.c        15 Dec 2006 04:23:48 -0000      1.94
+++ modules/m4.c        17 Dec 2006 04:17:05 -0000
@@ -839,6 +839,7 @@ M4BUILTIN_HANDLER (m4exit)
   /* Change debug stream back to stderr, to force flushing debug
      stream and detect any errors.  */
   m4_debug_set_output (context, NULL);
+  m4_sysval_flush (context);
 
   /* Check for saved error.  */
   if (exit_code == 0 && m4_get_exit_status (context) != 0)

reply via email to

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