From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14051 invoked from network); 18 Dec 2022 16:32:59 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2022 16:32:59 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p6wau-009KpK-FY for ml@inbox.vuxu.org; Sun, 18 Dec 2022 10:32:56 -0600 Received: from lists1.math.uh.edu ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.96) (envelope-from ) id 1p6wau-004X40-0X for ml@inbox.vuxu.org; Sun, 18 Dec 2022 10:32:56 -0600 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtp (Exim 4.96) (envelope-from ) id 1p6ZTw-004V5b-06 for ding@lists.math.uh.edu; Sat, 17 Dec 2022 09:52:13 -0600 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p6ZTt-006PyR-Ra for ding@lists.math.uh.edu; Sat, 17 Dec 2022 09:52:11 -0600 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:References :Subject:In-Reply-To:Cc:To:From:Message-Id:Date: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=oiO0RPspmiKKugBdeBamH9oYpPo295O71l9hfLvdLlg=; b=C6KpFm/lVgXW2WMVvKnmEvBDu5 kK62A6nGpY0xvJ2T8/cqmRpIXA9pG1keu3RuM+C/fyzH2W5pJ7kCx73/X/5ElXaJe5I+NSNUUZxs+ r5TpvLlQFlnxjFCNbDIwUh3N3pT/dOsqC5oaC5TuSaMeUCAVRjll282mLdAIjKqXr3wM=; Received: from eggs.gnu.org ([2001:470:142:3::10]) by quimby.gnus.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6ZTl-0006Rq-3l; Sat, 17 Dec 2022 16:52:04 +0100 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 1p6ZTg-0001bi-Fa; Sat, 17 Dec 2022 10:51:56 -0500 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=oiO0RPspmiKKugBdeBamH9oYpPo295O71l9hfLvdLlg=; b=Fm4Rhej7/MJYJp1xf/KK MgUHdEO0ZkrLm6mj3IxeJHFKMs16TzgpxMZzwkyKLbyszjzOBoNpB7V/47hGjvzA3kb81VYS6NT/N h1umINKXnVGUIM4oaihNtAxv2IBIeeFQfMTeF68MK5WBz1ccRKBzYQXrTzb8kCuLbehz3Y4DS88cI uZbnMKhH2y/2L/FSa3XJHJeyt3ZJhGPG63llzUjhe9/LQn4jCXQ6TgYvMd+0iE+D2fB+j67pWNam1 KpPQWydl5nZLL1YY/GAZGVtVXdJ5kv7Pok7ilcY0Nu99WvnAYsugcb52IxXjhR/4Nngvh0vZWrOOv IzmJaf75Bi1ZRA==; Received: from [87.69.77.57] (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 1p6ZTf-0001xC-OU; Sat, 17 Dec 2022 10:51:56 -0500 Date: Sat, 17 Dec 2022 17:52:00 +0200 Message-Id: <83r0wygh9b.fsf@gnu.org> From: Eli Zaretskii To: Florian Weimer Cc: larsi@gnus.org, eric@ericabrahamsen.net, emacs-devel@gnu.org, ding@gnus.org In-Reply-To: <87bko26ptd.fsf@oldenburg.str.redhat.com> (message from Florian Weimer on Sat, 17 Dec 2022 15:57:18 +0100) Subject: Re: master ef14acf: Make nnml handle invalid non-ASCII headers more consistently References: <20210122180801.14756.84264@vcs0.savannah.gnu.org> <20210122180802.F0A1E20A10@vcs0.savannah.gnu.org> <874jtvq8c2.fsf@oldenburg.str.redhat.com> <83k02qiicb.fsf@gnu.org> <87bko26ptd.fsf@oldenburg.str.redhat.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-ID: Precedence: bulk > From: Florian Weimer > Cc: Lars Ingebrigtsen , Eric Abrahamsen > , emacs-devel@gnu.org, ding@gnus.org > Date: Sat, 17 Dec 2022 15:57:18 +0100 > > >> Mail source (maildir :path …) failed: (error Invalid data for rfc2047 encoding: 罗勇刚(Yonggang Luo) via Elfutils-devel ) > >> > >> On an older Emacs without this change, it seems that the original header > >> is written to the .overview file, which sidestep the problem that not > >> all strings are encodable by the rfc2047 functions. > > > > Thanks. I guess this From header is invalid because there's no space > > between the "罗勇刚" and the "(Yonggang Luo)" parts? > > Yes, that seems to be what's tripping the encoder. But I'm not sure if > proper encoding of ( or ) (as =28 or =29 using the Q encoding, or using > the B encoding as in the raw text) is actually invalid. RFC 2047 only > talks about unencoded ( or ). In contrast, encoded ( and ) are valid > syntax at the RFC 822 layer because encoding hides them. I'm not sure this is related. I was talking about the missing SPC character before the parentheses. But I know very little about this stuff, so maybe I'm just misunderstanding you. > > Does the naïve patch below solve the problem? > > > > diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el > > index 40e4b9e..7aa445e 100644 > > --- a/lisp/gnus/nnml.el > > +++ b/lisp/gnus/nnml.el > > @@ -776,17 +776,22 @@ nnml-parse-head > > (nnml--encode-headers headers) > > headers)))) > > > > +;; RFC2047-encode Subject and From, but leave invalid headers unencoded. > > (defun nnml--encode-headers (headers) > > (let ((subject (mail-header-subject headers)) > > (rfc2047-encoding-type 'mime)) > > (unless (string-match "\\`[[:ascii:]]*\\'" subject) > > - (setf (mail-header-subject headers) > > - (mail-encode-encoded-word-string subject t)))) > > + (let ((encoded-subject > > + (ignore-errors (mail-encode-encoded-word-string subject t)))) > > + (if encoded-subject > > + (setf (mail-header-subject headers) encoded-subject))))) > > (let ((from (mail-header-from headers)) > > (rfc2047-encoding-type 'address-mime)) > > (unless (string-match "\\`[[:ascii:]]*\\'" from) > > - (setf (mail-header-from headers) > > - (rfc2047-encode-string from t))))) > > + (let ((encoded-from > > + (ignore-errors (rfc2047-encode-string from t)))) > > + (if encoded-from > > + (setf (mail-header-from headers) encoded-from)))))) > > > > (defun nnml-get-nov-buffer (group &optional incrementalp) > > (let ((buffer (gnus-get-buffer-create > > Thanks! > > I somehow can't reproduce the original issue. I expect more problematic > messages to arrive next week, though, and will report then how it goes. Thanks. Please do get back, even if you don't succeed in reproducing. I tested the code by invoking the body of nnml--encode-headers directly on the header you provided, so I'm quite sure the fix will prevent the error and will restore Gnus to how it worked before this change, when such problematic headers are used. So I'd like to install this fix on the release branch for the upcoming Emacs 29.1, and need your feedback. TIA