aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani2017-05-27 14:39:01 +0200
committerPhilipp Stephani2017-05-27 15:30:19 +0200
commitebe0bdae9ded4eab974faefb54a6ba5260523489 (patch)
treed63f9db7cbfdab4b21d66b6c1c55aa565b31e326
parenta3a3ea0762d0e5d3b2cb8259a515a468736050d1 (diff)
downloademacs-ebe0bdae9ded4eab974faefb54a6ba5260523489.tar.gz
emacs-ebe0bdae9ded4eab974faefb54a6ba5260523489.zip
Don't attempt to recover from undefined behavior in some cases
These functions can only be run in batch mode and exit Emacs on return, so nothing can be recovered. Disable unsafe recover mechanisms so that we get real failures and good stack traces on fatal signals. * lisp/emacs-lisp/bytecomp.el (batch-byte-compile) (batch-byte-recompile-directory): * lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit) (ert-summarize-tests-batch-and-exit): Don't attempt to recover from undefined behavior.
-rw-r--r--lisp/emacs-lisp/bytecomp.el8
-rw-r--r--lisp/emacs-lisp/ert.el10
2 files changed, 18 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 6c12e5d8e25..12a7d4afc2a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4960,6 +4960,10 @@ already up-to-date."
4960 (defvar command-line-args-left) ;Avoid 'free variable' warning 4960 (defvar command-line-args-left) ;Avoid 'free variable' warning
4961 (if (not noninteractive) 4961 (if (not noninteractive)
4962 (error "`batch-byte-compile' is to be used only with -batch")) 4962 (error "`batch-byte-compile' is to be used only with -batch"))
4963 ;; Better crash loudly than attempting to recover from undefined
4964 ;; behavior.
4965 (setq attempt-stack-overflow-recovery nil
4966 attempt-orderly-shutdown-on-fatal-signal nil)
4963 (let ((error nil)) 4967 (let ((error nil))
4964 (while command-line-args-left 4968 (while command-line-args-left
4965 (if (file-directory-p (expand-file-name (car command-line-args-left))) 4969 (if (file-directory-p (expand-file-name (car command-line-args-left)))
@@ -5052,6 +5056,10 @@ and corresponding effects."
5052 (defvar command-line-args-left) ;Avoid 'free variable' warning 5056 (defvar command-line-args-left) ;Avoid 'free variable' warning
5053 (if (not noninteractive) 5057 (if (not noninteractive)
5054 (error "batch-byte-recompile-directory is to be used only with -batch")) 5058 (error "batch-byte-recompile-directory is to be used only with -batch"))
5059 ;; Better crash loudly than attempting to recover from undefined
5060 ;; behavior.
5061 (setq attempt-stack-overflow-recovery nil
5062 attempt-orderly-shutdown-on-fatal-signal nil)
5055 (or command-line-args-left 5063 (or command-line-args-left
5056 (setq command-line-args-left '("."))) 5064 (setq command-line-args-left '(".")))
5057 (while command-line-args-left 5065 (while command-line-args-left
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 280b76acfe4..2c49a634e35 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1458,6 +1458,12 @@ The exit status will be 0 if all test results were as expected, 1
1458on unexpected results, or 2 if the tool detected an error outside 1458on unexpected results, or 2 if the tool detected an error outside
1459of the tests (e.g. invalid SELECTOR or bug in the code that runs 1459of the tests (e.g. invalid SELECTOR or bug in the code that runs
1460the tests)." 1460the tests)."
1461 (or noninteractive
1462 (user-error "This function is only for use in batch mode"))
1463 ;; Better crash loudly than attempting to recover from undefined
1464 ;; behavior.
1465 (setq attempt-stack-overflow-recovery nil
1466 attempt-orderly-shutdown-on-fatal-signal nil)
1461 (unwind-protect 1467 (unwind-protect
1462 (let ((stats (ert-run-tests-batch selector))) 1468 (let ((stats (ert-run-tests-batch selector)))
1463 (kill-emacs (if (zerop (ert-stats-completed-unexpected stats)) 0 1))) 1469 (kill-emacs (if (zerop (ert-stats-completed-unexpected stats)) 0 1)))
@@ -1475,6 +1481,10 @@ The logfiles should have the `ert-run-tests-batch' format. When finished,
1475this exits Emacs, with status as per `ert-run-tests-batch-and-exit'." 1481this exits Emacs, with status as per `ert-run-tests-batch-and-exit'."
1476 (or noninteractive 1482 (or noninteractive
1477 (user-error "This function is only for use in batch mode")) 1483 (user-error "This function is only for use in batch mode"))
1484 ;; Better crash loudly than attempting to recover from undefined
1485 ;; behavior.
1486 (setq attempt-stack-overflow-recovery nil
1487 attempt-orderly-shutdown-on-fatal-signal nil)
1478 (let ((nlogs (length command-line-args-left)) 1488 (let ((nlogs (length command-line-args-left))
1479 (ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0) 1489 (ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0)
1480 nnotrun logfile notests badtests unexpected skipped) 1490 nnotrun logfile notests badtests unexpected skipped)