From unknown Tue Jun 17 01:48:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45355: 26.1; shr-tag-base doesn't handle properly Resent-From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Dec 2020 20:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45355 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 45355@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160858298115520 (code B ref -1); Mon, 21 Dec 2020 20:37:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Dec 2020 20:36:21 +0000 Received: from localhost ([127.0.0.1]:48383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krRum-00042F-Rk for submit@debbugs.gnu.org; Mon, 21 Dec 2020 15:36:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:36266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krRuk-000427-CP for submit@debbugs.gnu.org; Mon, 21 Dec 2020 15:36:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krRuj-0008Es-W4 for bug-gnu-emacs@gnu.org; Mon, 21 Dec 2020 15:36:18 -0500 Received: from mx.post.pl ([89.161.251.167]:48362 helo=post.home.pl) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krRui-0003ri-Be for bug-gnu-emacs@gnu.org; Mon, 21 Dec 2020 15:36:17 -0500 Received: from localhost (tor-exit-1.zbau.f3netze.de [185.220.100.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail02.home.net.pl (Postfix) with ESMTPSA id 4FCCA22058 for ; Mon, 21 Dec 2020 21:36:10 +0100 (CET) From: =?UTF-8?Q?=C5=81ukasz?= Stelmach X-Hashcash: 1:24:201221:bug-gnu-emacs@gnu.org::j1A8ZB2TowyBybRc:VaG Date: Mon, 21 Dec 2020 21:35:57 +0100 Message-ID: <87zh26ucb6.fsf%steelman@post.pl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-VADE-SPAMSTATE: spam:medium X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedujedrvddtvddgudegfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucgoufhprghmkfhpucdlfedttddmnecujfgurhephffvufffkfgfgggtsehmtderredtreejnecuhfhrohhmpefnuhhkrghsiigpufhtvghlmhgrtghhuceoshhtvggvlhhmrghnsehpohhsthdrphhlqeenucggtffrrghtthgvrhhnpeeuieeigefhkeefleevgfeitedujedvledtleegtedvueeluddvtdeggfetgfeghfenucfkphepudekhedrvddvtddruddttddrvdehvdenucfuphgrmhfkphepudekhedrvddvtddruddttddrvdehvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedukeehrddvvddtrddutddtrddvhedvpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpeeprehuthhfqdekrefsreepveehpeekudhukhgrshiipgfuthgvlhhmrggthherpecuoehsthgvvghlmhgrnhesphhoshhtrdhplheqpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrgh X-DCC--Metrics: mail02.home.net.pl 1024; Body=1 Fuz1=1 Fuz2=1 Received-SPF: pass client-ip=89.161.251.167; envelope-from=steelman@post.pl; helo=post.home.pl X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.347, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.1 (+) 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: For what it's worth, W3C HTML Validator claims that a document with an empty string in the href attribute of a base tag is valid. I found such document recently in my INBOX and Gnus was unable to display it correctly because the second string-match in shr-parse-base breaks when local is nil. My solution is not to call [...] Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (steelman[at]post.pl) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 1.5 SPOOFED_FREEMAIL No description available. 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 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable For what it's worth, W3C HTML Validator claims that a document with an empty string in the href attribute of a base tag is valid. I found such document recently in my INBOX and Gnus was unable to display it correctly because the second string-match in shr-parse-base breaks when local is nil. My solution is not to call shr-parse-base not only when href is not present but also when href is an empty string. The patch has been crated on the current master branch. --=20 Kind regards, =C5=81ukasz Stelmach --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Handle-gracefully-href-in-base-tags.patch >From f92e8b8ab5b6f0970611c91cf80e418712ed2b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 21 Dec 2020 21:07:28 +0100 Subject: [PATCH] Handle gracefully href="" in base tags * net/shr.el (shr-tag-base): shr-parse-base can't handle empty strings gracefully. Don't call it unless href is a non-empty string. --- lisp/net/shr.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 2e5dd5ffa5..150ad88d4c 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1516,8 +1516,9 @@ ones, in case fg and bg are nil." plist))) (defun shr-tag-base (dom) - (when-let* ((base (dom-attr dom 'href))) - (setq shr-base (shr-parse-base base))) + (let* ((base (dom-attr dom 'href))) + (when (> (length base) 0) + (setq shr-base (shr-parse-base base)))) (shr-generic dom)) (defun shr-tag-a (dom) -- 2.20.1 --=-=-=-- From unknown Tue Jun 17 01:48:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45355: 26.1; shr-tag-base doesn't handle properly Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Dec 2020 06:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45355 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?=C5=81ukasz?= Stelmach Cc: 45355@debbugs.gnu.org Received: via spool by 45355-submit@debbugs.gnu.org id=B45355.160861969017735 (code B ref 45355); Tue, 22 Dec 2020 06:49:02 +0000 Received: (at 45355) by debbugs.gnu.org; 22 Dec 2020 06:48:10 +0000 Received: from localhost ([127.0.0.1]:48796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krbSr-0004by-Tu for submit@debbugs.gnu.org; Tue, 22 Dec 2020 01:48:10 -0500 Received: from quimby.gnus.org ([95.216.78.240]:49860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krbSm-0004bJ-NJ for 45355@debbugs.gnu.org; Tue, 22 Dec 2020 01:48:08 -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=/oTt4ebziQveRsvdgLvqq5XDLUjbl87Qk2z+WyKeAe8=; b=hhIgfZgP5OUwJ7jfTFSd4ZxA4S Ee5aGaCK9retNmzfmUbAJGffbf1ssYZ3OEgno4HdEK9lA4sxqwVvis5TPmGDysg5h0P2D2iIejkpt pgYFlA7i4luKQFd7lpvXTbpTlVb4IoEeqyFDeryvne6Nd2cNQICFk+HoBupb67vq6PIo=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krbSd-0002kk-52; Tue, 22 Dec 2020 07:47:58 +0100 From: Lars Ingebrigtsen References: <87zh26ucb6.fsf%steelman@post.pl> X-Now-Playing: Ultra =?UTF-8?Q?Nat=C3=A9's?= _How Long: Ultra Nate Best Remixes Volume 2_: "How Long (Ultra's House Swing)" Date: Tue, 22 Dec 2020 07:47:54 +0100 In-Reply-To: <87zh26ucb6.fsf%steelman@post.pl> ("=?UTF-8?Q?=C5=81ukasz?= Stelmach"'s message of "Mon, 21 Dec 2020 21:35:57 +0100") Message-ID: <8735zy9w11.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.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: =?UTF-8?Q?=C5=81ukasz?= Stelmach writes: > For what it's worth, W3C HTML Validator claims that a document with an > empty string in the href attribute of a base tag > > > > is valid. I found such document recently in my INBOX [...] 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: 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 (-) =C5=81ukasz Stelmach writes: > For what it's worth, W3C HTML Validator claims that a document with an > empty string in the href attribute of a base tag > > > > is valid. I found such document recently in my INBOX and Gnus was unable > to display it correctly because the second string-match in > shr-parse-base breaks when local is nil. My solution is not to call > shr-parse-base not only when href is not present but also when href is > an empty string. > > The patch has been crated on the current master branch. Looks good to me; I've now applied it to Emacs 28. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 22 01:48:16 2020 Received: (at control) by debbugs.gnu.org; 22 Dec 2020 06:48:16 +0000 Received: from localhost ([127.0.0.1]:48798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krbSx-0004cB-8c for submit@debbugs.gnu.org; Tue, 22 Dec 2020 01:48:16 -0500 Received: from quimby.gnus.org ([95.216.78.240]:49876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krbSr-0004bf-8X for control@debbugs.gnu.org; Tue, 22 Dec 2020 01:48:09 -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=kzqOUcTqmejxHUz4OAdN/lb7cyld6fvq8MfIMzTWwTQ=; b=kLpi/SRcBokFwTBaSLrxtk8xU9 HNTaJ2Lj+2b7UlbDG5ZiZqubcNlnLY+kaKOcw+eoU4fMl/1Hual7eD8fauojownSgboaHwjZaHS4E +ncJtOYKSAHaZ+pVfYZUsWGy3bwUsapRnuQLedPgeZ6WC+jOd7jxtMurqID6zLdi0R4k=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krbSj-0002kr-CH for control@debbugs.gnu.org; Tue, 22 Dec 2020 07:48:03 +0100 Date: Tue, 22 Dec 2020 07:48:00 +0100 Message-Id: <871rfi9w0v.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #45355 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 45355 fixed close 45355 28.1 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: 0.0 (/) 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: -1.0 (-) tags 45355 fixed close 45355 28.1 quit