Subject: Re: bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete

From: Stefan Kangas <[email-masked]>
Date: Fri, 17 Jan 2020 07:25:34 +0100

Stefan Kangas <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> Eli Zaretskii <[email-masked]> writes:
>>
>> >> I suspect that 'load-dangerous-libraries' is largely irrelevant
>> >> nowadays.  Is this correct?  If yes, here is a patch which would
>> >> ignore it and declare it obsolete.
>> >
>> > What is the purpose of declaring this obsolete?  I'd argue we should
>> > keep this "forever", since it can never do any harm, and sometimes
>> > might do an important job.
>>
>> The patch just makes Emacs refuse to load .elc files compiled by XEmacs
>> permanently, so it looks like the right thing to me.
>
> That is my understanding too.  The use-case of loading XEmacs byte
> code is, I think, not very relevant.
>
> Is it used for anything else?  If yes, I think we should change the
> documentation to discuss that instead.  If no, I believe making it
> obsolete makes sense.
>
>> But perhaps for Emacs 28.
>
> I have nothing against that.  (We'd also have to announce this in
> NEWS; I didn't do that yet.)

I have attached an updated patch with a NEWS entry.

Does anyone have any objections to installing this on master?

Best regards,
Stefan Kangas

>From c428ffb949a8cf786e61afb24b8d4bb992049b95 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 19 Oct 2019 02:05:50 +0200
Subject: [PATCH] Make 'load-dangerous-libraries' obsolete (Bug#37819)

* lisp/subr.el (load-dangerous-libraries): Declare obsolete.
* src/lread.c (Fload): Ignore its value.
(syms_of_lread): Update doc string of 'bytecomp-version-regexp' to not
refer to it.
* doc/emacs/building.texi (Lisp Libraries): Remove its documentation.
---
 doc/emacs/building.texi | 7 -------
 etc/NEWS                | 5 +++++
 lisp/subr.el            | 3 +++
 src/lread.c             | 7 ++-----
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 02f18865f3..272b08d08e 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1528,13 +1528,6 @@ Lisp Libraries
 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 f5740c8b3c..6d5cac333d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -67,6 +67,11 @@ Formerly it made an exception for integer components of SOA records,
 because SOA serial numbers can exceed fixnum ranges on 32-bit platforms.
 Emacs now supports bignums so this old glitch is no longer needed.
 
+** The 'load-dangerous-libraries' variable is now obsolete.
+It was used to allow loading Lisp libraries compiled by XEmacs, a
+modified version by 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 0e09228f6f..8f73614d0a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1621,6 +1621,9 @@ log10
 (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 290b3d3d64..3ba13bd1ec 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1337,10 +1337,7 @@ DEFUN ("load", Fload, Sload, 1, 5, 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;
@@ -5022,7 +5019,7 @@ syms_of_lread (void)
 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\\)");
 
-- 
2.20.1