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#61514: 30.0.50; sadistically long xml line hangs emacs Date: Mon, 20 Feb 2023 15:54:52 +0200 Message-ID: <83cz64v3v7.fsf@gnu.org> References: <87lel0c65v.fsf@everybody.org> <838rgvymcd.fsf@gnu.org> <831qmkwmux.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35494"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mah@everybody.org, 61514@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 14:55:18 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 1pU6dR-00093T-Ro for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 14:55:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU6dE-0004xW-1y; Mon, 20 Feb 2023 08:55:04 -0500 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 1pU6dC-0004wx-7c for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:55:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU6dB-0006bY-UC for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:55:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pU6dB-0003VB-LR for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61514 X-GNU-PR-Package: emacs Original-Received: via spool by 61514-submit@debbugs.gnu.org id=B61514.167690129313439 (code B ref 61514); Mon, 20 Feb 2023 13:55:01 +0000 Original-Received: (at 61514) by debbugs.gnu.org; 20 Feb 2023 13:54:53 +0000 Original-Received: from localhost ([127.0.0.1]:51044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU6d3-0003Uh-5u for submit@debbugs.gnu.org; Mon, 20 Feb 2023 08:54:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU6d0-0003UQ-9V for 61514@debbugs.gnu.org; Mon, 20 Feb 2023 08:54:51 -0500 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 1pU6cu-0006Xy-J1; Mon, 20 Feb 2023 08:54:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0/VaqimtGcsaX//DoMnXklJzpz7JXH5bGDIiG3gklqI=; b=RgQf9L9oUJ1Q kwUVBF2XWLZw0L4nWnHCvuahnr8jeOwxMoqB+JRg40195jU772sG/wGTqVMBeFSe/TrOJVeaKMVix KebbS1jr7aHjH6b89kVCwsAj/0i/QnxmTW1p6A1BnsdVXx/1Xav9BSgT9g34VawEjLc4Jg09tHe85 Wryy6isrxtzFWAS+J2VhI2tiwrKcipryyjm2z3boY6R9P1juEEaRDxLP+7YyKNoukFjm+Sm0nsRII jUtuf04eS5js4vbGGkf7o9teDw1txVxBsKdgDpy2vbQemyiFZ71BDYijDe+exneMpmtYCn2LBNaam iLl8OzrQ+p315V/TZfJLBA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU6cu-0005Eh-2z; Mon, 20 Feb 2023 08:54:44 -0500 In-Reply-To: (message from Stefan Monnier on Mon, 20 Feb 2023 08:19:26 -0500) 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:256172 Archived-At: > From: Stefan Monnier > Cc: mah@everybody.org, 61514@debbugs.gnu.org > Date: Mon, 20 Feb 2023 08:19:26 -0500 > > > "\\(\\(?:\\(xmlns\\)\\|[_[:alpha:]][-._[:alnum:]]*\\)\\(:[_[:alpha:]][-._[:alnum:]]*\\)?\\)[ \r\t\n]*=\\(?:[ \r\t\n]*\\('[^<'&\r\n\t]*\\([&\r\n\t][^<']*\\)?'\\|\"[^<\"&\r\n\t]*\\([&\r\n\t][^<\"]*\\)?\"\\)\\(?:\\([ \r\t\n]*>\\)\\|\\(?:\\([ \r\t\n]*/\\)\\(>\\)?\\)\\|\\([ \r\t\n]+\\)\\)\\)?" > > > > As you can see, the prepended "[^<>\n]+?" in the regexp which "hangs" > > makes all the difference. So the looking-at which fails reasonably > > quickly is the first call to looking-at above, whereas the one the > > "hangs" is the second one. > > Yes, it makes a lot of sense now. > > > Maybe this points out a way out of this misery? > > I think it does. E.g. there's a chance that using "[^<>\n]+?\\<" > instead of "[^<>\n]+?" avoids the hang It does, thanks. > (not sure if it's the right thing to do for all the regexp that can > be returned by `xmltok-attribute`, tho). How would we go about finding out? Because other than that, changing the regexp solves this nasty problem, and all the tests in test/lisp/nxml/ still pass. > And for the stack overflow I haven't yet found its origin. Not sure what is the mystery here. AFAIU, we look for the closing ">", don't find it, and then start looking for fewer and fewer non-'>' characters followed by '>'. Isn't that what happens here?