From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#46271: 28.0.50; [PATCH] Properly quote group names for gnus-search Date: Wed, 03 Feb 2021 15:01:31 -0800 Message-ID: <875z38zrg4.fsf@ericabrahamsen.net> References: <877dnpcm5t.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25054"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: jflack@disroot.org To: 46271@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 04 00:02:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7RA5-0006QW-BE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Feb 2021 00:02:13 +0100 Original-Received: from localhost ([::1]:48160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7RA4-0002vM-Ba for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 18:02:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7R9u-0002tU-Pp for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 18:02:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7R9u-0003CO-B9 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 18:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7R9u-0007C0-8g for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 18:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Feb 2021 23:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46271 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: jflack--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Jai Flack , 46271@debbugs.gnu.org Original-Received: via spool by 46271-submit@debbugs.gnu.org id=B46271.161239330027594 (code B ref 46271); Wed, 03 Feb 2021 23:02:02 +0000 Original-Received: (at 46271) by debbugs.gnu.org; 3 Feb 2021 23:01:40 +0000 Original-Received: from localhost ([127.0.0.1]:39129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7R9Y-0007B0-KW for submit@debbugs.gnu.org; Wed, 03 Feb 2021 18:01:40 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:56506 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7R9X-0007An-8A for 46271@debbugs.gnu.org; Wed, 03 Feb 2021 18:01:39 -0500 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 2CD89FA098; Wed, 3 Feb 2021 23:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1612393293; bh=p5n9Y3Q16tasjVfjR7XFmQYi8ja5IkedyEoQTRvZ3bo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ebIV2b0VZSK7l7ujPbkWh9dMpWYtd31fsseqNaSQdh8jwfsAE6ONncwlX05AuNd8o Tw99iAoGxduhiS7RA7msSrx1EBfGI9UykJIoaZ1mPed5JIIWac0Kf65pcPeOPUm6kk 0TTJRyHjcPogTLRzfJePTUdMCfNMeAPxRMy/CB3U= In-Reply-To: <877dnpcm5t.fsf@disroot.org> (jflack's message of "Wed, 03 Feb 2021 23:31:58 +1000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199253 Archived-At: jflack--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > -----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)) Thanks very much for the patch! Let me do some local testing over the next couple of days, but at first glance this looks like it will do the trick. Thanks, Eric