bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44506: 28.0.50; Segfault on opening a particular message in Gnus in


From: Eric Abrahamsen
Subject: bug#44506: 28.0.50; Segfault on opening a particular message in Gnus in terminal/tty
Date: Sat, 07 Nov 2020 20:03:14 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On 11/07/20 22:29 PM, Eli Zaretskii wrote:
>> From: Amin Bandali <bandali@gnu.org>
>> Cc: 44506@debbugs.gnu.org, Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Sat, 07 Nov 2020 15:03:53 -0500
>> 
>> After some bisecting of my config files, I narrowed the segaulting of
>> Gnus when opening that message down to inclusion of (require 'ebdb-gnus)
>> in my configs.  ebdb-gnus is part of EBDB, available on GNU ELPA.  I'm
>> Cc'ing Eric, EBDB's creator and maintainer, in case he might have any
>> ideas.
>
> I don't see anything in EBDB that could cause Emacs to use static
> compositions, but maybe I'm missing something.

FWIW I was able to reproduce the segfault in terminal (not in GUI). I
don't know what static compositions are, but the places where EBDB
messes with lower-level character stuff are pasted below. As you can see
it's pretty ad-hoc stuff.

There's also ebdb-i18n.el, but that mostly just involves looking up the
scripts of characters in `char-script-table'.

(defconst ebdb-char-fold-table
  (eval-when-compile
    (let ((tbl (make-char-table 'char-fold-table))
          (uni (unicode-property-table-internal 'decomposition))
          ;; Lowercase and uppercase alphabet.
          (target-seq (append (number-sequence 65 90)
                              (number-sequence 97 122))))

      ;; I don't understand what's happening here, but it's necessary.
      (let ((func (char-table-extra-slot uni 1)))
        (map-char-table (lambda (char v)
                          (when (consp char)
                            (funcall func (car char) v uni)))
                        uni))
      ;; Create lists of equivalent chars, keyed to the most basic
      ;; ascii letter.
      (map-char-table
       (lambda (char decomp)
         (when (consp decomp)
           (when (symbolp (car decomp))
             (setq decomp (cdr decomp)))
           (when (memq (car decomp) target-seq)
             (aset tbl (car decomp)
                   (cons char
                         (aref tbl (car decomp)))))))
       uni)
      ;; Then turn the lists into regexps.
      (map-char-table
       (lambda (char dec-list)
         (let ((re (regexp-opt (cons (char-to-string char)
                                     (mapcar #'string dec-list)))))
           (aset tbl char re)))
       tbl)
      tbl))
  "Char-table holding regexps used in char fold searches.
Keys are characters in the upper- and lower-case ascii ranges.
Values are a regexp matching all characters that decompose to the
key character.")

(defun ebdb-char-fold-to-regexp (string)
  "A highly simplified version of `char-fold-to-regexp'.
Only converts characters in STRING that decompose to the range
[a-zA-Z]."
  (let ((out nil)
        (end (length string))
        char
        (i 0))
    (while (< i end)
      (setq char (aref string i))
      (push
       (or (aref ebdb-char-fold-table char)
           (string char))
       out)
      (cl-incf i))
    (setq out (apply #'concat (nreverse out)))
    (if (> (length out) 5000)
        (regexp-quote string)
      out)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]