From unknown Sat Jun 21 10:16:16 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#453 <453@debbugs.gnu.org> To: bug#453 <453@debbugs.gnu.org> Subject: Status: 23.0.60; rfc822-bad-address: wrong-type-argument error Reply-To: bug#453 <453@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:16:16 +0000 retitle 453 23.0.60; rfc822-bad-address: wrong-type-argument error reassign 453 emacs submitter 453 Stephen Berman severity 453 normal thanks From stephen.berman@gmx.net Fri Jun 20 08:35:01 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,FOURLA, MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 20 Jun 2008 15:35:02 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5KFYsTx029681 for ; Fri, 20 Jun 2008 08:34:56 -0700 Received: from mail.gnu.org ([199.232.76.166]:46526 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1K9idY-0003tg-7R for emacs-pretest-bug@gnu.org; Fri, 20 Jun 2008 11:34:52 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1K9idU-0008Vk-KD for emacs-pretest-bug@gnu.org; Fri, 20 Jun 2008 11:34:52 -0400 Received: from mail.gmx.net ([213.165.64.20]:56922) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1K9idS-0008S8-OQ for emacs-pretest-bug@gnu.org; Fri, 20 Jun 2008 11:34:48 -0400 Received: (qmail invoked by alias); 20 Jun 2008 15:34:41 -0000 Received: from i5387E080.versanet.de (EHLO escher.local.home) [83.135.224.128] by mail.gmx.net (mp057) with SMTP; 20 Jun 2008 17:34:41 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+O7WAg5FWOWeLR93yozIvhteyjd1kphO1sr8vwUQ 6bQLMi5cUnuVpo Received: by escher.local.home (Postfix, from userid 1000) id 742341D0E50; Fri, 20 Jun 2008 17:34:39 +0200 (CEST) From: Stephen Berman To: emacs-pretest-bug@gnu.org Subject: 23.0.60; rfc822-bad-address: wrong-type-argument error User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Sender: steve@escher.local.home Date: Fri, 20 Jun 2008 17:34:40 +0200 Message-ID: <873an8p1bj.fsf@escher.local.home> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) --=-=-= I was reading a newsgroup with Gnus, typed `n' (gnus-summary-next-unread-article) to read the next article[1], and got a wrong-type-argument error. The backtrace is attached. The error occurs in rfc822-bad-address, when the first argument of narrow-to-region, rfc822-address-start, is nil. The value is nil at this point because rfc822-addresses calls rfc822-nuke-whitespace before rfc822-address-start is assigned an initial value. Simply assigning an initial non-nil in the let declaration does not work, because then rfc822-bad-address tries to throw to 'address, but the corresponding catch in rfc822-addresses has not yet been established -- that happens after the call to rfc822-nuke-whitespace. I tried moving the catch above the rfc822-nuke-whitespace call: in combination with an initial value for rfc822-address-start, this allows rfc822-bad-address to return an error string to rfc822-addresses -- see the patch below --, but the caller in my setup, bbdb-rfc822-addresses, expects a list, so this raises another wrong-type-argument error. If it is legitimate for rfc822-bad-address to return a non-list value in this case, then the bug is presumably in bbdb-rfc822-addresses (from bbdb-snarf.el, not part of Emacs); but I don't know if this is the right diagnosis. If it is, I'll report it to the BBDB list, and the patch below, or a better one, should be applied to rfc822.el. Steve Berman --=-=-= Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Description: backtrace Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) narrow-to-region(nil 5) (save-restriction (insert "_^_") (narrow-to-region rfc822-address-start (if ... ... ...)) (let (...) (while losers ... ... ...)) (goto-char (point-min)) (insert "(Unparsable address -- " reason ": \"") (goto-char (point-max)) (insert "\")")) rfc822-bad-address("Unbalanced comment (...)") (if (eobp) (rfc822-bad-address "Unbalanced comment (...)") (/= (setq ch ...) 41)) (while (if (eobp) (rfc822-bad-address "Unbalanced comment (...)") (/= ... 41)) (cond (... ...) (... ...) (... ...) (t ...))) (cond ((eobp) nil) ((= ... 40) (forward-char 1) (while ... ...) (forward-char -1) (delete-char 2) t) ((memq ch ...) (delete-region ... ...) t) (t nil)) (while (cond (... nil) (... ... ... ... ... t) (... ... t) (t nil))) (let (ch) (while (cond ... ... ... ...)) (or (not leave-space) (eobp) (bobp) (= ... 32) (insert 32))) rfc822-nuke-whitespace() (let ((list nil) tem rfc822-address-start) (rfc822-nuke-whitespace) (while (not ...) (setq rfc822-address-start ...) (setq tem ...) (cond ... ... ...)) (nreverse list)) (save-excursion (set-buffer buf) (make-local-variable (quote case-fold-search)) (setq case-fold-search nil) (insert header-text) (goto-char (point-min)) (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ ]" nil t) (replace-match "\\1 " t)) (goto-char (point-min)) (let (... tem rfc822-address-start) (rfc822-nuke-whitespace) (while ... ... ... ...) (nreverse list))) (unwind-protect (save-excursion (set-buffer buf) (make-local-variable ...) (setq case-fold-search nil) (insert header-text) (goto-char ...) (while ... ...) (goto-char ...) (let ... ... ... ...)) (and buf (kill-buffer buf))) (let ((buf ...)) (unwind-protect (save-excursion ... ... ... ... ... ... ... ...) (and buf ...))) (if (string-match "\\`[ ]*\\([^][ rfc822-addresses("(\"\"Gro\x00df") (let* ((thisaddr ...) (comma ...) (parsed ...)) (if (string-match "(" ...) (setq start comma) (setq addrs ... addrline ... start 0))) (while (string-match "\\([^,]+\\)," addrline start) (let* (... ... ...) (if ... ... ...))) (let (addrs (start 0)) (setq addrline (concat addrline ",")) (while (string-match "\\([^,]+\\)," addrline start) (let* ... ...)) addrs) bbdb-rfc822-addresses("(\"\"Gro\x00df, Werner\"\") ") bbdb-get-addresses(nil "stephen\\.berman@gmx\\.net" gnus-fetch-field) bbdb/gnus-update-records(nil) bbdb/gnus-pop-up-bbdb-buffer() run-hooks(gnus-article-prepare-hook) apply(run-hooks gnus-article-prepare-hook) gnus-run-hooks(gnus-article-prepare-hook) gnus-article-prepare-display() gnus-article-prepare(166195 nil) gnus-summary-display-article(166195) gnus-summary-next-article(t nil) gnus-summary-next-unread-article() call-interactively(gnus-summary-next-unread-article nil nil) --=-=-= *** emacs/lisp/mail/rfc822.el.~1.28.~ 2008-05-06 17:54:09.000000000 +0200 --- emacs/lisp/mail/rfc822.el 2008-06-20 17:16:10.000000000 +0200 *************** *** 278,319 **** (list (substring header-text (match-beginning 1) (match-end 1))) (let ((buf (generate-new-buffer " rfc822"))) (unwind-protect ! (save-excursion ! (set-buffer buf) ! (make-local-variable 'case-fold-search) ! (setq case-fold-search nil) ;For speed(?) ! (insert header-text) ! ;; unfold continuation lines ! (goto-char (point-min)) ! (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t) ! (replace-match "\\1 " t)) ! (goto-char (point-min)) ! (let ((list ()) ! tem ! rfc822-address-start); this is for rfc822-bad-address ! (rfc822-nuke-whitespace) ! (while (not (eobp)) ! (setq rfc822-address-start (point)) ! (setq tem ! (catch 'address ; this is for rfc822-bad-address ! (cond ((rfc822-looking-at ?\,) ! nil) ! ((looking-at "[][\000-\037@;:\\.>)]") ! (forward-char) ! (rfc822-bad-address ! (format "Strange character \\%c found" ! (preceding-char)))) ! (t ! (rfc822-addresses-1 t))))) ! (cond ((null tem)) ! ((stringp tem) ! (setq list (cons tem list))) ! (t ! (setq list (nconc (nreverse tem) list))))) ! (nreverse list))) ! (and buf (kill-buffer buf)))))) (provide 'rfc822) --- 278,322 ---- (list (substring header-text (match-beginning 1) (match-end 1))) (let ((buf (generate-new-buffer " rfc822"))) (unwind-protect ! (save-excursion ! (set-buffer buf) ! (make-local-variable 'case-fold-search) ! (setq case-fold-search nil) ;For speed(?) ! (insert header-text) ! ;; unfold continuation lines ! (goto-char (point-min)) ! (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t) ! (replace-match "\\1 " t)) ! (goto-char (point-min)) ! (let ((list ()) ! tem ! ;; This is for rfc822-bad-address. Give it a non-nil initial ! ;; value to prevent rfc822-bad-address from raising a ! ;; wrong-type-argument error ! (rfc822-address-start (point))) ! (catch 'address ; this is for rfc822-bad-address ! (rfc822-nuke-whitespace) ! (while (not (eobp)) ! (setq rfc822-address-start (point)) ! (setq tem ! (cond ((rfc822-looking-at ?\,) ! nil) ! ((looking-at "[][\000-\037@;:\\.>)]") ! (forward-char) ! (rfc822-bad-address ! (format "Strange character \\%c found" ! (preceding-char)))) ! (t ! (rfc822-addresses-1 t)))) ! (cond ((null tem)) ! ((stringp tem) ! (setq list (cons tem list))) ! (t ! (setq list (nconc (nreverse tem) list))))) ! (nreverse list)))) ! (and buf (kill-buffer buf)))))) (provide 'rfc822) In GNU Emacs 23.0.60.3 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2008-06-16 on escher Windowing system distributor `The X.Org Foundation', version 11.0.70200000 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=local locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Debugger Minor modes in effect: shell-dirtrack-mode: t show-paren-mode: t recentf-mode: t tabbar-mwheel-mode: t tabbar-mode: t display-time-mode: t tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t temp-buffer-resize-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x o C-c j l i s C-u C-M-x C-c j s u m n C-x b SPC r f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f C-x b SPC r C-x b a C-y C-x b SPC r C-a SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC i SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC q t h M-u C-x b l i s C-g C-x b r C-M-x C-M-y C-M-x C-x b * S u n C-x b r C-s C-w C-w C-w C-s C-s C-s C-s C-s C-s C-s C-M-a M-< C-c j d M-x g u C-x b r C-x d C-g C-x b M-x r e p o r b C-c j C-c j e l i s C-x b M-x r e p o r b Recent messages: Auto-saving...done Mark saved where search started Mark set Auto-saving...done Mark set Auto-saving...done Quit Making completion list... byte-code: Command attempted to use minibuffer while in minibuffer Making completion list... Footnotes: [1] This is the article: --=-=-=-- From cyd@stupidchicken.com Tue Aug 26 14:28:23 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.6 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 453) by emacsbugs.donarmstrong.com; 26 Aug 2008 21:28:23 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7QLSKrG013898 for <453@emacsbugs.donarmstrong.com>; Tue, 26 Aug 2008 14:28:21 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 77E7457E34B; Tue, 26 Aug 2008 17:30:05 -0400 (EDT) To: Stephen Berman Cc: 453@debbugs.gnu.org Subject: Re: 23.0.60; rfc822-bad-address: wrong-type-argument error From: Chong Yidong Date: Tue, 26 Aug 2008 17:30:05 -0400 Message-ID: <87vdxn1n36.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sorry for the delay in replying. > I was reading a newsgroup with Gnus, typed `n' > (gnus-summary-next-unread-article) to read the next article[1], and > got a wrong-type-argument error. The backtrace is attached. The > error occurs in rfc822-bad-address, when the first argument of > narrow-to-region, rfc822-address-start, is nil. The value is nil at > this point because rfc822-addresses calls rfc822-nuke-whitespace > before rfc822-address-start is assigned an initial value. I don't see how rfc822-address-start could be nil. The code sets it to (point) just before the call to rfc822-bad-address. Could you further explain your reasoning? (while (not (eobp)) (setq rfc822-address-start (point)) (setq tem (catch 'address ; this is for rfc822-bad-address (cond ((rfc822-looking-at ?\,) nil) ((looking-at "[][\000-\037@;:\\.>)]") (forward-char) (rfc822-bad-address (format "Strange character \\%c found" (preceding-char)))) (By the way, next time you mail a patch, please try not to change whitespaces; that makes the patch very difficult to read. Thanks.) From stephen.berman@gmx.net Wed Aug 27 03:38:17 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8,RCVD_IN_SORBS_WEB autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 453) by emacsbugs.donarmstrong.com; 27 Aug 2008 10:38:17 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m7RAcDr2013015 for <453@emacsbugs.donarmstrong.com>; Wed, 27 Aug 2008 03:38:14 -0700 Received: (qmail invoked by alias); 27 Aug 2008 10:38:07 -0000 Received: from i5387ECF3.versanet.de (EHLO escher.local.home) [83.135.236.243] by mail.gmx.net (mp060) with SMTP; 27 Aug 2008 12:38:07 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18iseIu+hYiWRh8CVA+vX4N58HAwT9aOWoHQoJd5p E4RVC9vCZ1L7DW Received: by escher.local.home (Postfix, from userid 1000) id BB8711D0F56; Wed, 27 Aug 2008 12:38:05 +0200 (CEST) From: Stephen Berman To: Chong Yidong Cc: 453@debbugs.gnu.org Subject: Re: bug#453: 23.0.60; rfc822-bad-address: wrong-type-argument error References: <87vdxn1n36.fsf@cyd.mit.edu> Sender: steve@escher.local.home Date: Wed, 27 Aug 2008 12:38:05 +0200 In-Reply-To: <87vdxn1n36.fsf@cyd.mit.edu> (Chong Yidong's message of "Tue, 26 Aug 2008 17:30:05 -0400") Message-ID: <87iqtmg2uq.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Y-GMX-Trusted: 0 X-FuHaFi: 0.59 On Tue, 26 Aug 2008 17:30:05 -0400 Chong Yidong wro= te: > Sorry for the delay in replying. > >> I was reading a newsgroup with Gnus, typed `n' >> (gnus-summary-next-unread-article) to read the next article[1], and >> got a wrong-type-argument error. The backtrace is attached. The >> error occurs in rfc822-bad-address, when the first argument of >> narrow-to-region, rfc822-address-start, is nil. The value is nil at >> this point because rfc822-addresses calls rfc822-nuke-whitespace >> before rfc822-address-start is assigned an initial value. > > I don't see how rfc822-address-start could be nil. The code sets it to > (point) just before the call to rfc822-bad-address. Could you further > explain your reasoning? The error occurs before that setq can be called, because rfc822-bad-address is also called from rfc822-nuke-whitespace, and at this point rfc822-address-start is nil. In more detail: 1. bbdb-rfc822-addresses is trying to parse this header: (""Gro=C3=9F, Werner"") which presumably violates RFC822. 2. bbdb-rfc822-addresses calls rfc822-addresses, which turns the header into this string: (""Gro=C3=9F and, after let-binding but before setq-ing rfc822-address-start, 3. calls rfc822-nuke-whitespace, which further truncates the header to: ( and then calls 4. rfc822-bad-address, which tries to call narrow-to-region with rfc822-address-start, which is still nil, as the beginning of the region: BZZT! > (By the way, next time you mail a patch, please try not to change > whitespaces; that makes the patch very difficult to read. Thanks.) Sorry. That was the result of doing indent-region, which I assume means the existing indentation does not conform to Emacs conventions. Would it be appropriate to submit a separate patch to correct that? Steve Berman From cyd@stupidchicken.com Wed Aug 27 07:36:42 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.1 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 453) by emacsbugs.donarmstrong.com; 27 Aug 2008 14:36:42 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7REaaef027454 for <453@emacsbugs.donarmstrong.com>; Wed, 27 Aug 2008 07:36:37 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id CE11357E32E; Wed, 27 Aug 2008 10:38:24 -0400 (EDT) To: Stephen Berman Cc: 453@debbugs.gnu.org Subject: Re: bug#453: 23.0.60; rfc822-bad-address: wrong-type-argument error References: <87vdxn1n36.fsf@cyd.mit.edu> <87iqtmg2uq.fsf@escher.local.home> From: Chong Yidong Date: Wed, 27 Aug 2008 10:38:24 -0400 In-Reply-To: <87iqtmg2uq.fsf@escher.local.home> (Stephen Berman's message of "Wed\, 27 Aug 2008 12\:38\:05 +0200") Message-ID: <87sksqa5gf.fsf@cyd.mit.edu> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Stephen Berman writes: > 1. bbdb-rfc822-addresses is trying to parse this header: > (""Gro=C3=9F, Werner"") > which presumably violates RFC822. > 2. bbdb-rfc822-addresses calls rfc822-addresses, which turns the header > into this string: > (""Gro=C3=9F > and, after let-binding but before setq-ing rfc822-address-start, > 3. calls rfc822-nuke-whitespace, which further truncates the header to: > ( > and then calls > 4. rfc822-bad-address, which tries to call narrow-to-region with > rfc822-address-start, which is still nil, as the beginning of the > region: BZZT! Now I understand. could you send a new patch? Thanks. From stephen.berman@gmx.net Tue Sep 2 09:08:13 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 453) by emacsbugs.donarmstrong.com; 2 Sep 2008 16:08:13 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m82G85il023089 for <453@emacsbugs.donarmstrong.com>; Tue, 2 Sep 2008 09:08:06 -0700 Received: (qmail invoked by alias); 02 Sep 2008 16:07:59 -0000 Received: from i5387D68E.versanet.de (EHLO escher.local.home) [83.135.214.142] by mail.gmx.net (mp019) with SMTP; 02 Sep 2008 18:07:59 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/jW60Nij3j66CqmLinfOFDE2RtSgHoLEGCE3kW8Z osHKiaCVt8rdpu Received: by escher.local.home (Postfix, from userid 1000) id DE94F1D0F56; Tue, 2 Sep 2008 18:07:57 +0200 (CEST) From: Stephen Berman To: Chong Yidong Cc: 453@debbugs.gnu.org Subject: Re: bug#453: 23.0.60; rfc822-bad-address: wrong-type-argument error References: <87vdxn1n36.fsf@cyd.mit.edu> <87iqtmg2uq.fsf@escher.local.home> <87sksqa5gf.fsf@cyd.mit.edu> Sender: steve@escher.local.home Date: Tue, 02 Sep 2008 18:07:57 +0200 Message-ID: <871w02v8de.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Y-GMX-Trusted: 0 X-FuHaFi: 0.51 On Wed, 27 Aug 2008 10:38:24 -0400 Chong Yidong wro= te: > Stephen Berman writes: > >> 1. bbdb-rfc822-addresses is trying to parse this header: >> (""Gro=C3=9F, Werner"") >> which presumably violates RFC822. >> 2. bbdb-rfc822-addresses calls rfc822-addresses, which turns the header >> into this string: >> (""Gro=C3=9F >> and, after let-binding but before setq-ing rfc822-address-start, >> 3. calls rfc822-nuke-whitespace, which further truncates the header to: >> ( >> and then calls >> 4. rfc822-bad-address, which tries to call narrow-to-region with >> rfc822-address-start, which is still nil, as the beginning of the >> region: BZZT! > > Now I understand. could you send a new patch? Thanks. I was going to just resend my patch minus the inappropriate white space changes. But upon reconsideration, I'm not confident that the patch I sent previously DTRT. I'm not even sure what TRT is here: as I wrote in my OP, my patch returns an error string as specified by rfc822-bad-address, but the caller bbdb-rfc822-addresses expects a list, so it still raises a wrong-type error. This happens when the relocated catch sexp has scope to the end of the let that immediately encloses it (patch (i) below). But I leave the catch in its existing position and move rfc822-nuke-whitespace to within it (patch (ii) below), then no error is raised, but also there's no indication of a bad address; yet stepping through the code with edebug does pass through rfc822-bad-address. So where should the catch be located? Hopefully someone familiar (unlike me) with RFC 822 and rfc822.el, and ideally also bbdb-rfc822-addresses, can answer that question and say whether either of these patches is suitable, or provide a better one. Steve Berman Patch (i) (returns an error string as specified by rfc822-bad-address, but raises a wrong-type error with bbdb-rfc822-addresses): *** emacs/lisp/mail/rfc822.el.~1.28.~ 2008-05-06 17:54:09.000000000 +0200 --- emacs/lisp/mail/rfc822.el 2008-09-02 17:35:28.000000000 +0200 *************** *** 292,303 **** (goto-char (point-min)) (let ((list ()) tem ! rfc822-address-start); this is for rfc822-bad-address ! (rfc822-nuke-whitespace) ! (while (not (eobp)) ! (setq rfc822-address-start (point)) ! (setq tem ! (catch 'address ; this is for rfc822-bad-address (cond ((rfc822-looking-at ?\,) nil) ((looking-at "[][\000-\037@;:\\.>)]") --- 292,306 ---- (goto-char (point-min)) (let ((list ()) tem ! ;; This is for rfc822-bad-address. Give it a non-nil initial ! ;; value to prevent rfc822-bad-address from raising a ! ;; wrong-type-argument error ! (rfc822-address-start (point))) ! (catch 'address ; this is for rfc822-bad-address ! (rfc822-nuke-whitespace) ! (while (not (eobp)) ! (setq rfc822-address-start (point)) ! (setq tem (cond ((rfc822-looking-at ?\,) nil) ((looking-at "[][\000-\037@;:\\.>)]") *************** *** 306,318 **** (format "Strange character \\%c found" (preceding-char)))) (t ! (rfc822-addresses-1 t))))) ! (cond ((null tem)) ! ((stringp tem) ! (setq list (cons tem list))) ! (t ! (setq list (nconc (nreverse tem) list))))) ! (nreverse list))) (and buf (kill-buffer buf)))))) =20=20 (provide 'rfc822) --- 309,321 ---- (format "Strange character \\%c found" (preceding-char)))) (t ! (rfc822-addresses-1 t)))) ! (cond ((null tem)) ! ((stringp tem) ! (setq list (cons tem list))) ! (t ! (setq list (nconc (nreverse tem) list))))) ! (nreverse list)))) (and buf (kill-buffer buf)))))) =20=20 (provide 'rfc822) Patch (ii) (bbdb-rfc822-addresses raises no error, but also there's no indication of a bad address; yet stepping through the code with edebug does pass through rfc822-bad-address): *** emacs/lisp/mail/rfc822.el.~1.28.~ 2008-05-06 17:54:09.000000000 +0200 --- emacs/lisp/mail/rfc822.el 2008-09-02 18:01:49.000000000 +0200 *************** *** 293,312 **** (let ((list ()) tem rfc822-address-start); this is for rfc822-bad-address - (rfc822-nuke-whitespace) (while (not (eobp)) (setq rfc822-address-start (point)) (setq tem (catch 'address ; this is for rfc822-bad-address ! (cond ((rfc822-looking-at ?\,) ! nil) ! ((looking-at "[][\000-\037@;:\\.>)]") ! (forward-char) ! (rfc822-bad-address ! (format "Strange character \\%c found" ! (preceding-char)))) ! (t ! (rfc822-addresses-1 t))))) (cond ((null tem)) ((stringp tem) (setq list (cons tem list))) --- 293,313 ---- (let ((list ()) tem rfc822-address-start); this is for rfc822-bad-address (while (not (eobp)) (setq rfc822-address-start (point)) (setq tem (catch 'address ; this is for rfc822-bad-address ! (progn ! (rfc822-nuke-whitespace) ! (cond ((rfc822-looking-at ?\,) ! nil) ! ((looking-at "[][\000-\037@;:\\.>)]") ! (forward-char) ! (rfc822-bad-address ! (format "Strange character \\%c found" ! (preceding-char)))) ! (t ! (rfc822-addresses-1 t)))))) (cond ((null tem)) ((stringp tem) (setq list (cons tem list))) From cyd@stupidchicken.com Wed Sep 24 10:57:29 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 453-done) by emacsbugs.donarmstrong.com; 24 Sep 2008 17:57:29 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8OHvQpX020425 for <453-done@emacsbugs.donarmstrong.com>; Wed, 24 Sep 2008 10:57:27 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 74D2657E189; Wed, 24 Sep 2008 13:57:53 -0400 (EDT) From: Chong Yidong To: Stephen Berman Cc: 453-done@debbugs.gnu.org Subject: Re: bug#453: 23.0.60; rfc822-bad-address: wrong-type-argument error Date: Wed, 24 Sep 2008 13:57:53 -0400 Message-ID: <87ej39juji.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > Patch (i) (returns an error string as specified by rfc822-bad-address, > but raises a wrong-type error with bbdb-rfc822-addresses): I think this is the right approach; bbdb-rfc822-addresses should handle the error. I've checked in your patch, thanks. From unknown Sat Jun 21 10:16:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Thu, 23 Oct 2008 14:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator