aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Kangas2020-03-01 01:19:23 +0100
committerStefan Kangas2020-03-01 01:19:23 +0100
commite98ee8ddac24f7db3acfbbaadde5116d138bf698 (patch)
treea95466e9ebba777a5a76c0c48f5eba09c037f46c /src
parent79fe3205663ffee171b1694a35a8c1a22fceb8f4 (diff)
downloademacs-e98ee8ddac24f7db3acfbbaadde5116d138bf698.tar.gz
emacs-e98ee8ddac24f7db3acfbbaadde5116d138bf698.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c23
1 files changed, 5 insertions, 18 deletions
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)
979 979
980/* Value is a version number of byte compiled code if the file 980/* Value is a version number of byte compiled code if the file
981 associated with file descriptor FD is a compiled Lisp file that's 981 associated with file descriptor FD is a compiled Lisp file that's
982 safe to load. Only files compiled with Emacs are safe to load. 982 safe to load. Only files compiled with Emacs can be loaded. */
983 Files compiled with XEmacs can lead to a crash in Fbyte_code
984 because of an incompatible change in the byte compiler. */
985 983
986static int 984static int
987safe_to_load_version (int fd) 985safe_to_load_version (int fd)
@@ -1135,7 +1133,6 @@ Return t if the file exists and loads successfully. */)
1135 /* True means we are loading a compiled file. */ 1133 /* True means we are loading a compiled file. */
1136 bool compiled = 0; 1134 bool compiled = 0;
1137 Lisp_Object handler; 1135 Lisp_Object handler;
1138 bool safe_p = 1;
1139 const char *fmode = "r" FOPEN_TEXT; 1136 const char *fmode = "r" FOPEN_TEXT;
1140 int version; 1137 int version;
1141 1138
@@ -1318,11 +1315,7 @@ Return t if the file exists and loads successfully. */)
1318 if (version < 0 1315 if (version < 0
1319 && ! (version = safe_to_load_version (fd))) 1316 && ! (version = safe_to_load_version (fd)))
1320 { 1317 {
1321 safe_p = 0; 1318 error ("File `%s' was not compiled in Emacs", SDATA (found));
1322 if (!load_dangerous_libraries)
1323 error ("File `%s' was not compiled in Emacs", SDATA (found));
1324 else if (!NILP (nomessage) && !force_load_messages)
1325 message_with_string ("File `%s' not compiled in Emacs", found, 1);
1326 } 1319 }
1327 1320
1328 compiled = 1; 1321 compiled = 1;
@@ -1429,10 +1422,7 @@ Return t if the file exists and loads successfully. */)
1429 1422
1430 if (NILP (nomessage) || force_load_messages) 1423 if (NILP (nomessage) || force_load_messages)
1431 { 1424 {
1432 if (!safe_p) 1425 if (is_module)
1433 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...",
1434 file, 1);
1435 else if (is_module)
1436 message_with_string ("Loading %s (module)...", file, 1); 1426 message_with_string ("Loading %s (module)...", file, 1);
1437 else if (!compiled) 1427 else if (!compiled)
1438 message_with_string ("Loading %s (source)...", file, 1); 1428 message_with_string ("Loading %s (source)...", file, 1);
@@ -1492,10 +1482,7 @@ Return t if the file exists and loads successfully. */)
1492 1482
1493 if (!noninteractive && (NILP (nomessage) || force_load_messages)) 1483 if (!noninteractive && (NILP (nomessage) || force_load_messages))
1494 { 1484 {
1495 if (!safe_p) 1485 if (is_module)
1496 message_with_string ("Loading %s (compiled; note unsafe, not compiled in Emacs)...done",
1497 file, 1);
1498 else if (is_module)
1499 message_with_string ("Loading %s (module)...done", file, 1); 1486 message_with_string ("Loading %s (module)...done", file, 1);
1500 else if (!compiled) 1487 else if (!compiled)
1501 message_with_string ("Loading %s (source)...done", file, 1); 1488 message_with_string ("Loading %s (source)...done", file, 1);
@@ -4975,7 +4962,7 @@ This overrides the value of the NOMESSAGE argument to `load'. */);
4975When Emacs loads a compiled Lisp file, it reads the first 512 bytes 4962When Emacs loads a compiled Lisp file, it reads the first 512 bytes
4976from the file, and matches them against this regular expression. 4963from the file, and matches them against this regular expression.
4977When the regular expression matches, the file is considered to be safe 4964When the regular expression matches, the file is considered to be safe
4978to load. See also `load-dangerous-libraries'. */); 4965to load. */);
4979 Vbytecomp_version_regexp 4966 Vbytecomp_version_regexp
4980 = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); 4967 = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
4981 4968