diff options
| author | Glenn Morris | 2011-05-25 20:52:33 -0400 |
|---|---|---|
| committer | Glenn Morris | 2011-05-25 20:52:33 -0400 |
| commit | 7d15102b760a748fb9f4479b5f14cb7f8e0cd976 (patch) | |
| tree | b6445e1c1c2e9b2af9d52779fa0ec1d1fcf7d610 | |
| parent | 99451919768cf387e0734ded210230878e627d43 (diff) | |
| download | emacs-7d15102b760a748fb9f4479b5f14cb7f8e0cd976.tar.gz emacs-7d15102b760a748fb9f4479b5f14cb7f8e0cd976.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mail/emacsbug.el | 26 |
2 files changed, 27 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9987237c6ef..5b21d311bac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-05-26 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * mail/emacsbug.el (report-emacs-bug): Mention checking From address. | ||
| 4 | (report-emacs-bug-hook): Try to validate the From address. (Bug#8038) | ||
| 5 | |||
| 1 | 2011-05-25 Julien Danjou <julien@danjou.info> | 6 | 2011-05-25 Julien Danjou <julien@danjou.info> |
| 2 | 7 | ||
| 3 | * textmodes/rst.el (rst-define-level-faces): Do not define face | 8 | * 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.") | |||
| 126 | (if (and to subject body) | 126 | (if (and to subject body) |
| 127 | (if (report-emacs-bug-can-use-osx-open) | 127 | (if (report-emacs-bug-can-use-osx-open) |
| 128 | (start-process "/usr/bin/open" nil "open" | 128 | (start-process "/usr/bin/open" nil "open" |
| 129 | (concat "mailto:" to | 129 | (concat "mailto:" to |
| 130 | "?subject=" (url-hexify-string subject) | 130 | "?subject=" (url-hexify-string subject) |
| 131 | "&body=" (url-hexify-string body))) | 131 | "&body=" (url-hexify-string body))) |
| 132 | (start-process "xdg-email" nil "xdg-email" | 132 | (start-process "xdg-email" nil "xdg-email" |
| @@ -188,6 +188,7 @@ Prompts for bug subject. Leaves you in a mail buffer." | |||
| 188 | (overlay-put (make-overlay pos (point)) 'face 'highlight)) | 188 | (overlay-put (make-overlay pos (point)) 'face 'highlight)) |
| 189 | (insert " if possible, because the Emacs maintainers | 189 | (insert " if possible, because the Emacs maintainers |
| 190 | usually do not have translators to read other languages for them.\n\n") | 190 | usually do not have translators to read other languages for them.\n\n") |
| 191 | (insert "Please check that the From: line gives an address where you can be reached.\n") | ||
| 191 | (insert (format "Your report will be posted to the %s mailing list" | 192 | (insert (format "Your report will be posted to the %s mailing list" |
| 192 | report-emacs-bug-address)) | 193 | report-emacs-bug-address)) |
| 193 | (insert "\nand the gnu.emacs.bug news group, and at http://debbugs.gnu.org.\n\n")) | 194 | (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") | |||
| 330 | (interactive) | 331 | (interactive) |
| 331 | (info "(emacs)Bugs")) | 332 | (info "(emacs)Bugs")) |
| 332 | 333 | ||
| 334 | ;; It's the default mail mode, so it seems OK to use its features. | ||
| 335 | (autoload 'message-bogus-recipient-p "message") | ||
| 336 | |||
| 333 | (defun report-emacs-bug-hook () | 337 | (defun report-emacs-bug-hook () |
| 334 | "Do some checking before sending a bug report." | 338 | "Do some checking before sending a bug report." |
| 335 | (save-excursion | 339 | (save-excursion |
| @@ -340,11 +344,25 @@ usually do not have translators to read other languages for them.\n\n") | |||
| 340 | (string-equal (buffer-substring-no-properties (point-min) (point)) | 344 | (string-equal (buffer-substring-no-properties (point-min) (point)) |
| 341 | report-emacs-bug-orig-text) | 345 | report-emacs-bug-orig-text) |
| 342 | (error "No text entered in bug report")) | 346 | (error "No text entered in bug report")) |
| 343 | 347 | (or report-emacs-bug-no-confirmation | |
| 348 | ;; Not narrowing to the headers, but that's OK. | ||
| 349 | (let ((from (mail-fetch-field "From"))) | ||
| 350 | (and (or (not from) | ||
| 351 | (message-bogus-recipient-p from) | ||
| 352 | ;; This is the default user-mail-address. On today's | ||
| 353 | ;; systems, it seems more likely to be wrong than right, | ||
| 354 | ;; since most people don't run their own mail server. | ||
| 355 | (string-match (format "\\<%s@%s\\>" (user-login-name) | ||
| 356 | (system-name)) | ||
| 357 | from)) | ||
| 358 | (yes-or-no-p | ||
| 359 | (format "From address (`%s') looks suspicious. Edit it? " | ||
| 360 | from)) | ||
| 361 | (error "Please edit the From address and try again")))) | ||
| 344 | ;; The last warning for novice users. | 362 | ;; The last warning for novice users. |
| 345 | (unless (or report-emacs-bug-no-confirmation | 363 | (unless (or report-emacs-bug-no-confirmation |
| 346 | (yes-or-no-p | 364 | (yes-or-no-p |
| 347 | "Send this bug report to the Emacs maintainers? ")) | 365 | "Send this bug report to the Emacs maintainers? ")) |
| 348 | (goto-char (point-min)) | 366 | (goto-char (point-min)) |
| 349 | (if (search-forward "To: ") | 367 | (if (search-forward "To: ") |
| 350 | (delete-region (point) (line-end-position))) | 368 | (delete-region (point) (line-end-position))) |