From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Christian Johansson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 07:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 53680@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16437010702549 (code B ref -1); Tue, 01 Feb 2022 07:38:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Feb 2022 07:37:50 +0000 Received: from localhost ([127.0.0.1]:41585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEnja-0000f2-BI for submit@debbugs.gnu.org; Tue, 01 Feb 2022 02:37:50 -0500 Received: from lists.gnu.org ([209.51.188.17]:58776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEnjZ-0000eu-3G for submit@debbugs.gnu.org; Tue, 01 Feb 2022 02:37:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEnjX-00063O-6l for bug-gnu-emacs@gnu.org; Tue, 01 Feb 2022 02:37:48 -0500 Received: from mailrelay2-3.pub.mailoutpod1-cph3.one.com ([46.30.212.11]:26430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEnjU-0006SI-AA for bug-gnu-emacs@gnu.org; Tue, 01 Feb 2022 02:37:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cvj.se; s=rsa2; h=content-transfer-encoding:content-type:subject:from:to:mime-version:date: message-id:from; bh=LDmoUbzo6XFXrzCfLZxCTSDU/Y6ygJjObtYYwUnExXU=; b=AaoSaXl8mCUuYIXPJ0eaL4PA0rmAT1bHpm6cwDbWNeE0d//hbYUJeHCNdi+Nx3R+7u+n+h/0Hjv5T bszUqtZ98UgLuC+baS6Xci9Fz7lTxZoUQpNtDuGGPx9HelVWnJehDudYi17hhJgSlFzbXyGUW52QDW +H3KYK5R9UW8I+sPEqSIwnLjMy6JQrzYOBNSBckPyxAtpu02Hh3YMvKcfABUIJw5lAeEu0CO5gdRPQ Kj36wxCd+KXYJOzNFRziJdS9o66vAKRUtKD5NdAKj39S38WwwKijVc6wx+nP53LGIFiAdZtMDTJhte Bds/UfJJmS3xvxMB08Id/nbF3YuwqHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=cvj.se; s=ed2; h=content-transfer-encoding:content-type:subject:from:to:mime-version:date: message-id:from; bh=LDmoUbzo6XFXrzCfLZxCTSDU/Y6ygJjObtYYwUnExXU=; b=p53DLNKNt81Z91qK8uug0azPp1N3hT1fFEauzD6U+9NtvgiM2+FjZii8HlgrQRcvaTPt9fFHDVnpN sjTpVK9DQ== X-HalOne-Cookie: af65758e2220e969ae5ba79cca7435f03fa8e3c3 X-HalOne-ID: d4285571-8331-11ec-a4cc-d0431ea8a290 Received: from [192.168.50.160] (c188-150-212-230.bredband.tele2.se [188.150.212.230]) by mailrelay2.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id d4285571-8331-11ec-a4cc-d0431ea8a290; Tue, 01 Feb 2022 07:37:38 +0000 (UTC) Message-ID: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> Date: Tue, 1 Feb 2022 08:37:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US From: Christian Johansson Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=46.30.212.11; envelope-from=christian@cvj.se; helo=mailrelay2-3.pub.mailoutpod1-cph3.one.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Some context first, since I needed a multi-line regexp matcher that could tell the difference of end-of-string vs newline ($ vs \n) in a string I replace occurrences of \n with \r in a string. In a peculiar case a endless loop happens and I can reproduce this bug in Emacs 27.2 and 28.0.50 (have not tested any other versions), ok try to eval following snippet: (string-match-p·"[\r\t·]*implements[\r\t·]+\\([\r\t·]*[\\a-zA-Z_0-9_]+,?\\)+[\r\t·]*{$"·"ariable·implements·\\Magento\\Framework\\Event\\OberserverInterface\r{\r····public·function·__construct()\r·") or (string-match·"[\r\t·]*implements[\r\t·]+\\([\r\t·]*[\\a-zA-Z_0-9_]+,?\\)+[\r\t·]*{$"·"ariable·implements·\\Magento\\Framework\\Event\\OberserverInterface\r{\r····public·function·__construct()\r·") -- Hälsningar / Best Regards Christian From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 11:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Christian Johansson Cc: 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.16437132298648 (code B ref 53680); Tue, 01 Feb 2022 11:01:01 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 11:00:29 +0000 Received: from localhost ([127.0.0.1]:41806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEqth-0002FP-8x for submit@debbugs.gnu.org; Tue, 01 Feb 2022 06:00:29 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEqte-0002FA-LB for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 06:00:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OzR6j7reLd0obWFQrs9vFCleYxeyFmfQZMfp5h2Xi6s=; b=lvdBdSEnlr4Qy3pJzYvPVH5RTZ 1I7VSnkmMg15dwzj2adt1gXbyG58OsjsFPtbxu+KsoKYpOCA7/v0a0rhX63JOyQIirTxQOpV8myG2 Sdz/ywIkVkVO+ayowAy0bw418kXF7oPyTr8i4YkPPUusS+YAE4FBBJmtZMlOBzzyuC9g=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEqtV-0005gj-4V; Tue, 01 Feb 2022 12:00:19 +0100 From: Lars Ingebrigtsen References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> X-Now-Playing: Kid Creole and the Coconuts's _Fresh Fruit in Foreign Places_: "Dear Addy" Date: Tue, 01 Feb 2022 12:00:14 +0100 In-Reply-To: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> (Christian Johansson's message of "Tue, 1 Feb 2022 08:37:37 +0100") Message-ID: <8735l2x35t.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Christian Johansson writes: > In a peculiar case a endless loop happens and I can reproduce this bug > in Emacs 27.2 and 28.0.50 (have not tested any other versions), ok try > to eval following snippet: > > (=?UTF-8?Q?string-match-p=C2=B7?="[\r [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Christian Johansson writes: > In a peculiar case a endless loop happens and I can reproduce this bug > in Emacs 27.2 and 28.0.50 (have not tested any other versions), ok try > to eval following snippet: > > (string-match-p=C2=B7"[\r\t=C2=B7]*implements[\r\t=C2=B7]+\\([\r\t=C2=B7]= *[\\a-zA-Z_0-9_]+,?\\)+[\r\t=C2=B7]*{$"=C2=B7"ariable=C2=B7implements=C2=B7= \\Magento\\Framework\\Event\\OberserverInterface\r{\r=C2=B7=C2=B7=C2=B7=C2= =B7public=C2=B7function=C2=B7__construct()\r=C2=B7") > or I guess the =C2=B7 are supposed to be spaces, so it's: (string-match "[\r\t ]*implements[\r\t ]+\\([\r\t ]*[\\a-zA-Z_0-9_]+,?\\)+[\r\t ]*{$" "ariable implements \\Magento\\Framework\\Event\\OberserverInterface\r{\r = public function __construct()\r ") And I can reproduce this on master, too. Is it a problem with excessive backtracking, perhaps? I let it run for a minute, and it didn't finish in that time. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 01 06:00:37 2022 Received: (at control) by debbugs.gnu.org; 1 Feb 2022 11:00:37 +0000 Received: from localhost ([127.0.0.1]:41809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEqtp-0002Fl-Gk for submit@debbugs.gnu.org; Tue, 01 Feb 2022 06:00:37 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEqto-0002FY-Fk for control@debbugs.gnu.org; Tue, 01 Feb 2022 06:00:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+Vp/p6s6qucEflN76qJvzwh5F6OWGiuhINXkMNcpv5k=; b=FWsbXQUUBaDVhD87N7DKNkNU8o t/Ckz+dZKqvr5wjwebfMgeAp+idxFeqBw+vAy4RSo8JXa5sOm02FnyRa+TonkBQh13OKm69WfBIAL oGdtkfhkxF206S9WsBTnybgGWvTWaev9bDhFdxRG1fHTDWKy3Tb8IjVFgPO3wldP/B24=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEqtg-0005gr-EN for control@debbugs.gnu.org; Tue, 01 Feb 2022 12:00:30 +0100 Date: Tue, 01 Feb 2022 12:00:23 +0100 Message-Id: <871r0mx35k.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #53680 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 53680 + confirmed quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 53680 + confirmed quit From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 11:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Christian Johansson Cc: 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.16437137329537 (code B ref 53680); Tue, 01 Feb 2022 11:09:02 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 11:08:52 +0000 Received: from localhost ([127.0.0.1]:41832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEr1o-0002Tl-DP for submit@debbugs.gnu.org; Tue, 01 Feb 2022 06:08:52 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEr1m-0002TW-SE for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 06:08:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gaFDtRgWjDhVAtyo14NHvAL98/atv1zho0lJUPZ5Ltk=; b=jA3GknifY3ZfRxqNst0hcPTJpR 6gPLmD9XfsSJsf40sY2M0yTQkF9HEGHaRXIo/NF/yOaOJ1GIlsJW/A8LoNkuqIViUHC80Rh5aZG57 WK/bzpfXEJE9D8xTDi+mRjilLI/zsPF7TKbDlay9/yg02bZTgoT3cKVK89ye0d3j05TI=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEr1d-0005kz-Je; Tue, 01 Feb 2022 12:08:44 +0100 From: Lars Ingebrigtsen References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> <8735l2x35t.fsf@gnus.org> X-Now-Playing: Cristina's _Cristina_: "Don't Be Greedy" Date: Tue, 01 Feb 2022 12:08:40 +0100 In-Reply-To: <8735l2x35t.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 01 Feb 2022 12:00:14 +0100") Message-ID: <87wnievo7b.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > And I can reproduce this on master, too. Is it a problem with excessive > backtracking, perhaps? I let it run for a minute, and it didn't finish > in that time. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen writes: > And I can reproduce this on master, too. Is it a problem with excessive > backtracking, perhaps? I let it run for a minute, and it didn't finish > in that time. This simplified version also infloops: (string-match "implements\\([\r\t ]*[\\a-zA-Z0-9_]+,?\\)+{$" "ariable implements \\Magento\\Framework\\Event\\OberserverInterface\r{\r public function __construct()\r ") -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 11:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Lars Ingebrigtsen Cc: Christian Johansson , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.164371415013418 (code B ref 53680); Tue, 01 Feb 2022 11:16:01 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 11:15:50 +0000 Received: from localhost ([127.0.0.1]:41836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEr8Y-0003U8-3s for submit@debbugs.gnu.org; Tue, 01 Feb 2022 06:15:50 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:56533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEr8V-0003QX-T5 for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 06:15:48 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4Jp2RQ2Cb3z1r4ZZ; Tue, 1 Feb 2022 12:15:46 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4Jp2RQ1fQLz1qqkD; Tue, 1 Feb 2022 12:15:46 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id xYLlzgcObARH; Tue, 1 Feb 2022 12:15:45 +0100 (CET) X-Auth-Info: SYs/dLX3RKIYQWWoxzUnh2gRMSMJ4pYCRDZVR6D4U4IgPLwTVF58WCO9bvurAGn3 Received: from igel.home (ppp-46-244-190-116.dynamic.mnet-online.de [46.244.190.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 1 Feb 2022 12:15:45 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 9047F2C37EA; Tue, 1 Feb 2022 12:15:43 +0100 (CET) From: Andreas Schwab References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> <8735l2x35t.fsf@gnus.org> X-Yow: I once decorated my apartment entirely in ten foot salad forks!! Date: Tue, 01 Feb 2022 12:15:43 +0100 In-Reply-To: <8735l2x35t.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 01 Feb 2022 12:00:14 +0100") Message-ID: <87pmo63kio.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Feb 01 2022, Lars Ingebrigtsen wrote: > I guess the · are supposed to be spaces, so it's: > > (string-match > "[\r\t ]*implements[\r\t ]+\\([\r\t ]*[\\a-zA-Z_0-9_]+,?\\)+[\r\t ]*{$" > "ariable implements \\Magento\\Framework\\Event\\OberserverInterface\r{\r public function __construct()\r ") > > And I can reproduce this on master, too. Is it a problem with excessive > backtracking, perhaps? It sure is. The nesting of the + operator without proper anchoring makes the search space explode. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 11:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Lars Ingebrigtsen Cc: Christian Johansson , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.164371474820427 (code B ref 53680); Tue, 01 Feb 2022 11:26:01 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 11:25:48 +0000 Received: from localhost ([127.0.0.1]:41843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nErIC-0005JP-D1 for submit@debbugs.gnu.org; Tue, 01 Feb 2022 06:25:48 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:46204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nErI9-0005JG-M0 for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 06:25:46 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4Jp2fw3Nr4z1r3fK; Tue, 1 Feb 2022 12:25:44 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4Jp2fw34CFz1qqkC; Tue, 1 Feb 2022 12:25:44 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id JvzEvos20x0W; Tue, 1 Feb 2022 12:25:43 +0100 (CET) X-Auth-Info: V9DLKt9ct76HG6t8zq9K5XJjedXWb0rEqEP+avRTcZbN0f/umqclZoIHQfTzDJCp Received: from igel.home (ppp-46-244-190-116.dynamic.mnet-online.de [46.244.190.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 1 Feb 2022 12:25:43 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 360202C37EA; Tue, 1 Feb 2022 12:25:43 +0100 (CET) From: Andreas Schwab References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> <8735l2x35t.fsf@gnus.org> <87wnievo7b.fsf@gnus.org> X-Yow: FISH-NET-FISH-NET-FISH-NET-FISH-NET-FISH!! Date: Tue, 01 Feb 2022 12:25:43 +0100 In-Reply-To: <87wnievo7b.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 01 Feb 2022 12:08:40 +0100") Message-ID: <87leyu3k20.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Feb 01 2022, Lars Ingebrigtsen wrote: > This simplified version also infloops: > > (string-match > "implements\\([\r\t ]*[\\a-zA-Z0-9_]+,?\\)+{$" This has the same search space explosion. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 12:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Andreas Schwab Cc: Christian Johansson , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.164371780326050 (code B ref 53680); Tue, 01 Feb 2022 12:17:02 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 12:16:43 +0000 Received: from localhost ([127.0.0.1]:41978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEs5S-0006m5-TY for submit@debbugs.gnu.org; Tue, 01 Feb 2022 07:16:43 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEs5Q-0006lh-Su for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 07:16:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fXNz8JKLPTaj29JdWxj6TXamnh+Zi/LCwRFQ0MHE3x0=; b=RwrpR4ynGTe43apOY8gTtK4s8p gBEzbOoCeAtP2U2yao4KgqMuoUT6Hb6hb5Q01bQpbIODW+VUOpqjw5IlcF4NRIV090ve+3cROv/CS fB9++6JXVdvpLiJVHTmxBkJzGpCDezC8aPV/06TaVy3Ssut3RDtPtEUZylHk+voVIlmQ=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEs5H-0006rR-JA; Tue, 01 Feb 2022 13:16:34 +0100 From: Lars Ingebrigtsen References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> <8735l2x35t.fsf@gnus.org> <87pmo63kio.fsf@igel.home> X-Now-Playing: Ron Rogers's _Don't Play With My Emotions_: "Somewhere In Space" Date: Tue, 01 Feb 2022 13:16:30 +0100 In-Reply-To: <87pmo63kio.fsf@igel.home> (Andreas Schwab's message of "Tue, 01 Feb 2022 12:15:43 +0100") Message-ID: <87sft2vl29.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Andreas Schwab writes: > It sure is. The nesting of the + operator without proper anchoring > makes the search space explode. Yup. So something like Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andreas Schwab writes: > It sure is. The nesting of the + operator without proper anchoring > makes the search space explode. Yup. So something like (string-match "[\r\t ]*implements\\([\r\t ]+[\\a-zA-Z_0-9_]+,?\\)+[\r\t ]*{$" "ariable implements \\Magento\\Framework\\Event\\OberserverInterface\r{\r public function __construct()\r ") won't have the same explosion (and indeed finished immediately). So I don't think this is an Emacs bug, just a very tough regexp to match. There's been some talk about replacing Emacs' regexp motor with something that has better backtracking characteristics, but I don't recall if anybody has actually made any moves to make that happen. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 References: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> In-Reply-To: <183c66f4-463a-b372-feee-5af9f6f45719@cvj.se> Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 12:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Christian Johansson Cc: Lars Ingebrigtsen , Andreas Schwab , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.16437201816549 (code B ref 53680); Tue, 01 Feb 2022 12:57:02 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 12:56:21 +0000 Received: from localhost ([127.0.0.1]:42008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEsho-0001hZ-LZ for submit@debbugs.gnu.org; Tue, 01 Feb 2022 07:56:20 -0500 Received: from mail73c50.megamailservers.eu ([91.136.10.83]:46740 helo=mail92c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEshl-0001hO-62 for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 07:56:18 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1643720173; bh=rwpme24B7lJyO+y8aG8kZ7UhzO0tpLIsxhe/So5Bevw=; h=From:Subject:Date:Cc:To:From; b=HS+yDg38gluFP+knOrhGUoXrIN5jzbmnXsF1+TDQU4oChhtiFlFt11jW7sOtIeNQG NGh6pWf2jQCUaKmFjA0spQYcRgaH9+6lP4OIrFKtDARnMrZfj8aY12+qffDiBR6ull 9f6o8EEDcaqdNtaSBJI2Q0THoAryFXWAPO8fZnGw= Feedback-ID: mattiase@acm.or Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 211CuAGH013345; Tue, 1 Feb 2022 12:56:12 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Message-Id: <965416B7-4ACC-4571-B2C2-8607A741212F@acm.org> Date: Tue, 1 Feb 2022 13:56:10 +0100 X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A742F1C.61F92DED.0025, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > (=?UTF-8?Q?string-match=C2=B7?="=?UTF-8?Q?[\r\t=C2=B7]*implements[\r\t=C2=B7]+\\?=(=?UTF-8?Q?[\r\t=C2=B7]*[\\a-zA-Z=5F0-9=5F]+,=3F\\?=)=?UTF-8?Q?+[\r\t=C2=B7]*{$?="=?UTF-8?Q?=C2=B7?="=?UTF-8?Q?ariable?= =?UTF-8?Q?=C2=B7implement?= =?UTF-8?Q?s=C2=B7\\Magent?= =?UTF-8?Q?o\\Framewo?= =?UTF-8?Q?rk\\Event\?= =?UTF-8?Q?\Oberserve?= =?UTF-8?Q?rInterface?= =?UTF-8?Q?\r{\r=C2=B7=C2=B7=C2=B7=C2=B7p?= =?UTF-8?Q?ublic=C2=B7func?= =?UTF-8?Q?tion=C2=B7=5F=5Fcon?= [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) > = (string-match=C2=B7"[\r\t=C2=B7]*implements[\r\t=C2=B7]+\\([\r\t=C2=B7]*[\= \a-zA-Z_0-9_]+,?\\)+[\r\t=C2=B7]*{$"=C2=B7"ariable=C2=B7implements=C2=B7\\= Magento\\Framework\\Event\\OberserverInterface\r{\r=C2=B7=C2=B7=C2=B7=C2=B7= public=C2=B7function=C2=B7__construct()\r=C2=B7")=20 The diagnostics by Lars and Andreas is correct. Let's look at it more = closely, first translating the regexp to rx for ease of reasoning, and = see if we can make it work: (rx (* (in "\t\r ")) "implements" (+ (in "\t\r ")) (+ (group (* (in "\t\r ")) (+ (in "0-9A-Za-z" "\\_")) (? ","))) (* (in "\t\r ")) "{" eol) The first line is meaningless since it can match the empty string, but = you probably want to anchor the start of "implements" so that it doesn't = match "house_implements". Let's also drop the capture group, and we get: (rx symbol-start "implements" (+ (in "\t\r ")) (+ (* (in "\t\r ")) (+ (in "0-9A-Za-z" "\\_")) (? ",")) (* (in "\t\r ")) "{" eol) You clearly want to match a non-empty sequence of 'words' separated with = whitespace and/or commas, but the pattern is ambiguous -- all = inter-word separators are optional. Let's make them mandatory: (rx symbol-start "implements" ;; mandatory whitespace (+ (in "\t\r ")) ;; then a word (+ (in "0-9A-Za-z" "\\_")) ;; then maybe more words, each prefixed by spaces or comma (* (+ (in "\t\r ,")) ; fast and loose (+ (in "0-9A-Za-z" "\\_"))) ;; finally whitespace before the curly bracket (* (in "\t\r ")) "{" eol) which is reasonably efficient, since all ambiguity is now gone: the = regexp can (almost) only match in one way. Note the "fast and loose" pattern where we accept any number of spaces = or commas. Here it depends on your grammar but if you want exactly one = comma separating each word, that subexpression would be something like (* (in "\t\r ")) "," (* (in "\t\r ")) instead. From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Christian Johansson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 13:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: Lars Ingebrigtsen , Andreas Schwab , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.16437211468310 (code B ref 53680); Tue, 01 Feb 2022 13:13:01 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 13:12:26 +0000 Received: from localhost ([127.0.0.1]:42041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEsxO-00029y-1M for submit@debbugs.gnu.org; Tue, 01 Feb 2022 08:12:26 -0500 Received: from mailrelay1-3.pub.mailoutpod1-cph3.one.com ([46.30.212.10]:48101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEsxK-00029o-TS for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 08:12:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cvj.se; s=rsa2; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version:from: content-transfer-encoding:content-type:from; bh=p+EOSVVnSdgsvI9usgDCZyRn83gl93Ki7KyW50Ue1hk=; b=eNDF+zkol1zkXgHhzxaR/69SfvVwdM0yC+BvX1ygrRVNhF1pqqMC65prbZ5KPL2+crYP2fQ/dSRra FyQcMyC82TgQb9kov+jSzh8FzJXc5LzdCbrIGHAhxaEPF+9mDsBJN9AX8bvC613hYF9f7b0WNhKaqw fWI8Wih9t4xZX7t7sf4C5X5xHVLjr6C5y8VoXISufu+LGPR2Vy39hWIC8zY39tZLaLmwGENwWjsjSL gJItT7gTs8FJKAoQr0zr7ZKYGFFaXajldPVlx6SEincfaxe62kNhkCpWTaKMsXwwIi89zHZQRL/eWP DCL3uC0yDWgWDBzgGB90yhiTjb7XwoQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=cvj.se; s=ed2; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version:from: content-transfer-encoding:content-type:from; bh=p+EOSVVnSdgsvI9usgDCZyRn83gl93Ki7KyW50Ue1hk=; b=pTg8Ps8uHMCjcrHHIWivvFNkVY2q4JDp9y1YZjQ6mLcouCESpyDqcE8ayzT8oymEgQyvFa2qHHkCb pYz2rcYDA== X-HalOne-Cookie: c76210d38322e9ad3c826afccc28e3c6f837cd86 X-HalOne-ID: 95efc8a2-8360-11ec-881e-d0431ea8a283 Received: from smtpclient.apple (c188-150-212-230.bredband.tele2.se [188.150.212.230]) by mailrelay1.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 95efc8a2-8360-11ec-881e-d0431ea8a283; Tue, 01 Feb 2022 13:12:20 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Christian Johansson Mime-Version: 1.0 (1.0) Date: Tue, 1 Feb 2022 14:12:19 +0100 Message-Id: References: <965416B7-4ACC-4571-B2C2-8607A741212F@acm.org> In-Reply-To: <965416B7-4ACC-4571-B2C2-8607A741212F@acm.org> X-Mailer: iPhone Mail (19C63) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alright, thanks for helping me find the correct regexp, this issue only appe= ared on some peculiar strings > 1 feb. 2022 kl. 13:56 skrev Mattias Engdeg=C3=A5rd : >=20 > =EF=BB=BF >>=20 >> (string-match=C2=B7"[\r\t=C2=B7]*implements[\r\t=C2=B7]+\\([\r\t=C2=B7]*[= \\a-zA-Z_0-9_]+,?\\)+[\r\t=C2=B7]*{$"=C2=B7"ariable=C2=B7implements=C2=B7\\M= agento\\Framework\\Event\\OberserverInterface\r{\r=C2=B7=C2=B7=C2=B7=C2=B7pu= blic=C2=B7function=C2=B7__construct()\r=C2=B7")=20 >=20 > The diagnostics by Lars and Andreas is correct. Let's look at it more clos= ely, first translating the regexp to rx for ease of reasoning, and see if we= can make it work: >=20 > (rx (* (in "\t\r ")) > "implements" > (+ (in "\t\r ")) > (+ (group > (* (in "\t\r ")) > (+ (in "0-9A-Za-z" "\\_")) > (? ","))) > (* (in "\t\r ")) > "{" eol) >=20 > The first line is meaningless since it can match the empty string, but you= probably want to anchor the start of "implements" so that it doesn't match "= house_implements". Let's also drop the capture group, and we get: >=20 > (rx symbol-start "implements" > (+ (in "\t\r ")) > (+ (* (in "\t\r ")) > (+ (in "0-9A-Za-z" "\\_")) > (? ",")) > (* (in "\t\r ")) > "{" eol) >=20 > You clearly want to match a non-empty sequence of 'words' separated with w= hitespace and/or commas, but the pattern is ambiguous -- all inter-word sep= arators are optional. Let's make them mandatory: >=20 > (rx symbol-start "implements" > ;; mandatory whitespace > (+ (in "\t\r ")) > ;; then a word > (+ (in "0-9A-Za-z" "\\_")) > ;; then maybe more words, each prefixed by spaces or comma > (* (+ (in "\t\r ,")) ; fast and loose > (+ (in "0-9A-Za-z" "\\_"))) > ;; finally whitespace before the curly bracket > (* (in "\t\r ")) > "{" eol) >=20 > which is reasonably efficient, since all ambiguity is now gone: the regexp= can (almost) only match in one way. >=20 > Note the "fast and loose" pattern where we accept any number of spaces or c= ommas. Here it depends on your grammar but if you want exactly one comma sep= arating each word, that subexpression would be something like >=20 > (* (in "\t\r ")) > "," > (* (in "\t\r ")) >=20 > instead. >=20 From unknown Tue Jun 17 01:48:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#53680: Endless loop in peculiar case of string-match and string-match-p 27.02 and 28.0.50 Resent-From: Christian Johansson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Feb 2022 16:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53680 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: Lars Ingebrigtsen , Andreas Schwab , 53680@debbugs.gnu.org Received: via spool by 53680-submit@debbugs.gnu.org id=B53680.16437326476303 (code B ref 53680); Tue, 01 Feb 2022 16:25:02 +0000 Received: (at 53680) by debbugs.gnu.org; 1 Feb 2022 16:24:07 +0000 Received: from localhost ([127.0.0.1]:43928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEvwt-0001da-HM for submit@debbugs.gnu.org; Tue, 01 Feb 2022 11:24:07 -0500 Received: from mailrelay4-3.pub.mailoutpod1-cph3.one.com ([46.30.212.13]:17634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEvwo-0001d5-PF for 53680@debbugs.gnu.org; Tue, 01 Feb 2022 11:24:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cvj.se; s=rsa2; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=ahjG2kWqghzsueXI549pkfe/0eU7B5m/+l9FIl22FAc=; b=f5M0iqd1qYQVUP6fDJ2klmr1PBBQQEWewRK4FJAWvk7qhdZ+D3nkYV/aBNGNcBYp7Eb8ZPwL5i2gQ h12OZ1+kfg7UJTjKplfWPGAgGeex84YzHOQzNH66k8KFTlH12l82JOOuLRTOP6dA9/7asRpqcwBAWY yDYrOWglf8n877tMS86Ryain11sWEGGeYGN3qA+azBCjPxqL8Log6FEVI6KAUZZdQdrN+60tVCGfEy 4kxaYYhmfxTCQi2clzaqT9FUozGaNVIMu94j5ByXYdJ+qthE/R89Q2qiR0avawz/LeWErs10KnOoaG 0vn1lBgh1Ijj6LZNnFA9j54O6q2CdGA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=cvj.se; s=ed2; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=ahjG2kWqghzsueXI549pkfe/0eU7B5m/+l9FIl22FAc=; b=R+9ipcwVWgimxGg309wBY4HYnd4M5I914TZnL4Tfhuq6Kzy3H9aZ9ek6/+7XCuRwTL147PWkjGD3E ZgJJCW7BQ== X-HalOne-Cookie: 4f8a6fb2ce639d62e4eeff8ef606481e05d86e84 X-HalOne-ID: 5c43a488-837b-11ec-b096-d0431ea8bb10 Received: from [192.168.50.160] (c188-150-212-230.bredband.tele2.se [188.150.212.230]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 5c43a488-837b-11ec-b096-d0431ea8bb10; Tue, 01 Feb 2022 16:24:00 +0000 (UTC) Message-ID: Date: Tue, 1 Feb 2022 17:23:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US References: <965416B7-4ACC-4571-B2C2-8607A741212F@acm.org> From: Christian Johansson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) I see, thanks for the tip, I got it working now without endless-loop and without the CR work-around Hälsningar / Best Regards Christian On 01/02/2022 14:39, Mattias Engdegård wrote: > 1 feb. 2022 kl. 14.12 skrev Christian Johansson : >> Alright, thanks for helping me find the correct regexp, this issue only appeared on some peculiar strings > By the way, your translation of LF into CR in order to use "$" as end-of-string anchor is misguided: to match at the beginning or end of a string or buffer, use \` and \' (in rx, string-start and string-end or bos and eos) respectively. > From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 02 13:13:51 2022 Received: (at control) by debbugs.gnu.org; 2 Feb 2022 18:13:51 +0000 Received: from localhost ([127.0.0.1]:53464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFK8d-0000T4-1h for submit@debbugs.gnu.org; Wed, 02 Feb 2022 13:13:51 -0500 Received: from quimby.gnus.org ([95.216.78.240]:42398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFK8b-0000Sk-BW for control@debbugs.gnu.org; Wed, 02 Feb 2022 13:13:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fm/7CvYWjxR4OzoM4/bJ6/OTtOjfAZhyVJbu9xRoxuk=; b=RnY14f/3Aw+DcMIILVecVdTxIl ikjI+VsBAguSH2M13g7F8n0K8ckVS5iN20HbxpB+QqfQyQ8g6A2YNGhVe4W/abBIctmm8kF38hr8j 6NoIzyQRPQtXYufVS6WRaiSdgIiJBR0FZvU1WcMppuoyS9Jdt+FQPVp+uFEvMMayqKIY=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFK8T-0006eV-8W for control@debbugs.gnu.org; Wed, 02 Feb 2022 19:13:43 +0100 Date: Wed, 02 Feb 2022 19:13:37 +0100 Message-Id: <87tudhqgq6.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #53680 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 53680 notabug close 53680 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 53680 notabug close 53680 quit