From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61514: 30.0.50; sadistically long xml line hangs emacs Date: Sun, 19 Feb 2023 18:48:43 -0500 Message-ID: References: <87lel0c65v.fsf@everybody.org> <838rgvymcd.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12570"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Mark A. Hershberger" , 61514@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 00:49:23 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 1pTtQn-000344-Qy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 00:49:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTtQZ-0003g8-Bm; Sun, 19 Feb 2023 18:49:07 -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 1pTtQV-0003dr-Ql for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 18:49:03 -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 1pTtQU-0004WE-Mn for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 18:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTtQU-000392-JU for bug-gnu-emacs@gnu.org; Sun, 19 Feb 2023 18:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Feb 2023 23:49:02 +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.167685053312060 (code B ref 61514); Sun, 19 Feb 2023 23:49:02 +0000 Original-Received: (at 61514) by debbugs.gnu.org; 19 Feb 2023 23:48:53 +0000 Original-Received: from localhost ([127.0.0.1]:49960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTtQL-00038S-Ef for submit@debbugs.gnu.org; Sun, 19 Feb 2023 18:48:53 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTtQJ-00038F-QT for 61514@debbugs.gnu.org; Sun, 19 Feb 2023 18:48:52 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6DC5980800; Sun, 19 Feb 2023 18:48:46 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E20DB8051E; Sun, 19 Feb 2023 18:48:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1676850524; bh=joRzd6NyieDP589GlzbBCM2zJ83h7t3/hFuUX13UMws=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=iE0iPDjracV7ANd46SBEg+Thxd65zIZI29ooceq02arOaO3JrQj518AOTiw+5qtXA KOgjHHhnLtF4V7sPII46ePhl+2QNZCM8Wwt2wonWbXrTe4QUmphgmA/wMN+FkL4eC4 BKIzftxXboyLQkvmGFQu4/u8/WMK0hpYHq53/iX/eleuU6Sv69jnZBFNjiL5HzwzHi 8OWKS5OoOj2o9FfcEtnkZSOmcdhsO5BTP4GY/2Cp3Z2YkxhurHiuEqrgzCgfwWwZa8 X2rGkksp9TcSbi2Zs0dFspad69RphxZXaMKA2yUDBLczjGweZ7WwkDw4dnrHJCzfty JLbaEcALXnlfQ== Original-Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 927BC123217; Sun, 19 Feb 2023 18:48:44 -0500 (EST) In-Reply-To: <838rgvymcd.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Feb 2023 18:22:58 +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:256118 Archived-At: > The problem is in the combination of nxml-mode and some subtle > bug/misfeature in our regexp routines. Specifically, when we overflow > the fail stack, we fail to recover in this case, and seem to infloop > inside re_match_2_internal, or maybe recover very inefficiently (I > waited for almost 1 hour before giving up). The call which causes the > loop is in xmltok.el, in the indicated line: > > (defun xmltok-scan-attributes () > (let ((recovering nil) > (atts-needing-normalization nil)) > (while (cond ((or (looking-at (xmltok-attribute regexp)) > ;; use non-greedy group > (when (looking-at (concat "[^<>\n]+?" <<<<<<<<<<<<<<<<< > (xmltok-attribute regexp))) > (unless recovering > (xmltok-add-error "Malformed attribute" > (point) > (save-excursion > (goto-char (xmltok-attribute start > name)) > (skip-chars-backward "\r\n\t ") > (point)))) > t)) > > The regexp that causes this is as follows: > > "[^<>\n]+?\\(\\(?:\\(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]+\\)\\)\\)?" IIUC the above describes the code where we're stuck inf-looping inside `looking-at`? Is it the same place where the regexp-stack overflow happens (and with the same regexp)? Stefan