unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19054: 25.0.50; Wrong envelope-from in report-emacs-bug
@ 2014-11-14  9:55 Peder O. Klingenberg
  2014-11-15 15:23 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Peder O. Klingenberg @ 2014-11-14  9:55 UTC (permalink / raw)
  To: 19054

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

(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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacsbug.patch --]
[-- Type: text/x-diff, Size: 2288 bytes --]

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  <peder@klingenberg.no>
+
+	* mail/emacsbug.el (report-emacs-bug): Make a better guess at
+	  envelope-from when reporting through sendmail.
+
 2014-10-24  Martin Rudalics  <rudalics@gmx.at>
 
 	* 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

[-- Attachment #3: Type: text/plain, Size: 1535 bytes --]


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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#19054: 25.0.50; Wrong envelope-from in report-emacs-bug
  2014-11-14  9:55 bug#19054: 25.0.50; Wrong envelope-from in report-emacs-bug Peder O. Klingenberg
@ 2014-11-15 15:23 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-15 15:23 UTC (permalink / raw)
  To: Peder O. Klingenberg; +Cc: 19054

pok@netfonds.no (Peder O. Klingenberg) writes:

> (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)

Thanks; applied to emacs-24 (and to the trunk after a while).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-15 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14  9:55 bug#19054: 25.0.50; Wrong envelope-from in report-emacs-bug Peder O. Klingenberg
2014-11-15 15:23 ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).