From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#13321: 24.3.0.50; Gmail error when replying from Gnus to github Date: Sun, 24 Feb 2013 07:49:56 +0100 Organization: Emacs Helm Message-ID: <87sj4m8auj.fsf@gmail.com> References: <87a9surugk.fsf@gmail.com> <87zk0rffsg.fsf@gmail.com> <87mwwqg78u.fsf@gmail.com> <87ip7eg43v.fsf@gmail.com> <87y5g4gp2c.fsf@gmail.com> <87txp5ocvp.fsf@gmail.com> <877gm1r4lv.fsf@gmail.com> <87fw0pihfz.fsf@gmail.com> <877gm0iyzj.fsf@gmail.com> <87621kek7h.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361688713 6099 80.91.229.3 (24 Feb 2013 06:51:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Feb 2013 06:51:53 +0000 (UTC) To: 13321@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 24 07:52:16 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U9VRP-0005hC-P8 for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Feb 2013 07:52:08 +0100 Original-Received: from localhost ([::1]:40840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VR5-0004hE-5g for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Feb 2013 01:51:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VQw-0004go-Ph for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:51:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9VQp-0005gd-ID for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:51:38 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VQp-0005gW-DN for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:51:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U9VSI-0001Ul-Lv; Sun, 24 Feb 2013 01:53:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87a9surugk.fsf@gmail.com> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Sun, 24 Feb 2013 06:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13321 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13616887325687 (code B ref -1); Sun, 24 Feb 2013 06:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2013 06:52:12 +0000 Original-Received: from localhost ([127.0.0.1]:46442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9VRP-0001Tc-Ok for submit@debbugs.gnu.org; Sun, 24 Feb 2013 01:52:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53772) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9VRK-0001TR-VG for submit@debbugs.gnu.org; Sun, 24 Feb 2013 01:52:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9VPk-0005Sy-IK for submit@debbugs.gnu.org; Sun, 24 Feb 2013 01:50:31 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:50284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VPk-0005Sr-E4 for submit@debbugs.gnu.org; Sun, 24 Feb 2013 01:50:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VPd-0004ZJ-Kk for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:50:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9VPa-0005Nv-A7 for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:50:17 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:51452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9VPZ-0005NM-L0 for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 01:50:14 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U9VPq-0005MO-Tk for bug-gnu-emacs@gnu.org; Sun, 24 Feb 2013 07:50:30 +0100 Original-Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Feb 2013 07:50:30 +0100 Original-Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Feb 2013 07:50:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 178 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:2lO7lXCBZf83qSzPlpAqQ335ZGk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:71739 Archived-At: Katsumi Yamaoka writes: > thierry.volpiatto@gmail.com wrote: >> Katsumi Yamaoka writes: >>> Please let me say that a wide reply doesn't contain the author >>> of an original mail in the recipient list is a bug. To exclude >>> an invalid address from a wide reply is not a feature; > >> It is not excluded in the patch, it is added to "cc" only if "wide" is >> specified. > [...] >> Please have a look at the mail examples I sent in other posts. > > Hm, I haven't gotten it yet. Could you try replying to a mail > attached in this message as well (copy it to a mail group and do > F)? > > [...] >> The point is that with the patch I sent + the headers of the rejected >> mail and the original mail where I reply to, you will be able to >> understand what happen and fix it. > > Ok, I'll surely try it. To summarize the problem here some more example, with also the patch modified to fix previous errors when removing duplicates. Note that the changes applied further in the patch are not related with this bug, they just try to improve the code. Note also that one loop is removing extra spaces (I have noticed that in some mails, addresses are separated with two spaces in "CC"). ,----[ Replying on github ] | A "reply-to" header exists: | | From: Le Wang | Reply-To: emacs-helm/helm | To: emacs-helm/helm | | I send a reply with my patch applied: | | From: Thierry Volpiatto | To: emacs-helm/helm | Cc: emacs-helm/helm | | I send a reply with actual code (bug) | | From: Thierry Volpiatto | To: Le Wang | Cc: emacs-helm/helm , emacs-helm/helm `---- ,----[ Replying on emacs.dev ] | No "reply-to" header: | | From: Katsumi Yamaoka | To: thierry.volpiatto@gmail.com | Cc: 13321@debbugs.gnu.org | | I send a reply with my patch applied: | | From: Thierry Volpiatto | To: Katsumi Yamaoka | Cc: 13321@debbugs.gnu.org | | With original code it is the same (no bug in this case) | | From: Thierry Volpiatto | To: Katsumi Yamaoka | Cc: 13321@debbugs.gnu.org `---- And here the last version of patch: diff --git a/lisp/message.el b/lisp/message.el index 21847ac..44f1ee4 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -6753,8 +6753,7 @@ The function is called with one parameter, a cons cell ..." ;; message-header-synonyms. (setq to (or (message-fetch-field "to") (and (loop for synonym in message-header-synonyms - when (memq 'Original-To synonym) - return t) + thereis (memq 'Original-To synonym)) (message-fetch-field "original-to"))) cc (message-fetch-field "cc") extra (when message-extra-wide-headers @@ -6764,16 +6763,19 @@ The function is called with one parameter, a cons cell ..." ", ")) mct (message-fetch-field "mail-copies-to") author (or (message-fetch-field "mail-reply-to") - (message-fetch-field "reply-to")) + (message-fetch-field "reply-to") + (message-fetch-field "from") "") mft (and message-use-mail-followup-to (message-fetch-field "mail-followup-to"))) - ;; Make sure this message goes to the author if this is a wide - ;; reply, since Reply-To address may be a list address a mailing - ;; list server added. + ;; Make sure this message goes to the author if this is a wide reply. + ;; If a '*reply-to' header is found use it, otherwise use the 'from' + ;; header and add it to 'cc'. + ;; If "wide" is not specified, "author" will end later in "to" header. + ;; We should not force using "from" for "author" when not using "wide" + ;; because it will go in this case in "to" and in some cases the address + ;; from "from" is invalid like on github (bug#13321). (when (and wide author) - (setq cc (concat author ", " cc))) - (when (or wide (not author)) - (setq author (or (message-fetch-field "from") "")))) + (setq cc (concat author ", " cc)))) ;; Handle special values of Mail-Copies-To. (when mct @@ -6829,13 +6831,9 @@ want to get rid of this query permanently."))) (setq recipients (concat ", " mft))) (t (setq recipients (if never-mct "" (concat ", " author))) - (if to (setq recipients (concat recipients ", " to))) - (if cc (setq recipients (concat recipients ", " cc))) - (if extra (setq recipients (concat recipients ", " extra))) - (if mct (setq recipients (concat recipients ", " mct))))) - (if (>= (length recipients) 2) - ;; Strip the leading ", ". - (setq recipients (substring recipients 2))) + (loop for h in `(,to ,cc ,extra ,mct) + for recip = (and recipients (not (string= recipients ""))) + when h do (setq recipients (concat recipients (and recip ", ") h))))) ;; Squeeze whitespace. (while (string-match "[ \t][ \t]+" recipients) (setq recipients (replace-match " " t t recipients))) @@ -6854,31 +6852,21 @@ want to get rid of this query permanently."))) (cons (downcase (mail-strip-quoted-names addr)) addr)) (cons (downcase (mail-strip-quoted-names addr)) addr))) - (message-tokenize-header recipients))) - ;; Remove all duplicates. - (let ((s recipients)) - (while s - (let ((address (car (pop s)))) - (while (assoc address s) - (setq recipients (delq (assoc address s) recipients) - s (delq (assoc address s) s)))))) + ;; Remove all duplicates. + (loop with recip for m in (message-tokenize-header recipients) + for mess = (replace-regexp-in-string "^ " "" m) + unless (member mess recip) collect mess into recip + finally return recip))) ;; Remove hierarchical lists that are contained within each other, ;; if message-hierarchical-addresses is defined. (when message-hierarchical-addresses - (let ((plain-addrs (mapcar 'car recipients)) - subaddrs recip) - (while plain-addrs - (setq subaddrs (assoc (car plain-addrs) - message-hierarchical-addresses) - plain-addrs (cdr plain-addrs)) - (when subaddrs - (setq subaddrs (cdr subaddrs)) - (while subaddrs - (setq recip (assoc (car subaddrs) recipients) - subaddrs (cdr subaddrs)) - (if recip - (setq recipients (delq recip recipients)))))))) + (setq recipients + (loop for (r . a) in recipients + for assoc = (cdr (assoc r message-hierarchical-addresses)) + when assoc append assoc into recip + unless (or (member r recip) (assoc r results)) + collect (cons r a) into results finally return results))) (setq recipients (message-prune-recipients recipients)) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997