Subject: Re: bug#35802: Broken data loaded from uni-decomposition

From: [email-masked]
Date: Thu, 06 Jun 2019 13:07:01 -0400

Juri Linkov <[email-masked]> writes:

> But should return `t'.  I customized `search-whitespace-regexp'
> (whose value isearch sets to `search-spaces-regexp') to a legitimate
> value, but `unicode-property-table-internal' used in char-fold.el fails
> to correctly load "uni-decomposition.el", thus breaking the char-fold search.

The problem is that this messes up a search in find-auto-coding:

      (if (re-search-forward
           "[\r\n]\\([^\r\n]*\\)[ \t]*Local Variables:[ \t]*\\([^\r\n]*\\)[\r\n]"
           tail-end t)
          ...
          (let* ((prefix (regexp-quote (match-string 1)))
                 (suffix (regexp-quote (match-string 2)))

The space between "Local Variables" becomes "\\(\\s-\\|\n\\)+" which is
a problem because it adds a new capturing group, which means suffix gets
the wrong value.  Then we fail to find the ";; End:" line, and don't
apply the "coding: utf-8" setting.

So the value you chose isn't entirely legitimate, you should use a shy
group instead: 

(equal (progn (load "international/uni-decomposition.el" t t t t)
              (aref (cdr (assq 'decomposition char-code-property-alist)) 1024))
       (progn (let ((search-spaces-regexp "\\(?:\\s-\\|\n\\)+"))
                (load "international/uni-decomposition.el" t t t t))
              (aref (cdr (assq 'decomposition char-code-property-alist)) 1024)))
;=> t

And possibly let-binding search-spaces-regexp in find-auto-coding would
make sense (although, there's probably more places like this that might
break, not sure if we can ever hope to find them all).