]> git.eshelyaron.com Git - emacs.git/commitdiff
Guard against custom entries that can contain NULs
authorRobert Pluim <rpluim@gmail.com>
Sat, 26 Feb 2022 10:46:32 +0000 (11:46 +0100)
committerRobert Pluim <rpluim@gmail.com>
Wed, 16 Mar 2022 17:58:49 +0000 (18:58 +0100)
There are custom entries that contain lambda's as values by default,
which can result in them containing embedded NULs after
byte-compilation, which wreaks havoc when they are saved to .emacs and
later read in.  (Bug#52554)

* lisp/cus-edit.el (custom-save-all): Bind
print-escape-control-characters to t.
* lisp/startup.el (startup--load-user-init-file): Bind
inhibit-null-byte-detection to t.

lisp/cus-edit.el
lisp/startup.el

index 79320313975ee7aebe4ea7f82843954d27b37a7b..dae97b023034a6fce991c2a81c4b5e9efb5e5c79 100644 (file)
@@ -4798,7 +4798,11 @@ if only the first line of the docstring is shown."))
         (delay-mode-hooks (emacs-lisp-mode)))
       (let ((inhibit-read-only t)
            (print-length nil)
-           (print-level nil))
+           (print-level nil)
+            ;; We might be saving byte-code with embedded NULs, which
+            ;; can cause problems when read back, so print them
+            ;; readably.  (Bug#52554)
+            (print-escape-control-characters t))
         (atomic-change-group
          (custom-save-variables)
          (custom-save-faces)))
index 9f0b23c904b5c35a03a1be33de607ccaf060c481..ab7b81a707ebbc3295249e7e16f0c1ab07eb7267 100644 (file)
@@ -1044,7 +1044,11 @@ init-file, or to a default value if loading is not possible."
         (debug-on-error-initial
          (if (eq init-file-debug t)
              'startup
-           init-file-debug)))
+           init-file-debug))
+        ;; The init file might contain byte-code with embedded NULs,
+        ;; which can cause problems when read back, so disable nul
+        ;; byte detection.  (Bug#52554)
+        (inhibit-null-byte-detection t))
     (let ((debug-on-error debug-on-error-initial))
       (condition-case-unless-debug error
           (when init-file-user