Subject: bug#14120: invalid load-history in emacsen that CANNOT_DUMP

From: andrés ramírez <[email-masked]>
Date: Mon, 17 Feb 2020 17:14:54 +0000

Hi Stefan.

Stefan> Any chance you can try and investigate where/why/how that
Stefan> spurious value gets pushed to `load-history`?

Yes. I am going to try.

Stefan> AFAICT the only place where `load-history` gets modified is in
Stefan> lread.c:build_load_history.  Could you add some assertions
Stefan> there to try and catch the sucker?

I was aware of that. At that moment. I pointed to lread.c also. But this
seems too happen during startup (reading the dot emacs setup).

I am going to list what I would need to do for reaching the goal:
1. Recompile Emacs23 (for enabling debugging-symbols)
2.  Put a breakpoint on lread.c:build_load_history and watch how
many times it is called and with wich params. It seems a very long list
of params

3. After it. I suppose I should start emacs23 -Q  and try lo call one by
one lread.c:build_load_history with those params. And after every
function invocation I would need to check if that symbol(the spurious
one that corrupts the list) have got inside the
loads-history-list.

An idea: As I have a running emacs23 session right now.
--8<---------------cut here---------------start------------->8---
      (defun load-history-filename-element (file-regexp)
        "Get the first elt of `load-history' whose car matches FILE-REGEXP.
Return nil if there isn't one.
NOTE2ME: upd stringp condition cos of error on tramp"
        (let* ((loads load-history)
               (load-elt (and loads (car loads))))
          (save-match-data
            (while (and loads
                        (or (null (and (car load-elt) (stringp (car load-elt))))
                            (not (string-match file-regexp (car load-elt)))))
              (setq loads (cdr loads)
                    load-elt (and loads (car loads)))))
          load-elt))
 --8<---------------cut here---------------end--------------->8---

The function above could be modified for removing the stringp
validation. And every time load-history-filename-element is called when
an error happens that function show me the file on the history to which the spurious
symbol belongs to?

What Do You think?

AR