From unknown Mon Sep 08 01:50:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49770: [PATCH] rmailsum: error when message contains no From header Resent-From: Nick Gasson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Jul 2021 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49770 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 49770@debbugs.gnu.org Cc: Nick Gasson X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162756926830452 (code B ref -1); Thu, 29 Jul 2021 14:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Jul 2021 14:34:28 +0000 Received: from localhost ([127.0.0.1]:57932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m977D-0007v4-D7 for submit@debbugs.gnu.org; Thu, 29 Jul 2021 10:34:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:33826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m96Hu-0006Mf-0l for submit@debbugs.gnu.org; Thu, 29 Jul 2021 09:41:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m96Hr-0007iR-G5 for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2021 09:41:25 -0400 Received: from outmail148111.authsmtp.net ([62.13.148.111]:32917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m96Hp-0002mF-9L for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2021 09:41:22 -0400 Received: from punt22.authsmtp.com (punt22.authsmtp.com [62.13.128.207]) by punt15.authsmtp.com. (8.15.2/8.15.2) with ESMTP id 16TDPZd8086252 for ; Thu, 29 Jul 2021 14:25:35 +0100 (BST) (envelope-from nick@nickg.me.uk) Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237]) by punt22.authsmtp.com. (8.15.2/8.15.2) with ESMTP id 16TDPZGC049409 for ; Thu, 29 Jul 2021 14:25:35 +0100 (BST) (envelope-from nick@nickg.me.uk) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nickg.me.uk; s=authsmtp; t=1627565135; bh=xFbhgUQfEk6QSrdWxPvBwA/7eBkxyRDKOR/h4YTPyF0=; h=Date:From:To:Subject; b=yN412vG4OTJJV2jBmwf0qc9aaU+QgOYUljq9XkxE91FUxaMQ+CbOlis4MxHxng+55 DODCc4rsygdhE2VxAcxfvxv613U/0mCugNazkfUP6zC4/ClWC+pnlqeDdGGg2aQjWl nEwKgsQF5BsrmHVb7DhJz+lM7ehYLqXn+hidOZM8= Received: from asterix.nickg.me.uk (asterix.nickg.me.uk [85.119.83.229]) (authenticated bits=0) by mail.authsmtp.com (8.15.2/8.15.2) with ESMTPSA id 16TDPYFh075667 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 29 Jul 2021 14:25:34 +0100 (BST) (envelope-from nick@nickg.me.uk) Received: from bertha.local (unknown [101.229.124.186]) by asterix.nickg.me.uk (Postfix) with ESMTPSA id 608AD8624A; Thu, 29 Jul 2021 13:25:33 +0000 (UTC) Received: from localhost (bertha.local [local]) by bertha.local (OpenSMTPD) with ESMTPA id 8a028dd9; Thu, 29 Jul 2021 13:25:30 +0000 (UTC) From: Nick Gasson Date: Thu, 29 Jul 2021 21:24:13 +0800 Message-Id: <20210729132413.42158-1-nick@nickg.me.uk> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Server-Quench: 748b41c0-f070-11eb-ba2e-8434971169dc X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd0YgkXC1ZTTQ8Z IiUFByxPDwAoYABP FxUeIk5VJkdMWAFY OV1yIVxOdloGSkcD CnlxHghLUl1zWHN0 bwBTaA9eZgRGWhtr UUFXSlFMFgdhHhkJ AQEfHBh0E3EmEQgo ZUFnWHZcEkZ6dEcz RUpcR2kHNmd9PmAY UF1ZdlYGbVEbfEpY YlR8UHoKYGQBby4z CTwLFgwaHQAXMiFc QwUWMFdACUsRBDkm Dw8CEDNnGEAeXCw8 IlQtLVgAFUcXKQ00 NhMPQ1Udex8fAwFT BSkA X-Authentic-SMTP: 61633732313238.1024:7600 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Received-SPF: pass client-ip=62.13.148.111; envelope-from=nick@nickg.me.uk; helo=outmail148111.authsmtp.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Mailman-Approved-At: Thu, 29 Jul 2021 10:34:25 -0400 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.3 (--) If you open a mbox file in rmail-mode containing a message without a "From" header and press "h" to display the summary, the following error occurs: Debugger entered--Lisp error: (wrong-type-argument stringp nil) string-match("\n" nil) rmail-header-summary() rmail-create-summary(1 nil nil 101) rmail-create-summary-line(1) rmail-get-summary(1) rmail-new-summary-1("All" (rmail-summary) nil nil) rmail-new-summary("All" (rmail-summary) nil) rmail-summary() funcall-interactively(rmail-summary) call-interactively(rmail-summary nil nil) * lisp/mail/rmailsum.el (rmail-header-summary): Check if from header is set before scanning it for newlines. --- lisp/mail/rmailsum.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 44cff21b0628..436bc78250cb 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -758,7 +758,7 @@ rmail-header-summary len mch lo newline) ;; If there are multiple lines in FROM, ;; discard up to the last newline in it. - (while (setq newline (string-match "\n" from)) + (while (and from (setq newline (string-match "\n" from))) (setq from (substring from (1+ newline)))) (if (or (null from) (string-match -- 2.30.2 From unknown Mon Sep 08 01:50:32 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Nick Gasson Subject: bug#49770: closed (Re: bug#49770: [PATCH] rmailsum: error when message contains no From header) Message-ID: References: <83h7gdrutm.fsf@gnu.org> <20210729132413.42158-1-nick@nickg.me.uk> X-Gnu-PR-Message: they-closed 49770 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 49770@debbugs.gnu.org Date: Thu, 29 Jul 2021 15:43:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1627573382-4218-1" This is a multi-part message in MIME format... ------------=_1627573382-4218-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #49770: [PATCH] rmailsum: error when message contains no From header which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 49770@debbugs.gnu.org. --=20 49770: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D49770 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1627573382-4218-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 49770-done) by debbugs.gnu.org; 29 Jul 2021 15:42:11 +0000 Received: from localhost ([127.0.0.1]:57978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m98Al-000152-GQ for submit@debbugs.gnu.org; Thu, 29 Jul 2021 11:42:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m98Aj-00014q-Mz for 49770-done@debbugs.gnu.org; Thu, 29 Jul 2021 11:42:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39810) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m98Ae-0008Eg-6a; Thu, 29 Jul 2021 11:42:04 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2246 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 1m98Ad-0001pf-J3; Thu, 29 Jul 2021 11:42:04 -0400 Date: Thu, 29 Jul 2021 18:41:41 +0300 Message-Id: <83h7gdrutm.fsf@gnu.org> From: Eli Zaretskii To: Nick Gasson In-Reply-To: <20210729132413.42158-1-nick@nickg.me.uk> (message from Nick Gasson on Thu, 29 Jul 2021 21:24:13 +0800) Subject: Re: bug#49770: [PATCH] rmailsum: error when message contains no From header References: <20210729132413.42158-1-nick@nickg.me.uk> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49770-done Cc: 49770-done@debbugs.gnu.org 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 (---) > From: Nick Gasson > Date: Thu, 29 Jul 2021 21:24:13 +0800 > Cc: Nick Gasson > > If you open a mbox file in rmail-mode containing a message without a > "From" header and press "h" to display the summary, the following > error occurs: > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > string-match("\n" nil) > rmail-header-summary() > rmail-create-summary(1 nil nil 101) > rmail-create-summary-line(1) > rmail-get-summary(1) > rmail-new-summary-1("All" (rmail-summary) nil nil) > rmail-new-summary("All" (rmail-summary) nil) > rmail-summary() > funcall-interactively(rmail-summary) > call-interactively(rmail-summary nil nil) > > * lisp/mail/rmailsum.el (rmail-header-summary): Check if from header > is set before scanning it for newlines. Thanks, installed (with a tiny change: I prefer an explicit 'stringp' test where we must have a string). This contribution was small enough for us to be able to receive it without a copyright assignment, but if you'd like to be able to contribute in the future without restrictions, I suggest to start your copyright assignment paperwork rolling. If you'd like that, I will send you the form to fill and the instructions to go with it. ------------=_1627573382-4218-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Jul 2021 14:34:28 +0000 Received: from localhost ([127.0.0.1]:57932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m977D-0007v4-D7 for submit@debbugs.gnu.org; Thu, 29 Jul 2021 10:34:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:33826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m96Hu-0006Mf-0l for submit@debbugs.gnu.org; Thu, 29 Jul 2021 09:41:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m96Hr-0007iR-G5 for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2021 09:41:25 -0400 Received: from outmail148111.authsmtp.net ([62.13.148.111]:32917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m96Hp-0002mF-9L for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2021 09:41:22 -0400 Received: from punt22.authsmtp.com (punt22.authsmtp.com [62.13.128.207]) by punt15.authsmtp.com. (8.15.2/8.15.2) with ESMTP id 16TDPZd8086252 for ; Thu, 29 Jul 2021 14:25:35 +0100 (BST) (envelope-from nick@nickg.me.uk) Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237]) by punt22.authsmtp.com. (8.15.2/8.15.2) with ESMTP id 16TDPZGC049409 for ; Thu, 29 Jul 2021 14:25:35 +0100 (BST) (envelope-from nick@nickg.me.uk) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nickg.me.uk; s=authsmtp; t=1627565135; bh=xFbhgUQfEk6QSrdWxPvBwA/7eBkxyRDKOR/h4YTPyF0=; h=Date:From:To:Subject; b=yN412vG4OTJJV2jBmwf0qc9aaU+QgOYUljq9XkxE91FUxaMQ+CbOlis4MxHxng+55 DODCc4rsygdhE2VxAcxfvxv613U/0mCugNazkfUP6zC4/ClWC+pnlqeDdGGg2aQjWl nEwKgsQF5BsrmHVb7DhJz+lM7ehYLqXn+hidOZM8= Received: from asterix.nickg.me.uk (asterix.nickg.me.uk [85.119.83.229]) (authenticated bits=0) by mail.authsmtp.com (8.15.2/8.15.2) with ESMTPSA id 16TDPYFh075667 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 29 Jul 2021 14:25:34 +0100 (BST) (envelope-from nick@nickg.me.uk) Received: from bertha.local (unknown [101.229.124.186]) by asterix.nickg.me.uk (Postfix) with ESMTPSA id 608AD8624A; Thu, 29 Jul 2021 13:25:33 +0000 (UTC) Received: from localhost (bertha.local [local]) by bertha.local (OpenSMTPD) with ESMTPA id 8a028dd9; Thu, 29 Jul 2021 13:25:30 +0000 (UTC) From: Nick Gasson To: bug-gnu-emacs@gnu.org Subject: [PATCH] rmailsum: error when message contains no From header Date: Thu, 29 Jul 2021 21:24:13 +0800 Message-Id: <20210729132413.42158-1-nick@nickg.me.uk> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Server-Quench: 748b41c0-f070-11eb-ba2e-8434971169dc X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd0YgkXC1ZTTQ8Z IiUFByxPDwAoYABP FxUeIk5VJkdMWAFY OV1yIVxOdloGSkcD CnlxHghLUl1zWHN0 bwBTaA9eZgRGWhtr UUFXSlFMFgdhHhkJ AQEfHBh0E3EmEQgo ZUFnWHZcEkZ6dEcz RUpcR2kHNmd9PmAY UF1ZdlYGbVEbfEpY YlR8UHoKYGQBby4z CTwLFgwaHQAXMiFc QwUWMFdACUsRBDkm Dw8CEDNnGEAeXCw8 IlQtLVgAFUcXKQ00 NhMPQ1Udex8fAwFT BSkA X-Authentic-SMTP: 61633732313238.1024:7600 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Received-SPF: pass client-ip=62.13.148.111; envelope-from=nick@nickg.me.uk; helo=outmail148111.authsmtp.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 29 Jul 2021 10:34:25 -0400 Cc: Nick Gasson 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.3 (--) If you open a mbox file in rmail-mode containing a message without a "From" header and press "h" to display the summary, the following error occurs: Debugger entered--Lisp error: (wrong-type-argument stringp nil) string-match("\n" nil) rmail-header-summary() rmail-create-summary(1 nil nil 101) rmail-create-summary-line(1) rmail-get-summary(1) rmail-new-summary-1("All" (rmail-summary) nil nil) rmail-new-summary("All" (rmail-summary) nil) rmail-summary() funcall-interactively(rmail-summary) call-interactively(rmail-summary nil nil) * lisp/mail/rmailsum.el (rmail-header-summary): Check if from header is set before scanning it for newlines. --- lisp/mail/rmailsum.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 44cff21b0628..436bc78250cb 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -758,7 +758,7 @@ rmail-header-summary len mch lo newline) ;; If there are multiple lines in FROM, ;; discard up to the last newline in it. - (while (setq newline (string-match "\n" from)) + (while (and from (setq newline (string-match "\n" from))) (setq from (substring from (1+ newline)))) (if (or (null from) (string-match -- 2.30.2 ------------=_1627573382-4218-1--