From: Stefan Kangas Date: Sun, 1 Mar 2020 00:19:23 +0000 (+0100) Subject: Make 'load-dangerous-libraries' obsolete (Bug#37819) X-Git-Tag: emacs-28.0.90~7818 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e98ee8ddac24f7db3acfbbaadde5116d138bf698;p=emacs.git Make 'load-dangerous-libraries' obsolete (Bug#37819) When 'load-dangerous-libraries' was t, Emacs allowed loading .elc files compiled by XEmacs. This patch removes the support for that use case, and declares the variable obsolete. * lisp/subr.el (load-dangerous-libraries): Declare obsolete. * src/lread.c (Fload): Ignore its value, and thereby refuse to load files byte compiled by XEmacs. (syms_of_lread): Update doc string of 'bytecomp-version-regexp' to not refer to it. * doc/emacs/building.texi (Lisp Libraries): Remove its documentation. --- diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 02f18865f39..272b08d08e9 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1528,13 +1528,6 @@ Automatic loading also occurs when completing names for prefix being completed. To disable this feature, change the variable @code{help-enable-completion-autoload} to @code{nil}. -@vindex load-dangerous-libraries -@cindex Lisp files byte-compiled by XEmacs - By default, Emacs refuses to load compiled Lisp files which were -compiled with XEmacs, a modified version of Emacs---they can cause -Emacs to crash. Set the variable @code{load-dangerous-libraries} to -@code{t} if you want to try loading them. - @node Lisp Eval @section Evaluating Emacs Lisp Expressions @cindex Emacs Lisp mode diff --git a/etc/NEWS b/etc/NEWS index ee3a3c19e7c..7f70d149d6c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -202,6 +202,11 @@ Emacs now supports bignums so this old glitch is no longer needed. 'previous-system-time-locale' have been removed, as they were created by mistake and were not useful to Lisp code. +** The 'load-dangerous-libraries' variable is now obsolete. +It was used to allow loading Lisp libraries compiled by XEmacs, a +modified version of Emacs which is no longer actively maintained. +This is no longer supported, and setting this variable has no effect. + * Lisp Changes in Emacs 28.1 diff --git a/lisp/subr.el b/lisp/subr.el index b5ec0de156a..96b98c6a5b3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1621,6 +1621,9 @@ be a list of the form returned by `event-start' and `event-end'." (defvaralias 'messages-buffer-max-lines 'message-log-max) (define-obsolete-variable-alias 'inhibit-null-byte-detection 'inhibit-nul-byte-detection "27.1") +(make-obsolete-variable 'load-dangerous-libraries + "no longer used." "27.1") + ;;;; Alternate names for functions - these are not being phased out. diff --git a/src/lread.c b/src/lread.c index 70984d37e18..eabf3b938c2 100644 --- a/src/lread.c +++ b/src/lread.c @@ -979,9 +979,7 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun) /* Value is a version number of byte compiled code if the file associated with file descriptor FD is a compiled Lisp file that's - safe to load. Only files compiled with Emacs are safe to load. - Files compiled with XEmacs can lead to a crash in Fbyte_code - because of an incompatible change in the byte compiler. */ + safe to load. Only files compiled with Emacs can be loaded. */ static int safe_to_load_version (int fd) @@ -1135,7 +1133,6 @@ Return t if the file exists and loads successfully. */) /* True means we are loading a compiled file. */ bool compiled = 0; Lisp_Object handler; - bool safe_p = 1; const char *fmode = "r" FOPEN_TEXT; int version; @@ -1318,11 +1315,7 @@ Return t if the file exists and loads successfully. */) if (version < 0 && ! (version = safe_to_load_version (fd))) { - safe_p = 0; - if (!load_dangerous_libraries) - error ("File `%s' was not compiled in Emacs", SDATA (found)); - else if (!NILP (nomessage) && !force_load_messages) - message_with_string ("File `%s' not compiled in Emacs", found, 1); + error ("File `%s' was not compiled in Emacs", SDATA (found)); } compiled = 1; @@ -1429,10 +1422,7 @@ Return t if the file exists and loads successfully. */) if (NILP (nomessage) || force_load_messages) { - if (!safe_p) - message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...", - file, 1); - else if (is_module) + if (is_module) message_with_string ("Loading %s (module)...", file, 1); else if (!compiled) message_with_string ("Loading %s (source)...", file, 1); @@ -1492,10 +1482,7 @@ Return t if the file exists and loads successfully. */) if (!noninteractive && (NILP (nomessage) || force_load_messages)) { - if (!safe_p) - message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...done", - file, 1); - else if (is_module) + if (is_module) message_with_string ("Loading %s (module)...done", file, 1); else if (!compiled) message_with_string ("Loading %s (source)...done", file, 1); @@ -4975,7 +4962,7 @@ This overrides the value of the NOMESSAGE argument to `load'. */); When Emacs loads a compiled Lisp file, it reads the first 512 bytes from the file, and matches them against this regular expression. When the regular expression matches, the file is considered to be safe -to load. See also `load-dangerous-libraries'. */); +to load. */); Vbytecomp_version_regexp = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");