Subject: bug#8689: 23.3; Gnus v5.13 freezes upon invocation of default STARTTLS in SMTP in GNU Emacs 23.3.1 (i386-mingw-nt5.1.2600) on Windows XP Professional, Service Pack 3

From: "Benjamin L. Russell" <[email-masked]>
Date: Thu, 30 Jun 2011 13:09:50 -0700 (PDT)

On Fri, 7/1/11, Lars Magne Ingebrigtsen <[email-masked]> wrote:

> On Fri, 7/1/11, Lars Magne Ingebrigtsen <[email-masked]> wrote:

> > Could you run
> >
> > diff --unified <old-version> <new-version>
> >
> > instead?  That will produce a more readable output.

> ----- output begins immediately after this line -----
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.

> C:\Documents and Settings\kensyuu>diff --unified C:\emacs\emacs-23.3\lisp\gnus\s
> tarttls.el "C:\Documents and Settings\kensyuu\My Documents\GNU Emacs\Deprecated
> Versions\From emacs Top-level Folder\emacs-23.2\lisp\gnus\starttls.el"
> cygwin warning:
>   MS-DOS style path detected: C:\emacs\emacs-23.3\lisp\gnus\starttls.el
>   Preferred POSIX equivalent is: /cygdrive/c/emacs/emacs-23.3/lisp/gnus/starttls
> .el
>   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
>   Consult the user's guide for more details about POSIX paths:
>     http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
> --- C:\emacs\emacs-23.3\lisp\gnus\starttls.el   2011-05-17 19:53:57.296875000 +0
> 900
> +++ C:\Documents and Settings\kensyuu\My Documents\GNU Emacs\Deprecated Versions
> \From emacs Top-level Folder\emacs-23.2\lisp\gnus\starttls.el   2011-05-14 12:00
> :08.875000000 +0900
> @@ -1,7 +1,7 @@
> ;;; starttls.el --- STARTTLS functions

> ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
> -;;   2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
> +;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.

> ;; Author: Daiki Ueno <[email-masked]>
> ;; Author: Simon Josefsson <[email-masked]>
> @@ -10,18 +10,20 @@

> ;; This file is part of GNU Emacs.

> -;; GNU Emacs is free software: you can redistribute it and/or modify
> +;; GNU Emacs is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published by
> -;; the Free Software Foundation, either version 3 of the License, or
> -;; (at your option) any later version.
> +;; the Free Software Foundation; either version 3, or (at your option)
> +;; any later version.

> ;; GNU Emacs is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
> ;; GNU General Public License for more details.

> ;; You should have received a copy of the GNU General Public License
> -;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
> +;; along with GNU Emacs; see the file COPYING.  If not, write to the
> +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> +;; Boston, MA 02110-1301, USA.

> ;;; Commentary:

> @@ -196,7 +198,6 @@
>    :type 'regexp
>    :group 'starttls)

> -;; Added based on a suggestion by Uday Reddy posted on 2010-04-26 at "Question
> #108267 : Questions : VM" (see https://answers.launchpad.net/vm/+question/108267
> ) by Benjamin L. Russell on Tuesday, May 17, 2011, at 19:53.
> (defcustom starttls-kill-program "c:\\cygwin\\bin\\kill"
>    "External kill command to send SIGALRM to starttls."
>    :group 'starttls)
> @@ -209,15 +210,13 @@
>    (let (buffer info old-max done-ok done-bad)
>      (if (null (setq buffer (process-buffer process)))
>         ;; XXX How to remove/extract the TLS negotiation junk?
> -       ;; Modified based on a suggestion by Uday Reddy posted on 2010-04-26 at
> "Question #108267 : Questions : VM" (see https://answers.launchpad.net/vm/+quest
> ion/108267) by Benjamin L. Russell on Tuesday, May 17, 2011, at 19:53.
> -;      (signal-process (process-id process) 'SIGALRM)
> +       ; (signal-process (process-id process) 'SIGALRM)
>         (call-process starttls-kill-program nil nil nil
>                       "-ALRM" (format "%d" (process-id process)))
>        (with-current-buffer buffer
>         (save-excursion
>           (setq old-max (goto-char (point-max)))
> -         ;; Modified based on a suggestion by Uday Reddy posted on 2010-04-26 a
> t "Question #108267 : Questions : VM" (see https://answers.launchpad.net/vm/+que
> stion/108267) by Benjamin L. Russell on Tuesday, May 17, 2011, at 19:53.
> -;        (signal-process (process-id process) 'SIGALRM)
> +         ; (signal-process (process-id process) 'SIGALRM)
>           (call-process starttls-kill-program nil nil nil
>                         "-ALRM" (format "%d" (process-id process)))
>           (while (and (processp process)
> @@ -242,11 +241,9 @@
> (defun starttls-negotiate (process)
>    (if starttls-use-gnutls
>        (starttls-negotiate-gnutls process)
> -    ;; Modified based on a suggestion by Uday Reddy posted on 2010-04-26 at "Qu
> estion #108267 : Questions : VM" (see https://answers.launchpad.net/vm/+question
> /108267) by Benjamin L. Russell on Tuesday, May 17, 2011, at 19:53.
> -;    (signal-process (process-id process) 'SIGALRM)
> -    (call-process starttls-kill-program nil nil nil
> -                 "-ALRM" (format "%d" (process-id process)))
> -  ))
> +    ; (signal-process (process-id process) 'SIGALRM)))
> +       (call-process starttls-kill-program nil nil nil
> +                     "-ALRM" (format "%d" (process-id process)))))

> (eval-and-compile
>    (if (fboundp 'set-process-query-on-exit-flag)
> @@ -256,7 +253,7 @@
>        'process-kill-without-query)))

> (defun starttls-open-stream-gnutls (name buffer host port)
> -  (message "Opening STARTTLS connection to `%s:%s'..." host port)
> +  (message "Opening STARTTLS connection to `%s'..." host)
>    (let* (done
>          (old-max (with-current-buffer buffer (point-max)))
>          (process-connection-type starttls-process-connection-type)
> @@ -281,8 +278,8 @@
>           (delete-region old-max done))
>        (delete-process process)
>        (setq process nil))
> -    (message "Opening STARTTLS connection to `%s:%s'...%s"
> -            host port (if done "done" "failed"))
> +    (message "Opening STARTTLS connection to `%s'...%s"
> +            host (if done "done" "failed"))
>      process))

> (defun starttls-open-stream (name buffer host port)
> @@ -302,7 +299,6 @@
> GNUTLS requires a port number."
>    (if starttls-use-gnutls
>        (starttls-open-stream-gnutls name buffer host port)
> -    (message "Opening STARTTLS connection to `%s:%s'" host (format "%s" port))
>      (let* ((process-connection-type starttls-process-connection-type)
>            (process (apply #'start-process
>                            name buffer starttls-program
> @@ -311,20 +307,7 @@
>        (starttls-set-process-query-on-exit-flag process nil)
>        process)))

> -(defun starttls-any-program-available ()
> -  (let ((program (if starttls-use-gnutls
> -                    starttls-gnutls-program
> -                  starttls-program)))
> -    (condition-case ()
> -       (progn
> -         (call-process program)
> -         program)
> -      (error (progn
> -              (message "No STARTTLS program was available (tried '%s')"
> -                       program)
> -              nil)))))
> -
> (provide 'starttls)

> -;; arch-tag: 648b3bd8-63bd-47f5-904c-7c819aea2297
> -;;; starttls.el ends here
> +;;; arch-tag: 648b3bd8-63bd-47f5-904c-7c819aea2297
> +;;; starttls.el ends here
> \ No newline at end of file
> ----- output ends immediately before this line -----

> >> diff --unified <old-version>
> <new-version>
> >> 
> >> instead?  That will produce a more readable
> output.
> 
> Hm.  The only changes I see are in indentation and
> (message) calls.  Are
> you sure the one works and the other one doesn't work?

As far as I remember, neither my deprecated version nor the updated version worked perfectly, but the deprecated version hung more often when invoking the STARTTLS protocol.

-- Benjamin L. Russell