From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: emacs-devel@gnu.org
Subject: smtpmail on Windows native Emacs with gnutls-cli from Cygwin freeze.
Date: Mon, 24 Oct 2011 00:53:12 +0300 [thread overview]
Message-ID: <j822cb$oif$1@dough.gmane.org> (raw)
I like use native Emacs with Cygwin toolset. It does not
hard to friend then. But from time to time I discover some issues.
Now time I finally try setup Emacs to work with mail.
GMail SMTP require TLS connection. As usual this done by
'gnus/starttls.el'.
After configuring smtpmail (send-mail-function==smtpmail-send-it)
I try compose mail:
C-x m bla-bla-bla C-c C-c
Emacs freeze! Try same in Cygwin Emacs and all OK!
After debug I found root of evil:
(defun starttls-open-stream-gnutls (name buffer host port)
...
(process (apply #'start-process name buffer
starttls-gnutls-program "-s" host
"-p" (if (integerp port)
(int-to-string port)
port)
starttls-extra-arguments))
...)))))
(defun starttls-negotiate-gnutls (process)
...
;; XXX How to remove/extract the TLS negotiation junk?
(signal-process (process-id process) 'SIGALRM)
...
(save-excursion
(setq old-max (goto-char (point-max)))
(signal-process (process-id process) 'SIGALRM)
(while (and (processp process)
(eq (process-status process) 'run)
(save-excursion
(goto-char old-max)
(not (or (setq done-ok (re-search-forward
starttls-success nil t))
(setq done-bad (re-search-forward
starttls-failure nil t))))))
(accept-process-output process 1 100)
(sit-for 0.1))
...
So 'gnutls-cli' called with '-s' option. From man page:
-s, --starttls
Connect, establish a plain session and start TLS
when EOF or a SIGALRM is received.
and 'signal-process' call do nothing for SIGALRM. More correctly
return error. Look to 'src/w32proc.c':
int
sys_kill (int pid, int sig)
{
...
/* Only handle signals that will result in the process dying */
if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)
{
errno = EINVAL;
return -1;
}
So 'gnutls-cli' don't send anything and 'while' loop can not match
'starttls-failure', 'starttls-success', etc...
I easy make workaround. Just replace 'signal-process' with Cygwin
'kill.exe':
(shell-command (format "kill.exe -s SIGALRM %d" (process-id process)))
Conclusion from this story: check return codes... and don't use
unsupported configuration!
But I think Emacs 'gnus/starttls.el' code can be rewritten to be able
work with Cygwin gnutls-cli without signals...
As emacs-jabber package work fine with Cygwin! I successfully use
it for 2 years with Google GTalk over TLS...
next reply other threads:[~2011-10-23 21:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-23 21:53 Oleksandr Gavenko [this message]
2011-10-23 22:40 ` smtpmail on Windows native Emacs with gnutls-cli from Cygwin freeze Oleksandr Gavenko
2013-06-09 0:15 ` l1dge
2011-10-23 23:56 ` Lars Magne Ingebrigtsen
2011-10-24 6:57 ` Eli Zaretskii
2011-10-24 7:15 ` Eli Zaretskii
2011-10-24 20:21 ` Oleksandr Gavenko
2011-10-24 21:45 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='j822cb$oif$1@dough.gmane.org' \
--to=gavenkoa@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).