unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46270: [PATCH] Properly quote group names for gnus-search
@ 2021-02-03 12:15 jflack--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: jflack--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-03 12:15 UTC (permalink / raw)
  To: 46270

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="=-=-=", Size: 2382 bytes --]

-----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-----

iQIzBAEBCgAdFiEEuAb6YdjwXI5dBirisAc6s2XQgH0FAmAak94ACgkQsAc6s2XQ
gH1C+w/9GDbXxlEtdQW6co2dB+4hLyZtznBsMm496h1A7Gk4aZ1d4B4lnvFJKo5O
mmfECzCazck7pvuV/Zz8pcALwTdZ5fCONNrsFtxEGF0nRSLZi2DWg6CCcWCziuNA
GQjlOpsQ1+CUkpFynxnZlGyOfWlI8rsFb+LQGraKIxX5iy7+5tcein3Idf1y7nJw
d8UHXaC2DV+FGKf91kqZeSZA7yZp4yHrQqObLgAejfBfqHws61ngFB8rYNQcb/X5
SBy7K0Wrf6VdU9RItZCYr8kidmC5MMAy8xKGgXSRUimMGg4/TPu3MXVKmxsTS2C9
PyBt6wF5fw1tXL5+9KhwfJ8OFwo1MqFlTcFm7Bdlqa0THVB5C+Ib0LPTJy1rl3JW
JZ8kXwwVaY+WQD0k9VMLObRedbTdyOP2OiP2wp/q2LnGP9ybkCJ0xDC8Z0NNa15S
D9YIDejZjGeTOabh+6AJojJ4FIbYs0QAo+6Z7DCp+uqcQxcY2tv6b3b8HOXEqPHL
3W5tFa/jTXyx62u9pNx+gAiGe51NvniUrQ85mKvhhccaJfMrx/nXwidHHOc8ATzs
wWfUSKBJtAGCpDHlDr290rBl3kxcEus3+VJvK/5VCMBmcP7EeHSUIzKLhMLNxXtg
sizEVYdqdg2w3vjDVPGvYgeMeGgfNAqTTDDe5KyCfXn/hyK1JmM=
=bl7k
-----END PGP SIGNATURE-----





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-03 12:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 12:15 bug#46270: [PATCH] Properly quote group names for gnus-search jflack--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).