Subject: Re: bug#20229: 24.4.91; sigsegv when compiling shr.el
From: Nicolas Richard <[email-masked]>
To: Nicolas Richard <[email-masked]>
Cc: [email-masked]
Date: Fri, 24 Apr 2015 12:30:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Nicolas Richard <[email-masked]> writes:
> I was bootstrapping and ran into an error (shown below).
>
> The error shows a command that "make" is trying to run -- but when I run
> that manually (from the lisp/ subdir), I don't get the error:
>
> EMACSLOADPATH= '../src/emacs' -batch --no-site-file --no-site-lisp --eval "(setq max-lisp-eval-depth 2200)" --eval '(setq load-prefer-newer t)' -f batch-byte-compile net/shr.el
>
> If I remove net/shr.elc and do "make" again, I get the error again. So I
> can reliably reproduce the error, but not in a way that I can run under
> gdb...

I tested more thoroughly and came up with the conclusion that my patch
doesn't solve anything because I can't reproduce the build problem
anymore. I did this:
- I used git-new-workdir to get two copies of the emacs tree
- In one of them, I applied an extension of the patch I posted
  previously : it mostly modifies a few calls to (debug ...) into (debug
  nil ...) (See attachment.)
- In the other I used savannah/master as of
     commit b01cf822c5ac044bb550231c811a062d3a8cbeec
     Author: Glenn Morris <[email-masked]>
     Date:   Tue Apr 21 06:18:09 2015 -0400

Conclusion : both trees compiled just fine.

I can only assume that I had leftover files, which caused the problem
(even though I'm almost sure I used "make bootstrap" when doing my tests
initially).

I'm now closing the bug and will reopen it if I see the initial problem again.

Should the attached patch (or some variation of it) be applied anyway ? 

diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el
index 3ad192b..90b0426 100644
--- a/lisp/cedet/semantic/tag.el
+++ b/lisp/cedet/semantic/tag.el
@@ -1242,7 +1242,7 @@ (defun semantic--tag-expand (tag)
           )
       (error
        (message "A Rule must return a single tag-line list!")
-       (debug tag)
+       (debug nil tag)
        nil))
     ;; Expand based on local configuration
     (if semantic-tag-expand-function
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
index ed0639b..2624805 100644
--- a/lisp/emacs-lisp/cl-preloaded.el
+++ b/lisp/emacs-lisp/cl-preloaded.el
@@ -44,7 +44,7 @@ (define-error 'cl-assertion-failed (purecopy "Assertion failed"))
 
 (defun cl--assertion-failed (form &optional string sargs args)
   (if debug-on-error
-      (debug `(cl-assertion-failed ,form ,string ,@sargs))
+      (debug nil `(cl-assertion-failed ,form ,string ,@sargs))
     (if string
         (apply #'error string (append sargs args))
       (signal 'cl-assertion-failed `(,form ,@sargs)))))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 98fb7e9..99c4cd8 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1281,7 +1281,7 @@ (defun edebug-make-form-wrapper (cursor form-begin form-end
       ;;    (message "defining: %s" edebug-def-name) (sit-for 2)
       (edebug-make-top-form-data-entry form-data-entry)
       (message "Edebug: %s" edebug-def-name)
-      ;;(debug edebug-def-name)
+      ;;(debug nil edebug-def-name)
 
       ;; Destructively reverse edebug-offset-list and make vector from it.
       (setq edebug-offset-list (vconcat (nreverse edebug-offset-list)))
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index f0410f8..53ca3fe 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -483,7 +483,7 @@ (defun internal-macroexpand-for-load (form full-p)
       (if tail (setcdr tail (list '…)))
       (if (eq (car-safe (car bt)) 'macroexpand-all) (setq bt (cdr bt)))
       (if macroexp--debug-eager
-          (debug 'eager-macroexp-cycle)
+          (debug nil 'eager-macroexp-cycle)
         (message "Warning: Eager macro-expansion skipped due to cycle:\n  %s"
                  (mapconcat #'prin1-to-string (nreverse bt) " => ")))
       (push 'skip macroexp--pending-eager-loads)
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index d502a3b..1c42579 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -726,7 +726,7 @@ (defun* auth-source-search (&rest spec
        "auth-source-search: found %d backends matching %S"
        (length filtered-backends) spec)
 
-      ;; (debug spec "filtered" filtered-backends)
+      ;; (debug nil spec "filtered" filtered-backends)
       ;; First go through all the backends without :create, so we can
       ;; query them all.
       (setq found (auth-source-search-backends filtered-backends
@@ -810,7 +810,7 @@ (defun auth-source-search-collection (collection value)
   (when (and (atom collection) (not (eq t collection)))
     (setq collection (list collection)))
 
-  ;; (debug :collection collection :value value)
+  ;; (debug nil :collection collection :value value)
   (or (eq collection t)
       (eq value t)
       (equal collection value)
@@ -1644,7 +1644,7 @@ (defun* auth-source-secrets-create (&rest
                                     &allow-other-keys)
   ;; TODO
   ;; (apply 'secrets-create-item (auth-get-source entry) name passwd spec)
-  (debug spec))
+  (debug nil spec))
 
 ;;; Backend specific parsing: Mac OS Keychain (using /usr/bin/security) backend
 
@@ -1832,7 +1832,7 @@ (defun* auth-source-macos-keychain-create (&rest
                                            &key backend type max host user port
                                            &allow-other-keys)
   ;; TODO
-  (debug spec))
+  (debug nil spec))
 
 ;;; Backend specific parsing: PLSTORE backend
 
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index ff839d7..a05e813 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2368,7 +2368,7 @@ (defun gnus-group-read-ephemeral-group (group method &optional activate
 	    group)
 	(quit
 	 (if debug-on-quit
-	     (debug "Quit")
+	     (debug nil "Quit")
 	   (message "Quit reading the ephemeral group"))
 	 nil)))))
 
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 4e870bb..21f1b7c 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -291,7 +291,7 @@ (defun gnus-open-server (gnus-command-method)
 		 nil)
 		(quit
 		 (if debug-on-quit
-		     (debug "Quit")
+		     (debug nil "Quit")
 		   (gnus-message 1 "Quit trying to open server %s" server))
 		 nil)))
 	     open-offline)
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 0c0246a..e9d7514 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1491,7 +1491,7 @@ (defun gnus-activate-group (group &optional scan dont-check method
 					   (gnus-get-info group)))
 	     (quit
 	      (if debug-on-quit
-		  (debug "Quit")
+		  (debug nil "Quit")
 		(message "Quit activating %s" group))
 	      nil)))
 	 (unless dont-check
@@ -2058,7 +2058,7 @@ (defun gnus-read-active-file (&optional force not-native)
 	      ;; that do not respond.
 	      (quit
 	       (if debug-on-quit
-		   (debug "Quit")
+		   (debug nil "Quit")
 		 (message "Quit reading the active file"))
 	       nil))))))))
 
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 1d8ad8e..2631d09 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -780,7 +780,7 @@ (defcustom gnus-summary-mark-below 0
 (defun gnus-widget-reversible-match (widget value)
   "Ignoring WIDGET, convert VALUE to internal form.
 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
-  ;; (debug value)
+  ;; (debug nil value)
   (or (symbolp value)
       (and (listp value)
            (eq (length value) 2)
@@ -791,7 +791,7 @@ (defun gnus-widget-reversible-to-internal (widget value)
   "Ignoring WIDGET, convert VALUE to internal form.
 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
-  ;; (debug value)
+  ;; (debug nil value)
   (if (atom value)
       (list value nil)
     (list (nth 1 value) t)))
@@ -800,7 +800,7 @@ (defun gnus-widget-reversible-to-external (widget value)
   "Ignoring WIDGET, convert VALUE to external form.
 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
 \(FOO  nil) is converted to FOO and (FOO t) is converted to (not FOO)."
-  ;; (debug value)
+  ;; (debug nil value)
   (if (nth 1 value)
       (list 'not (nth 0 value))
     (nth 0 value)))
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index c476be6..d9e4908 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1946,7 +1946,7 @@ (defun nnimap-wait-for-response (sequence &optional messagep)
           openp)
       (quit
        (when debug-on-quit
-	 (debug "Quit"))
+	 (debug nil "Quit"))
        ;; The user hit C-g while we were waiting: kill the process, in case
        ;; it's a gnutls-cli process that's stuck (tends to happen a lot behind
        ;; NAT routers).
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ee28112..fa9ce9c 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -375,7 +375,7 @@ (defun icomplete-completions (name candidates predicate require-match)
          (close-bracket (if require-match ")" "]")))
     ;; `concat'/`mapconcat' is the slow part.
     (if (not (consp comps))
-	(progn ;;(debug (format "Candidates=%S field=%S" candidates name))
+	(progn ;;(debug nil (format "Candidates=%S field=%S" candidates name))
 	       (format " %sNo matches%s" open-bracket close-bracket))
       (if last (setcdr last nil))
       (let* ((most-try
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 3e59823..aaed9b4 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1155,7 +1155,7 @@ (defun imap-open (server &optional port stream auth buffer)
 		(setq streams nil))))))
       (when (imap-opened buffer)
 	(setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
-      ;; (debug "opened+state+auth+buffer" (imap-opened buffer) imap-state imap-auth buffer)
+      ;; (debug nil "opened+state+auth+buffer" (imap-opened buffer) imap-state imap-auth buffer)
       (when imap-stream
 	buffer))))
 
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index e4d16eb..359a856 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -3098,7 +3098,7 @@ (defun sh-prev-stmt ()
 	    (setq found (point))))
       (if (>= (point) start)
 	  (progn
-	    (debug "We didn't move!")
+	    (sh-debug "We didn't move!")
 	    (setq found nil))
 	(or found
 	    (sh-debug "Did not find prev stmt.")))

-- 
Nicolas