bug#81445: 30.2; Crash with Nonspacing Mark

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> Mon, 03 Aug 2026 17:47:34 -0400
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain

>> So maybe a better option is to specbind
>> `Vload_source_file_function` to nil so we'd also avoid the overhead
>> of going through `load-with-code-conversion` for those files, where's
>> it's just a waste, AFAICT, and has a non-negligible performance impact.
>> 
>> [ I'm also favorable to removing the `no-byte-compile:t` from those
>>   files unless the corresponding `.elc` is really worse.  ]
>
> I feel that the change I suggest above is more conservative and local,
> thus safer.  After all, this code has been working for us since at
> least Emacs 25, with no problems, until this semi-crazy use case came
> along.

Now that we have the safe fix in `emacs-31`, what do you think
about applying the below to `master`?


=== Stefan

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=chartab.patch

diff --git a/src/chartab.c b/src/chartab.c
index ce3171b00bf..a181c364df8 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1273,13 +1273,12 @@ uniprop_table (Lisp_Object prop)
     {
       AUTO_STRING (intl, "international/");
       /* The uni-*.el files _must_ be read using utf-8-emacs-unix, or
-         else Emacs might crash.  We bind coding-system-for-read below
-         to protect against some Lisp which overrides the coding:
-         cookies in the uni-*.el files by, for example, binding
-         auto-coding-regexp-alist to some strange value.  */
+         else Emacs might crash (bug#81445).  To avoid this bug when some
+         Lisp overrides the coding: cookies in the uni-*.el files by, for
+         example, binding auto-coding-regexp-alist to some strange value,
+         we bind 'load-source-file-function', which also make it faster.  */
       specpdl_ref count = SPECPDL_INDEX ();
-      Lisp_Object coding = coding_inherit_eol_type (Qutf_8_emacs, Qunix);
-      specbind (Qcoding_system_for_read, coding);
+      specbind (Qload_source_file_function, Qnil);
       result = save_match_data_load (concat2 (intl, table), Qt, Qt, Qt, Qt);
       unbind_to (count, Qnil);
 
@@ -1387,5 +1386,5 @@ syms_of_chartab (void)
 	       doc: /* Alist of character property name vs char-table containing property values.
 Internal use only.  */);
   Vchar_code_property_alist = Qnil;
-  DEFSYM (Qcoding_system_for_read, "coding-system-for-read");
+  DEFSYM (Qload_source_file_function, "load-source-file-function");
 }

--=-=-=--