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#70626: 30.0.50; shr-correct-dom-case fails for certain svg tags Date: Mon, 29 Apr 2024 15:16:46 +0300 Message-ID: <864jbks6s1.fsf@gnu.org> References: <87ttjlrb4z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37373"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70626-done@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 29 14:18:07 2024 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 1s1PxO-0009Sz-Mg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Apr 2024 14:18:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Px3-0003Go-3v; Mon, 29 Apr 2024 08:17:45 -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 1s1Px0-0003Cn-V5 for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2024 08:17:43 -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 1s1Px0-0008S2-FM for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2024 08:17:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s1PxK-0001pb-1r for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2024 08:18:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Apr 2024 12:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 70626 X-GNU-PR-Package: emacs Mail-Followup-To: 70626@debbugs.gnu.org, eliz@gnu.org, visuweshm@gmail.com Original-Received: via spool by 70626-done@debbugs.gnu.org id=D70626.17143930427028 (code D ref 70626); Mon, 29 Apr 2024 12:18:01 +0000 Original-Received: (at 70626-done) by debbugs.gnu.org; 29 Apr 2024 12:17:22 +0000 Original-Received: from localhost ([127.0.0.1]:56935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1Pwg-0001pI-9U for submit@debbugs.gnu.org; Mon, 29 Apr 2024 08:17:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s1Pwb-0001p7-0E for 70626-done@debbugs.gnu.org; Mon, 29 Apr 2024 08:17:20 -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 1s1PwB-0008Jf-1b; Mon, 29 Apr 2024 08:16:51 -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=xhbvaWz1WRLQwxo4eNB+gthyC4ruE+ukNnv76RUq+UA=; b=YjT9cq2Xdx61oMYyUYGx XltEJL4vMWNPgfPUK6Ohl+Ox19zML5e6gFtOwjXHLwaC7l3+ulA194MVykRd/g9tMPgeuwUg5Le4k oNc99phL2rHMQcSabwwcp9HT/Bxwi7zsP51+rm4zdaGiR0m12pq2f+DKE4+dScjeRsDdbehqYT1mH TMUtOkFBcHgPHXalz6t3A/VW9Xbf2SKtrCjrQSd1sdPjlayRmcxMAjM3uZbmmzR9Jm/iQD9/bLYRu pa4AYmtwi7mBxv6s8diFaT0taihg+aIubjkS5SFB7bb5eIIX+76xEHsmiS1+oKClas9G4w01SXFy9 GavqnrjC9lenSQ==; In-Reply-To: <87ttjlrb4z.fsf@gmail.com> (message from Visuwesh on Sun, 28 Apr 2024 16:45:40 +0530) 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:284142 Archived-At: > From: Visuwesh > Date: Sun, 28 Apr 2024 16:45:40 +0530 >=20 > To reproduce: >=20 > 1. emacs -Q > 2. M-s M-w https://l.opnxng.com/r/emacs RET > 3. Witness the error message in the echo area >=20 > The function shr-correct-dom-case eventually passes the children of the > title tag which is just a string so dom-attributes signals an error > producing the following backtrace: >=20 > Debugger entered--Lisp error: (wrong-type-argument listp "settings") > car("settings") > shr-correct-dom-case("settings") > shr-correct-dom-case((title nil "settings")) > shr-correct-dom-case((svg ((xmlns . "http://www.w3.org/2000/svg") (widt= h . "24") (height . "24") (viewBox . "0 0 24 24") (fill . "none") (stroke .= "currentColor") (stroke-width . "2") (stroke-linecap . "round") (stroke-li= nejoin . "round")) (title nil "settings") (circle ((cx . "12") (cy . "12") = (r . "3"))) (path ((d . "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1= 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-= 1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65= 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 = 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.6= 5 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0= 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0= 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l= .06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V= 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 = 0-1.51 1z"))))) > shr-tag-svg((svg ((xmlns . "http://www.w3.org/2000/svg") (width . "24")= (height . "24") (viewBox . "0 0 24 24") (fill . "none") (stroke . "current= Color") (stroke-width . "2") (stroke-linecap . "round") (stroke-linejoin . = "round")) (title nil "settings") (circle ((cx . "12") (cy . "12") (r . "3")= )) (path ((d . "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2= 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21= a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.= 82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33= -1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 = 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83= 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 = 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2= 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.= 65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z= "))))) > ... >=20 > A minimal self-contained reproducer is the following: >=20 > (let ((svg " > settings > > ")) > (with-temp-buffer > (insert svg) > (let ((dom (libxml-parse-html-region))) > (shr-correct-dom-case (dom-by-tag dom 'svg))))) >=20 > The following patch fixes the issue on my end >=20 > diff --git a/lisp/net/shr.el b/lisp/net/shr.el > index 09df5f5a9bb..14b3f7aa163 100644 > --- a/lisp/net/shr.el > +++ b/lisp/net/shr.el > @@ -1510,7 +1510,8 @@ shr-correct-dom-case > (when-let ((rep (assoc-default (car attr) shr-correct-attribute-case= ))) > (setcar attr rep))) > (dolist (child (dom-children dom)) > - (shr-correct-dom-case child)) > + (when (consp child) > + (shr-correct-dom-case child))) > dom) >=20=20 > (defun shr-tag-svg (dom) Thanks, installed on master, and closing the bug.