emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104368: Try to check From address in


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104368: Try to check From address in bug reports (bug#8038)
Date: Wed, 25 May 2011 20:52:33 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104368
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-05-25 20:52:33 -0400
message:
  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.
modified:
  lisp/ChangeLog
  lisp/mail/emacsbug.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-05-25 09:03:59 +0000
+++ b/lisp/ChangeLog    2011-05-26 00:52:33 +0000
@@ -1,3 +1,8 @@
+2011-05-26  Glenn Morris  <address@hidden>
+
+       * 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  <address@hidden>
 
        * textmodes/rst.el (rst-define-level-faces): Do not define face

=== modified file 'lisp/mail/emacsbug.el'
--- a/lisp/mail/emacsbug.el     2011-05-23 17:57:17 +0000
+++ b/lisp/mail/emacsbug.el     2011-05-26 00:52:33 +0000
@@ -126,7 +126,7 @@
       (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 @@
         (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 @@
   (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 @@
          (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 "\\<address@hidden>" (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)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]