From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66363: gdb-control-commands-regexp issues Date: Thu, 05 Oct 2023 21:52:21 +0300 Message-ID: <83il7k3nru.fsf@gnu.org> References: <83wmw12fu5.fsf@gnu.org> <83jzs12cdv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14814"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66363@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 05 20:52:53 2023 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 1qoTSu-0003aF-Hu for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Oct 2023 20:52:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoTSo-0004u4-FP; Thu, 05 Oct 2023 14:52:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoTSm-0004tf-7l for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 14:52:44 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoTSl-0000Bq-UE for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 14:52:43 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoTT4-00018F-1k for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 14:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.16965319604310 (code B ref 66363); Thu, 05 Oct 2023 18:53:02 +0000 Original-Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 18:52:40 +0000 Original-Received: from localhost ([127.0.0.1]:48549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoTSh-00017S-OY for submit@debbugs.gnu.org; Thu, 05 Oct 2023 14:52:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoTSf-00017C-0l for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 14:52:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoTSH-0008Ig-4l; Thu, 05 Oct 2023 14:52:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=NDZPK+77RPktuHIl5iaZXM9bQYphRiiAKX+L5dm2KlE=; b=NfLkbbsOaJsU/TzQ7YAZ 83KMnGEMwp5uc49Y2p9Ha+AMSseKqWGEPwd6pdbD4FtT0Z7yg+Kmj4IGEmAWXIjXH88F3ndF/tIFp pPvpzHPt9P/lLs90qWTX/LuPIq6X1tCzKc4dl8eVL554lnWZAEInHQSn1KGFMBxfFC8atm58StE9z ThzPSSgOlQ6kowcAe8tgg0z73y0caKixtHQQwRfcMKhgtwxLalA+M0RG3twHFWReQWu5K7A0EANmu GFSihsQ9cEoVqKSrA2wJV2hPw93Zj5Oks24LNMrrMBXXdibm7VD5BXnGHlLZB50X+1+BMtLCH0mp8 kecKQP3VlxRIDw==; In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Thu, 5 Oct 2023 20:11:24 +0200) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271914 Archived-At: > From: Mattias EngdegÄrd > Date: Thu, 5 Oct 2023 20:11:24 +0200 > Cc: 66363@debbugs.gnu.org > > 5 okt. 2023 kl. 19.43 skrev Eli Zaretskii : > > > So the problem is only that 3 should be changed to the correct group > > number? > > That would perhaps work, but it wouldn't be a very robust solution. There are many groups preceding that we don't care about, and the bug arose precisely because they were added without considering that a group was being used. > > Better then to get rid of all groups save the one in use. (The proposed patch does that.) > That would make it much more difficult for the same bug to arise again. > > > Here you are talking about some optimization of the regexp, or is it > > another bug? If the latter, what is the bug here? > > It's related. When the reference to subgroup 3 was added (30c0f81f9f), the tail looked like this: > > "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)?$" > ^^^^^^^^^^^^^^^^^^^ > and subgroup 3 was the second group in this substring (underlined above). Later (f71afd600a) the last `?` was changed into a `*`, but that made the contents of that group somewhat hazy because of the repetition: > > "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" > ^ > which doesn't leave us with a useful group for the purpose of detecting command arguments at all. > So the tail of the regexp has to be rewritten anyway, and we might as well do it in a more straightforward way. (The proposed patch does that as well.) > > The reason I found this is that it contains a sub-pattern on the form (A+B*)* which is super-linear in general but usually easy to fix so that the result is actually more readable, yet faster. Thanks. I'm okay with the changes in principle, but someone will have to test them by running all of the control commands and verifying they work after the fix, before this can be installed. I myself won't have the time for doing that any time soon, sorry.