From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jflack--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#46271: 28.0.50; [PATCH] Properly quote group names for gnus-search Date: Wed, 03 Feb 2021 23:31:58 +1000 Message-ID: <877dnpcm5t.fsf@disroot.org> Reply-To: Jai Flack Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34914"; mail-complaints-to="usenet@ciao.gmane.io" To: 46271@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 03 14:33:26 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 1l7IHe-0008yx-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 14:33:26 +0100 Original-Received: from localhost ([::1]:60878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7IHd-00065u-4h for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Feb 2021 08:33:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7IHG-00064t-92 for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 08:33:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7IHG-0002Ej-1s for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 08:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l7IHF-00061j-Va for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 08:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jai Flack Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Feb 2021 13:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46271 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161235915223124 (code B ref -1); Wed, 03 Feb 2021 13:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Feb 2021 13:32:32 +0000 Original-Received: from localhost ([127.0.0.1]:37252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7IGm-00060u-BB for submit@debbugs.gnu.org; Wed, 03 Feb 2021 08:32:32 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:54528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7IGk-00060m-Mz for submit@debbugs.gnu.org; Wed, 03 Feb 2021 08:32:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7IGk-0005sI-DK for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 08:32:30 -0500 Original-Received: from knopi.disroot.org ([178.21.23.139]:52066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7IGi-00020o-Ik for bug-gnu-emacs@gnu.org; Wed, 03 Feb 2021 08:32:30 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 95BD050DEA for ; Wed, 3 Feb 2021 14:32:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at disroot.org X-Amavis-Alert: BAD HEADER SECTION, MIME error: error: unexpected end of preamble Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BY4TeMI5JmQQ for ; Wed, 3 Feb 2021 14:32:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1612359145; bh=k0go3MUeZUli+V69L0qT3bJmhzDcEIvki/SlcwRa6kU=; h=From:To:Subject:Date; b=MxBgbEnl9iW6/Qivf3xVMue5gP5JwsPYFkvShaZ37awMZiaAVAqrAEAzr60cFfwJ2 eDfYbMVi12DYrEZLw/fQeexWNG+o+OMbiNYFE0rXZxhc9jUbleaxcfLNo+b7gt65DC 8tS9X9DiTy0I//FlMAPBev39ciZxPllLBCGVQWdvpG61ohTiEjaN4T7K+8hsN+fERb 7SRdG4Nnfv4mlTHWrq7pHjUa5NucX31a8uZnRR+SP8lhqrtpTO0JnBaqcs2RffqKey RbgvyRwv63ZtNSim6PFjsEtJvN+Dwo/63sV4xqcDIJ0AABeaS/e+ewLxzyhSfl6JXp q+cb78dPOakjw== Received-SPF: pass client-ip=178.21.23.139; envelope-from=jflack@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_NO_TEXT=1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:199194 Archived-At: -----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-----