m4-commit
[Top][All Lists]
Advanced

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

[SCM] GNU M4 source repository branch, stackovf, updated. v1.5.89a-29-g0


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, stackovf, updated. v1.5.89a-29-g0b2dea6
Date: Fri, 06 Jun 2008 23:13:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=0b2dea68c4f3e2f6cca84291536b80b3c4eac058

The branch, stackovf has been updated
       via  0b2dea68c4f3e2f6cca84291536b80b3c4eac058 (commit)
      from  15ddfa0680afac65c54f5fe87fa01b7b7b0f85b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0b2dea68c4f3e2f6cca84291536b80b3c4eac058
Author: Eric Blake <address@hidden>
Date:   Fri Jun 6 16:37:21 2008 -0600

    Inform users what to do in case of programmer error.
    
    * src/m4.h (EXIT_INTERNAL_ERROR): New macro.
    * configure.ac (AC_TYPE_SIGNAL): Delete, now that we assume C89.
    * src/m4.c (fault_handler): New method.
    (program_error_message): New variable, for async-safety.
    (main): Print bug reporting address rather than dump core on any
    failed assertions or detected non-stack-overflow faults.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog    |    8 ++++++++
 configure.ac |    2 --
 src/m4.c     |   31 ++++++++++++++++++++++++++++++-
 src/m4.h     |    3 +++
 4 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 18c8301..6dc4932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-06-06  Eric Blake  <address@hidden>
 
+       Inform users what to do in case of programmer error.
+       * src/m4.h (EXIT_INTERNAL_ERROR): New macro.
+       * configure.ac (AC_TYPE_SIGNAL): Delete, now that we assume C89.
+       * src/m4.c (fault_handler): New method.
+       (program_error_message): New variable, for async-safety.
+       (main): Print bug reporting address rather than dump core on any
+       failed assertions or detected non-stack-overflow faults.
+
        Replace stackovf with gnulib c-stack.
        * m4/gnulib.cache.m4: Import c-stack module.
        * configure.ac (AC_CHECK_HEADERS_ONCE): Remove check for
diff --git a/configure.ac b/configure.ac
index 3fb059b..3456d8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,8 +32,6 @@ AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
 AC_PROG_CC
 M4_EARLY
 
-AC_TYPE_SIGNAL
-
 # Tandem/NSK is broken - it has 'long long int' but not
 # 'unsigned long long int', which confuses assumptions made by gnulib.
 # Simply pretend that neither type exists if both do not work.
diff --git a/src/m4.c b/src/m4.c
index 63dcc20..f2c7c61 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -177,6 +177,28 @@ m4_warn (int errnum, const call_info *caller, const char 
*format, ...)
       va_end (args);
     }
 }
+
+/* Translated message for program errors.  Do not translate it in the
+   signal handler, since gettext is not async-signal-safe.  */
+static const char * volatile program_error_message;
+
+/* Print a nicer message about any programmer errors, then exit.  This
+   must be aysnc-signal safe, since it is executed as a signal
+   handler.  If SIGNO is zero, this represents a stack overflow; in
+   that case, we return to allow c_stack_action to handle things.  */
+static void
+fault_handler (int signo)
+{
+  if (signo)
+    {
+      write (STDERR_FILENO, program_name, strlen (program_name));
+      write (STDERR_FILENO, ": ", 2);
+      write (STDERR_FILENO, program_error_message,
+             strlen (program_error_message));
+      write (STDERR_FILENO, "\n", 1);
+      _exit (EXIT_INTERNAL_ERROR);
+    }
+}
 
 
 /*---------------------------------------------.
@@ -415,8 +437,15 @@ main (int argc, char *const *argv, char *const *envp)
   debug_init ();
   set_quoting_style (NULL, escape_quoting_style);
   set_char_quoting (NULL, ':', 1);
-  if (c_stack_action (NULL) == 0)
+
+  /* Stack overflow and program error handling.  */
+  if (c_stack_action (fault_handler) == 0)
     nesting_limit = 0;
+  program_error_message
+    = xasprintf (_("internal error detected; please report this bug to <%s>"),
+                 PACKAGE_BUGREPORT);
+  /* FIXME - use sigaction.  */
+  signal (SIGABRT, fault_handler);
 
   /* First, we decode the arguments, to size up tables and stuff.  */
 
diff --git a/src/m4.h b/src/m4.h
index 6290122..a38a2f8 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -73,6 +73,9 @@
 # undef UNIX
 #endif
 
+/* Used if any programmer error is detected (not possible, right?)  */
+#define EXIT_INTERNAL_ERROR 2
+
 /* Used for version mismatch, when -R detects a frozen file it can't parse.  */
 #define EXIT_MISMATCH 63
 


hooks/post-receive
--
GNU M4 source repository




reply via email to

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