From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#453: 23.0.60; rfc822-bad-address: wrong-type-argument error Date: Tue, 02 Sep 2008 18:07:57 +0200 Message-ID: <871w02v8de.fsf@escher.local.home> References: <87vdxn1n36.fsf@cyd.mit.edu> <87iqtmg2uq.fsf@escher.local.home> <87sksqa5gf.fsf@cyd.mit.edu> Reply-To: Stephen Berman , 453@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1220374166 23722 80.91.229.12 (2 Sep 2008 16:49:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Sep 2008 16:49:26 +0000 (UTC) Cc: 453@emacsbugs.donarmstrong.com To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 02 18:50:16 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KaZ4p-0004yl-SE for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Sep 2008 18:50:00 +0200 Original-Received: from localhost ([127.0.0.1]:46900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaZ3q-0006Qn-Iu for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Sep 2008 12:48:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KaYjC-00020q-Ex for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2008 12:27:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KaYj9-0001yI-F8 for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2008 12:27:37 -0400 Original-Received: from [199.232.76.173] (port=57575 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaYj9-0001xp-2n for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2008 12:27:35 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:60590) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KaYj8-0002bG-E4 for bug-gnu-emacs@gnu.org; Tue, 02 Sep 2008 12:27:34 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m82GRUtf030093; Tue, 2 Sep 2008 09:27:31 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m82GF3tb025181; Tue, 2 Sep 2008 09:15:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Stephen Berman Original-Sender: steve@escher.local.home Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 02 Sep 2008 16:15:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 453 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 453-submit@emacsbugs.donarmstrong.com id=B453.122037169323101 (code B ref 453); Tue, 02 Sep 2008 16:15:03 +0000 Original-Received: (at 453) by emacsbugs.donarmstrong.com; 2 Sep 2008 16:08:13 +0000 Original-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 Original-Received: (qmail invoked by alias); 02 Sep 2008 16:07:59 -0000 Original-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 Original-Received: by escher.local.home (Postfix, from userid 1000) id DE94F1D0F56; Tue, 2 Sep 2008 18:07:57 +0200 (CEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.51 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Tue, 02 Sep 2008 12:27:37 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20020 Archived-At: 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)))