unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
@ 2019-10-19  0:09 Stefan Kangas
  2019-10-19  6:30 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2019-10-19  0:09 UTC (permalink / raw)
  To: 37819

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

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.

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Make-load-dangerous-libraries-obsolete.patch --]
[-- Type: application/octet-stream, Size: 2883 bytes --]

From c938ebe75a598f8c2720d8d3bccadaa7d214ab80 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

* 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 -------
 lisp/subr.el            | 3 +++
 src/lread.c             | 7 ++-----
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index f7809d4aa9..e28eab0292 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/lisp/subr.el b/lisp/subr.el
index 1a4a2e8b81..97227f97fd 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1623,6 +1623,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 4ea6202972..cda46dbba2 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1329,10 +1329,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;
@@ -5014,7 +5011,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.23.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2019-10-19  6:30 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 37819

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sat, 19 Oct 2019 02:09:59 +0200
> 
> 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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  2019-10-19  6:30 ` Eli Zaretskii
@ 2019-10-19  8:33   ` Lars Ingebrigtsen
  2019-10-19 11:55     ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-19  8:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 37819, Stefan Kangas

Eli Zaretskii <eliz@gnu.org> 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.  But perhaps for
Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  2019-10-19  8:33   ` Lars Ingebrigtsen
@ 2019-10-19 11:55     ` Stefan Kangas
       [not found]       ` <87o8v21twh.fsf@marxist.se>
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2019-10-19 11:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37819

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> 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.)

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
       [not found]       ` <87o8v21twh.fsf@marxist.se>
@ 2020-01-22 13:22         ` Lars Ingebrigtsen
  2020-01-23 17:12           ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-01-22 13:22 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 37819

Stefan Kangas <stefan@marxist.se> writes:

> Does anyone have any objections to installing this on master?

Looks good to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  2020-01-22 13:22         ` Lars Ingebrigtsen
@ 2020-01-23 17:12           ` Stefan Kangas
  2020-02-19 13:12             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Kangas @ 2020-01-23 17:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37819

[-- 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  2020-01-23 17:12           ` Stefan Kangas
@ 2020-02-19 13:12             ` Lars Ingebrigtsen
  2020-03-01  0:20               ` Stefan Kangas
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-02-19 13:12 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 37819

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.

Looks even better.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#37819: [PATCH] Make 'load-dangerous-libraries' obsolete
  2020-02-19 13:12             ` Lars Ingebrigtsen
@ 2020-03-01  0:20               ` Stefan Kangas
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Kangas @ 2020-03-01  0:20 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37819

close 37819 28.1
thanks

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.
>
> Looks even better.  :-)

Thanks, now pushed to master as commit e98ee8ddac.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-01  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-02-19 13:12             ` Lars Ingebrigtsen
2020-03-01  0:20               ` Stefan Kangas

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).