summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-04-17 09:06:12 -0600
committerEric Blake <ebb9@byu.net>2008-04-17 09:06:12 -0600
commit97a7769765cde8e9bbff022001e475b07f7bbaf2 (patch)
tree751ca00de7bf5d96a00d5d728e488cc447ebebf2
parent693e6ecc7448f782c2db9fc148c6876178d8b199 (diff)
downloadm4-97a7769765cde8e9bbff022001e475b07f7bbaf2.tar.gz
Fix testsuite bug when SIGPIPE is ignored.
* tests/builtins.at (divert): Consume all of m4's output, to avoid spurious write failure. * src/main.c (main): In batch mode, restore default handling of SIGPIPE. * doc/m4.texinfo (Operation modes): Document SIGPIPE behavior. * THANKS: Update. Reported by Bob Proulx, via his autobuilder. Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r--ChangeLog11
-rw-r--r--THANKS1
-rw-r--r--doc/m4.texinfo6
-rw-r--r--src/main.c2
-rw-r--r--tests/builtins.at2
5 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b4bdf140..1335a877 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-04-17 Eric Blake <ebb9@byu.net>
+
+ Fix testsuite bug when SIGPIPE is ignored.
+ * tests/builtins.at (divert): Consume all of m4's output, to avoid
+ spurious write failure.
+ * src/main.c (main): In batch mode, restore default handling of
+ SIGPIPE.
+ * doc/m4.texinfo (Operation modes): Document SIGPIPE behavior.
+ * THANKS: Update.
+ Reported by Bob Proulx, via his autobuilder.
+
2008-04-15 Eric Blake <ebb9@byu.net>
Fix 'make installcheck' after './configure --prefix-progname'.
diff --git a/THANKS b/THANKS
index 6d476d32..0c655be4 100644
--- a/THANKS
+++ b/THANKS
@@ -25,6 +25,7 @@ Bernhard Daeubler daeb@physik.uni-ulm.de
Bill Bumgarner bbum@thoughtport.com
Bjorn R. Bjornsson brb@falcon.is
Bob Badour bob@badour.net
+Bob Proulx bob@proulx.com
Brendan Kehoe brendan@cygnus.com
Brian J. Fox bfox@datawave.net
Brian D. Carlstrom bdc@clark.lcs.mit.edu
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index d0bbfa47..280d633a 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -618,7 +618,8 @@ performing any other actions.
@item -b
@itemx --batch
Makes this invocation of @code{m4} non-interactive. This means that
-output will be buffered, and interrupts will halt execution. If neither
+output will be buffered, and an interrupt or pipe write error will halt
+execution. If neither
@option{-b} nor @option{-i} are specified, this is activated by default
when any input files are specified, or when either standard input or
standard error is not a terminal. Note that this means that @kbd{m4}
@@ -647,7 +648,8 @@ a warning is issued. The introduction of behavior levels is new to M4
@itemx --interactive
@itemx -e
Makes this invocation of @code{m4} interactive. This means that all
-output will be unbuffered, and interrupts will be ignored. If neither
+output will be unbuffered, interrupts will be ignored, and behavior on
+pipe write errors is inherited from the parent process. If neither
@option{-b} nor @option{-i} are specified, this is activated by default
when no input files are specified, and when both standard input and
standard error are terminals (similar to the way that /bin/sh determines
diff --git a/src/main.c b/src/main.c
index 86f21e76..7c3b9ccd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -616,6 +616,8 @@ main (int argc, char *const *argv, char *const *envp)
signal (SIGINT, SIG_IGN);
setbuf (stdout, NULL);
}
+ else
+ signal (SIGPIPE, SIG_DFL);
/* Do the basic initializations. */
diff --git a/tests/builtins.at b/tests/builtins.at
index 2030b14e..c63246bb 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -296,7 +296,7 @@ hello world
dnl Test large diversions, which were broken in m4 1.4.8-1.4.10.
AT_CHECK([echo 'divert(1)hi
-format(%1000000d, 1)' | $M4 | sed 1q], [0], [[hi
+format(%1000000d, 1)' | $M4 | sed -n 1p], [0], [[hi
]])
AT_DATA([in.m4], [M4_ONE_MEG_DEFN[divert(`2')f`'dnl