m4-discuss
[Top][All Lists]
Advanced

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

Re: AC_PROG_LIBTOOL error


From: Paul Eggert
Subject: Re: AC_PROG_LIBTOOL error
Date: Thu, 19 Aug 2004 21:25:13 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Gary V.Vaughan" <address@hidden> writes:

> the code needs to be checked carefully for similiar instances, in 1.4.1

OK, I systematically did that by looking for all uses of errno in
the code, looking for cases where errno's value may be garbage.
I generated a proposed new release here:

ftp://alpha.gnu.org/gnu/bison/m4-1.4.2.tar.gz
ftp://alpha.gnu.org/gnu/bison/m4-1.4.2.tar.gz.sig

Here are the changes embodied in this proposed release.  If they look
good to you, can you please copy it to <ftp://ftp.gnu.org/gnu/m4/>?  Thanks.

2004-08-19  Paul Eggert  <address@hidden>

        * Release 1.4.2.

        * configure.in (VERSION): Bump to 1.4.2.
        * NEWS: Describe 1.4.2's changes.

        * src/m4.c (reference_error): Preserve errno, since M4ERROR
        relies on this.
        * src/builtin.c (m4_esyscmd): Clear errno before calling popen.
        (m4_maketemp): Clear errno before calling mkstemp.
        * src/path.c (path_search): Don't let "free" trash errno when
        returning NULL.
        * src/output.c (insert_file): Don't assume errno has a valid
        value simply because fread returns zero.  This fixes a
        portability bug reported by Marion Hakanson in
        <http://lists.gnu.org/archive/html/bug-m4/2004-07/msg00029.html>.

===================================================================
RCS file: NEWS,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- NEWS        2004/06/03 22:10:03     1.4.1.0
+++ NEWS        2004/08/20 03:45:58     1.4.1.1
@@ -1,6 +1,10 @@
 GNU m4 NEWS - User visible changes.
 Copyright (C) 1992, 1993, 1994, 2004 Free Software Foundation, Inc.
 
+Version 1.4.2 - August 2004, by Paul Eggert
+
+* No user visible changes; portability bug fixes only.
+
 Version 1.4.1 - June 2004, by Paul Eggert
 
 * maketemp now creates an empty file with the given name, instead of merely
===================================================================
RCS file: configure.in,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- configure.in        2004/06/03 21:31:21     1.4.1.0
+++ configure.in        2004/08/20 03:45:58     1.4.1.1
@@ -7,7 +7,7 @@ AC_CONFIG_HEADER(config.h)
 AC_ARG_PROGRAM
 
 PRODUCT=m4
-VERSION=1.4.1
+VERSION=1.4.2
 AC_DEFINE_UNQUOTED(PRODUCT, "$PRODUCT")
 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
 AC_SUBST(PRODUCT)
===================================================================
RCS file: src/builtin.c,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- src/builtin.c       2004/06/03 21:25:09     1.4.1.0
+++ src/builtin.c       2004/08/20 03:42:42     1.4.1.1
@@ -1,6 +1,6 @@
 /* GNU m4 -- A simple macro processor
 
-   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2000 Free
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2000, 2004 Free
    Software Foundation, Inc.
   
    This program is free software; you can redistribute it and/or modify
@@ -767,6 +767,7 @@ m4_esyscmd (struct obstack *obs, int arg
     return;
 
   debug_flush_files ();
+  errno = 0;
   pin = popen (ARG (1), "r");
   if (pin == NULL)
     {
@@ -1081,6 +1082,7 @@ m4_maketemp (struct obstack *obs, int ar
   int fd;
   if (bad_argc (argv[0], argc, 2, 2))
     return;
+  errno = 0;
   if ((fd = mkstemp (ARG (1))) < 0)
     {
       M4ERROR ((warning_status, errno, "Cannot create tempfile %s", ARG (1)));
===================================================================
RCS file: src/m4.c,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- src/m4.c    2003/09/28 09:05:43     1.4.1.0
+++ src/m4.c    2004/08/20 03:41:59     1.4.1.1
@@ -1,5 +1,7 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004 Free
+   Software Foundation, Inc.
   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -91,8 +93,10 @@ typedef struct macro_definition macro_de
 void
 reference_error (void)
 {
+  int e = errno;
   fflush (stdout);
   fprintf (stderr, "%s:%d: ", current_file, current_line);
+  errno = e;
 }
 
 #ifdef USE_STACKOVF
===================================================================
RCS file: src/output.c,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- src/output.c        2003/09/28 09:05:43     1.4.1.0
+++ src/output.c        2004/08/20 03:45:13     1.4.1.1
@@ -1,5 +1,7 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004 Free
+   Software Foundation, Inc.
   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -467,12 +469,15 @@ insert_file (FILE *file)
 
   /* Insert output by big chunks.  */
 
-  errno = 0;
-  while (length = fread (buffer, 1, COPY_BUFFER_SIZE, file),
-        length != 0)
-    output_text (buffer, length);
-  if (errno)
-    M4ERROR ((EXIT_FAILURE, errno, "ERROR: Reading inserted file"));
+  for (;;)
+    {
+      length = fread (buffer, 1, COPY_BUFFER_SIZE, file);
+      if (ferror (file))
+       M4ERROR ((EXIT_FAILURE, errno, "ERROR: Reading inserted file"));
+      if (length == 0)
+       break;
+      output_text (buffer, length);
+    }
 }
 
 /*-------------------------------------------------------------------------.
===================================================================
RCS file: src/path.c,v
retrieving revision 1.4.1.0
retrieving revision 1.4.1.1
diff -pu -r1.4.1.0 -r1.4.1.1
--- src/path.c  1994/08/28 00:56:28     1.4.1.0
+++ src/path.c  2004/08/20 03:43:39     1.4.1.1
@@ -1,5 +1,7 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 1989, 90, 91, 92, 93 Free Software Foundation, Inc.
+
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 2004 Free Software
+   Foundation, Inc.
   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -102,6 +104,7 @@ path_search (const char *dir)
   FILE *fp;
   includes *incl;
   char *name;                  /* buffer for constructed name */
+  int e;
 
   /* Look in current working directory first.  */
   fp = fopen (dir, "r");
@@ -111,6 +114,7 @@ path_search (const char *dir)
   /* If file not found, and filename absolute, fail.  */
   if (*dir == '/' || no_gnu_extensions)
     return NULL;
+  e = errno;
 
   name = (char *) xmalloc (dir_max_length + 1 + strlen (dir) + 1);
 
@@ -133,6 +137,7 @@ path_search (const char *dir)
        }
     }
   xfree (name);
+  errno = e;
   return fp;
 }
 




reply via email to

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