From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pok@netfonds.no (Peder O. Klingenberg) Newsgroups: gmane.emacs.bugs Subject: bug#19054: 25.0.50; Wrong envelope-from in report-emacs-bug Date: Fri, 14 Nov 2014 10:55:59 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1415983585 31511 80.91.229.3 (14 Nov 2014 16:46:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2014 16:46:25 +0000 (UTC) To: 19054@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 14 17:46:18 2014 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 1XpK0n-0008Ek-5n for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 17:46:17 +0100 Original-Received: from localhost ([::1]:37121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpK0m-00083U-N0 for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 11:46:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpK0d-00083D-FG for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 11:46:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpK0Y-000683-DV for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 11:46:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpK0Y-00067z-9q for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 11:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpK0X-0004va-OS for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 11:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: pok@netfonds.no (Peder O. Klingenberg) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Nov 2014 16:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19054 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141598355218924 (code B ref -1); Fri, 14 Nov 2014 16:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Nov 2014 16:45:52 +0000 Original-Received: from localhost ([127.0.0.1]:32769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpK0N-0004v9-OS for submit@debbugs.gnu.org; Fri, 14 Nov 2014 11:45:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38919) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpDcL-0004Po-9Y for submit@debbugs.gnu.org; Fri, 14 Nov 2014 04:56:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpDcF-0006zl-Qk for submit@debbugs.gnu.org; Fri, 14 Nov 2014 04:56:36 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpDcF-0006zh-Np for submit@debbugs.gnu.org; Fri, 14 Nov 2014 04:56:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpDcA-0006No-Tc for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 04:56:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpDc3-0006sM-Ck for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 04:56:26 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:53811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpDc3-0006o6-33 for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 04:56:19 -0500 Original-Received: from luna.netfonds.no ([80.91.225.79] helo=luna) by hermes.netfonds.no with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1XpDbj-0007Rf-Rq for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 10:55:59 +0100 Original-Received: from pok by luna with local (Exim 4.71) (envelope-from ) id 1XpDbj-0006rK-PP for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 10:55:59 +0100 X-MailScanner-ID: 1XpDbj-0007Rf-Rq MailScanner-NULL-Check: 1416563760.05593@06Q3LGICS8+xwXdmrwYaqA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 14 Nov 2014 11:45:50 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:96020 --=-=-= Content-Type: text/plain (Creating a bug report from a mail thread on emacs-devel to keep it alive. I probably should have done this as a bug report originally. Original thread on http://permalink.gmane.org/gmane.emacs.devel/175920) I wrote: > Earlier today I was bitten by something that has irritated be before as > well. When reporting bugs from an "emacs -Q", emacs doesn't know my > email address. No problem, I can edit the From: header. > > However, I like to use my local sendmail as transport, because I have > already told that how and where to forward my mail, and it seems like a > perfectly good option. But message.el then decides to make up its own > envelope-from, regardless of From: header. That makes the mail bounce. > > Attached is a patch to emacsbug.el that checks if what message.el would > do results in a bogus address, and if so, defaults to the From: header > instead. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=emacsbug.patch diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 821d4fd..75317c6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-10-28 Peder O. Klingenberg + + * mail/emacsbug.el (report-emacs-bug): Make a better guess at + envelope-from when reporting through sendmail. + 2014-10-24 Martin Rudalics * mouse.el (mouse-drag-line): Don't use mouse-pixel-position. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 9145150..4ed212e 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -137,6 +137,12 @@ This requires either the OS X \"open\" command, or the freedesktop (concat "mailto:" to))) (error "Subject, To or body not found"))))) +;; It's the default mail mode, so it seems OK to use its features. +(autoload 'message-bogus-recipient-p "message") +(autoload 'message-make-address "message") +(defvar message-send-mail-function) +(defvar message-sendmail-envelope-from) + ;;;###autoload (defun report-emacs-bug (topic &optional recent-keys) "Report a bug in GNU Emacs. @@ -165,7 +171,12 @@ Prompts for bug subject. Leaves you in a mail buffer." ;; that report-emacs-bug-orig-text remains valid. (Bug#5178) (message-sort-headers) ;; Stop message-mode stealing the properties we will add. - (set (make-local-variable 'message-strip-special-text-properties) nil)) + (set (make-local-variable 'message-strip-special-text-properties) nil) + ;; Make sure we default to the From: address as envelope when sending + ;; through sendmail. + (when (and (not message-sendmail-envelope-from) + (message-bogus-recipient-p (message-make-address))) + (set (make-local-variable 'message-sendmail-envelope-from) 'header))) (rfc822-goto-eoh) (forward-line 1) ;; Move the mail signature to the proper place. @@ -364,10 +375,6 @@ usually do not have translators for other languages.\n\n"))) (define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.3") -;; It's the default mail mode, so it seems OK to use its features. -(autoload 'message-bogus-recipient-p "message") -(defvar message-send-mail-function) - (defun report-emacs-bug-hook () "Do some checking before sending a bug report." (save-excursion --=-=-= Content-Type: text/plain Eli Zaretskii replied with a concern: >> +;; It's the default mail mode, so it seems OK to use its features. >> +(autoload 'message-bogus-recipient-p "message") >> +(autoload 'message-make-address "message") >> +(defvar message-send-mail-function) >> +(defvar message-sendmail-envelope-from) > > What if the user overrides that default, and uses a different mail > mode? To which I replied: > Then I guess that user will have some unused functions loaded, as well > as some variables defined that she has no use for? I was basically just > cargo-culting the existing code. > > Existing code in emacsbug.el has > > ;; It's the default mail mode, so it seems OK to use its features. > (autoload 'message-bogus-recipient-p "message") > (defvar message-send-mail-function) > > I just added one more function and one more variable, and moved the > whole bunch, including comment, earlier in the file, because I used > those functions earlier in the file and thought it logical to place the > definitions before the uses. > > Autoload of one function causes the entire file to be loaded, does it > not? So my additions are more for documentation purposes than any > actual functional change. Does anyone have any further thoughts? I consider existing behaviour a bug, and I believe my patch fixes it in a relatively unobtrusive manner. message.el is already autoloaded today, and my patch does not change behaviour if the user has already told message.el how to determine envelope-from, or if the guessed address would be sane. --=-=-=--