aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Pluim2022-02-26 11:46:32 +0100
committerRobert Pluim2022-03-16 18:58:49 +0100
commita86205b060b01ab000e439091ed40c8ca8b68b73 (patch)
tree038c53c23a078f06f2f014e77cc50e40f5558887
parentfa8c93ad9a6ccd210324951d999adab3766bdf63 (diff)
downloademacs-a86205b060b01ab000e439091ed40c8ca8b68b73.tar.gz
emacs-a86205b060b01ab000e439091ed40c8ca8b68b73.zip
Guard against custom entries that can contain NULs
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.
-rw-r--r--lisp/cus-edit.el6
-rw-r--r--lisp/startup.el6
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 79320313975..dae97b02303 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4798,7 +4798,11 @@ if only the first line of the docstring is shown."))
4798 (delay-mode-hooks (emacs-lisp-mode))) 4798 (delay-mode-hooks (emacs-lisp-mode)))
4799 (let ((inhibit-read-only t) 4799 (let ((inhibit-read-only t)
4800 (print-length nil) 4800 (print-length nil)
4801 (print-level nil)) 4801 (print-level nil)
4802 ;; We might be saving byte-code with embedded NULs, which
4803 ;; can cause problems when read back, so print them
4804 ;; readably. (Bug#52554)
4805 (print-escape-control-characters t))
4802 (atomic-change-group 4806 (atomic-change-group
4803 (custom-save-variables) 4807 (custom-save-variables)
4804 (custom-save-faces))) 4808 (custom-save-faces)))
diff --git a/lisp/startup.el b/lisp/startup.el
index 9f0b23c904b..ab7b81a707e 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1044,7 +1044,11 @@ init-file, or to a default value if loading is not possible."
1044 (debug-on-error-initial 1044 (debug-on-error-initial
1045 (if (eq init-file-debug t) 1045 (if (eq init-file-debug t)
1046 'startup 1046 'startup
1047 init-file-debug))) 1047 init-file-debug))
1048 ;; The init file might contain byte-code with embedded NULs,
1049 ;; which can cause problems when read back, so disable nul
1050 ;; byte detection. (Bug#52554)
1051 (inhibit-null-byte-detection t))
1048 (let ((debug-on-error debug-on-error-initial)) 1052 (let ((debug-on-error debug-on-error-initial))
1049 (condition-case-unless-debug error 1053 (condition-case-unless-debug error
1050 (when init-file-user 1054 (when init-file-user