Subject: bug#48492: [PATCH] Fix wrong-type-argument error while loading pdump file

From: Gong Qijian <[email-masked]>
Date: Mon, 17 May 2021 20:31:58 +0800

* lisp/startup.el(command-line): Don't reverse the
`custom-delayed-init-variables` if it's a non-list.

This issue was introduced by commit 2fb271ca "Fix unload+reload of
files using `custom-initialize-delay` (bug#47072)" which changed the
initial value of `custom-delayed-init-variables` from nil to t.

Steps to reproduce:

⋊> ./src/emacs --batch --eval '(dump-emacs-portable "dump")' && \
   ./src/emacs --dump-file=dump -nw -Q --batch
Debugger entered--Lisp error: (wrong-type-argument arrayp t)
  command-line()
  normal-top-level()
---
 lisp/startup.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index bb25c1b7..0df4fe02 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1197,12 +1197,13 @@ command-line
 
   ;; Re-evaluate predefined variables whose initial value depends on
   ;; the runtime context.
-  (setq custom-delayed-init-variables
-        ;; Initialize them in the same order they were loaded, in case there
-        ;; are dependencies between them.
-        (nreverse custom-delayed-init-variables))
-  (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
-  (setq custom-delayed-init-variables t)
+  (when (listp custom-delayed-init-variables)
+    (setq custom-delayed-init-variables
+          ;; Initialize them in the same order they were loaded, in case there
+          ;; are dependencies between them.
+          (nreverse custom-delayed-init-variables))
+    (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
+    (setq custom-delayed-init-variables t))
 
   ;; Warn for invalid user name.
   (when init-file-user
-- 
2.25.0