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

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

bug#46271: 28.0.50; [PATCH] Properly quote group names for gnus-search


From: Jai Flack
Subject: bug#46271: 28.0.50; [PATCH] Properly quote group names for gnus-search
Date: Wed, 03 Feb 2021 23:31:58 +1000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

- --=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


The new gnus-search-indexed-parse-output doesn't properly quote group
names before using them as regexes meaning a group name containing
meta-characters (other than . or \ because of the current replacement)
won't be properly matched in the search results later.

I have attached a diff that fixes this by first quoting the group name
before performing the replacement; which is now constructed with RX
to save \\ soup.

=2D-=20
Thanks,
Jai

- --=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=gnus-search-regex.diff
Content-Transfer-Encoding: quoted-printable

diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 44f43b073c..54603d8792 100644
=2D-- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -82,6 +82,7 @@
 (require 'gnus-util)
 (require 'eieio)
 (eval-when-compile (require 'cl-lib))
+(eval-when-compile (require 'rx))
 (autoload 'eieio-build-class-alist "eieio-opt")
 (autoload 'nnmaildir-base-name-to-article-number "nnmaildir")
=20
@@ -1380,8 +1381,8 @@ gnus-search-indexed-parse-output
                         (lambda (x)
                           (replace-regexp-in-string
                            ;; Accept any of [.\/] as path separators.
=2D                         "[.\\/]" "[.\\\\/]"
=2D                         (gnus-group-real-name x)))
+                           (rx (or "\\." "\\\\" "/")) "[.\\\\/]"
+                           (regexp-quote (gnus-group-real-name x))))
                         groups "\\|")))
        artlist vectors article group)
     (goto-char (point-min))

- --=-=-=--
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEuAb6YdjwXI5dBirisAc6s2XQgH0FAmAapdQACgkQsAc6s2XQ
gH1aehAAjdDYFs7rxva8vZQCHO4l6S84Ghgo3kqNyP3CXoitc7wPDAIZhvNYTnz3
/LBH/mtfJZA2TYhQkH6i3iNeF7PpJ5OhxJ1p3/in83yYHrhxsy94O61iBvElA3z0
TM8J5i3vuCc7xogze7vfGjXHe+gD7sCr/7EEFRN3Pan4bZGatJRRM3u5oKYbWmyM
dcQ+y+IzTODJ/ayx3nCX0H9r5grn7Iqh6W413bWEILr2YqTOOm37HJZ3LeDeegIv
0MitBjReUH3ePRhZtnOtyY9adbCX5AX4R65U8vLpIVTmunQ/xogHxg0L962RDlbt
4bSKrYHACbipGsBNvQ1ul76johoFRkCS/POkCAdt284VfxxwqXMxPXTJiy6ZEXjW
/4PpTZR0gGpoGMXgHjS0qT35gwmoF4rQoxGl6H4GDJIgHlg55wCgteSIANvqTEWl
8HHJ6S7pR3tbHTj4UYK+CrkrovAoW/eENtlueeuEFacvZUDfieCKwsS6SY7AdaMG
U2yetfZbLq42ZyVhK96h2pFNhOVUfn/gnLcZy1ghMlJgqMZ0S0836ql3OQGyLaJV
xwXrVJCLqz91f58TisjThMcgm7wm46fnhZ246CA3L+nZnyDQCLYtAQChDCco8O5f
ifG/JGqZqdsWGtXZGtGjj+1orCA4R+v+vxNNuytB5Wa+s8BzCCI=
=QS0M
-----END PGP SIGNATURE-----





reply via email to

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