unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 37819@debbugs.gnu.org
Subject: bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
Date: Thu, 23 Jan 2020 18:12:48 +0100	[thread overview]
Message-ID: <87pnfaf65r.fsf@marxist.se> (raw)
In-Reply-To: <875zh3wrpz.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 22 Jan 2020 14:22:48 +0100")

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> Does anyone have any objections to installing this on master?
>
> Looks good to me.

I realized that we can also remove some now extraneous warnings that
will never happen with the patch (since Fload errors out before them).
Please find attached an updated patch.

Best regards,
Stefan Kangas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-load-dangerous-libraries-obsolete-Bug-37819.patch --]
[-- Type: text/x-diff, Size: 5263 bytes --]

From 46c857bdb2ee9234fe1a241b49168ee11a31315b Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
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             | 23 +++++------------------
 4 files changed, 13 insertions(+), 25 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..1c2c43e2a6 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 of Emacs which is no longer actively maintained.
+This is no longer supported, and setting this variable has no effect.
+
 \f
 * 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")
+
 \f
 ;;;; Alternate names for functions - these are not being phased out.
 
diff --git a/src/lread.c b/src/lread.c
index 290b3d3d64..c7de4cc426 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -985,9 +985,7 @@ #define UPDATE_BEG_END_STATE(ch)				\
 \f
 /* 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 are safe to load.  */
 
 static int
 safe_to_load_version (int fd)
@@ -1153,7 +1151,6 @@ DEFUN ("load", Fload, Sload, 1, 5, 0,
   /* 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;
 
@@ -1336,11 +1333,7 @@ DEFUN ("load", Fload, Sload, 1, 5, 0,
 	  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;
@@ -1447,10 +1440,7 @@ DEFUN ("load", Fload, Sload, 1, 5, 0,
 
   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);
@@ -1510,10 +1500,7 @@ DEFUN ("load", Fload, Sload, 1, 5, 0,
 
   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);
@@ -5022,7 +5009,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


  reply	other threads:[~2020-01-23 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19  0:09 bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete Stefan Kangas
2019-10-19  6:30 ` Eli Zaretskii
2019-10-19  8:33   ` Lars Ingebrigtsen
2019-10-19 11:55     ` Stefan Kangas
     [not found]       ` <87o8v21twh.fsf@marxist.se>
2020-01-22 13:22         ` Lars Ingebrigtsen
2020-01-23 17:12           ` Stefan Kangas [this message]
2020-02-19 13:12             ` Lars Ingebrigtsen
2020-03-01  0:20               ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnfaf65r.fsf@marxist.se \
    --to=stefan@marxist.se \
    --cc=37819@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).