From: Glenn Morris Date: Thu, 26 May 2011 00:52:33 +0000 (-0400) Subject: Try to check From address in bug reports (bug#8038) X-Git-Tag: emacs-pretest-24.0.90~104^2~618^2~160 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7d15102b760a748fb9f4479b5f14cb7f8e0cd976;p=emacs.git Try to check From address in bug reports (bug#8038) * lisp/mail/emacsbug.el (report-emacs-bug): Mention checking From address. (report-emacs-bug-hook): Try to validate the From address. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9987237c6ef..5b21d311bac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-26 Glenn Morris + + * mail/emacsbug.el (report-emacs-bug): Mention checking From address. + (report-emacs-bug-hook): Try to validate the From address. (Bug#8038) + 2011-05-25 Julien Danjou * textmodes/rst.el (rst-define-level-faces): Do not define face diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index a5aad7dd1b0..2cd93cbce68 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -126,7 +126,7 @@ Used for querying duplicates and linking to existing bugs.") (if (and to subject body) (if (report-emacs-bug-can-use-osx-open) (start-process "/usr/bin/open" nil "open" - (concat "mailto:" to + (concat "mailto:" to "?subject=" (url-hexify-string subject) "&body=" (url-hexify-string body))) (start-process "xdg-email" nil "xdg-email" @@ -188,6 +188,7 @@ Prompts for bug subject. Leaves you in a mail buffer." (overlay-put (make-overlay pos (point)) 'face 'highlight)) (insert " if possible, because the Emacs maintainers usually do not have translators to read other languages for them.\n\n") + (insert "Please check that the From: line gives an address where you can be reached.\n") (insert (format "Your report will be posted to the %s mailing list" report-emacs-bug-address)) (insert "\nand the gnu.emacs.bug news group, and at http://debbugs.gnu.org.\n\n")) @@ -330,6 +331,9 @@ usually do not have translators to read other languages for them.\n\n") (interactive) (info "(emacs)Bugs")) +;; It's the default mail mode, so it seems OK to use its features. +(autoload 'message-bogus-recipient-p "message") + (defun report-emacs-bug-hook () "Do some checking before sending a bug report." (save-excursion @@ -340,11 +344,25 @@ usually do not have translators to read other languages for them.\n\n") (string-equal (buffer-substring-no-properties (point-min) (point)) report-emacs-bug-orig-text) (error "No text entered in bug report")) - + (or report-emacs-bug-no-confirmation + ;; Not narrowing to the headers, but that's OK. + (let ((from (mail-fetch-field "From"))) + (and (or (not from) + (message-bogus-recipient-p from) + ;; This is the default user-mail-address. On today's + ;; systems, it seems more likely to be wrong than right, + ;; since most people don't run their own mail server. + (string-match (format "\\<%s@%s\\>" (user-login-name) + (system-name)) + from)) + (yes-or-no-p + (format "From address (`%s') looks suspicious. Edit it? " + from)) + (error "Please edit the From address and try again")))) ;; The last warning for novice users. (unless (or report-emacs-bug-no-confirmation - (yes-or-no-p - "Send this bug report to the Emacs maintainers? ")) + (yes-or-no-p + "Send this bug report to the Emacs maintainers? ")) (goto-char (point-min)) (if (search-forward "To: ") (delete-region (point) (line-end-position)))