Gnus development mailing list
 help / color / mirror / Atom feed
* The return of starttls doesn't work in smtpmail
@ 2007-08-17  2:21 Wolfram Fenske
  2007-08-17  8:30 ` Reiner Steib
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Fenske @ 2007-08-17  2:21 UTC (permalink / raw)
  To: ding

Hello!

After upgrading my Gnus I couldn't send mail via smtpmail+starttls
anymore.  The reason was that it uses the function `with-no-warnings',
which isn't defined in XEmacs.  After finding and fixing the problem
myself it turns out this is a known problem:
<http://calypso.tux.org/pipermail/xemacs-beta/2007-March/010883.html>

Back then, Simon Josefsson's response was:

--8<---------------cut here---------------start------------->8---
> Simon, I think that the best thing would be to just get rid of the
> with-no-warnings call (unless you know of bogus warnings that will
> definitely be issued), and we probably ought to change the
> condition-case to catch 'io-error, which will catch all exceptions due
> to expectable process failures.

There are several uses of with-no-warnings in modern elisp, how about
if XEmacs implements it?  The implementation seems straight forward,
here is what my Emacs has:

(put 'with-no-warnings 'lisp-indent-function 0)
(defun with-no-warnings (&rest body)
  "Like `progn', but prevents compiler warnings in the body."
  ;; The implementation for the interpreter is basically trivial.
  (car (last body)))

Thanks for the CC.
--8<---------------cut here---------------end--------------->8---

According to
<http://quimby.gnus.org/cgi-bin/cvsweb.cgi/gnus/contrib/smtpmail.el>,
smptmail.el still isn't fixed.  Since I can't change XEmacs, as Simon
proposed, I suggest to add the following code to smtpmail.el or
gnus.el or whichever place is appropriate, to prevent even more people
from getting bitten by this:

--8<---------------cut here---------------start------------->8---
;;; XEmacs and older Emacs might not have `with-no-warnings'
(unless (fboundp 'with-no-warnings)
  ;; Taken from Emacs' byte-run.el
  (defun with-no-warnings (&rest body)
    "Like `progn', but prevents compiler warnings in the body."
    ;; The implementation for the interpreter is basically trivial.
    (car (last body))))
--8<---------------cut here---------------end--------------->8---

-- 
Wolfram Fenske

A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting frowned upon?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The return of starttls doesn't work in smtpmail
  2007-08-17  2:21 The return of starttls doesn't work in smtpmail Wolfram Fenske
@ 2007-08-17  8:30 ` Reiner Steib
  2007-08-19 21:17   ` Wolfram Fenske
  0 siblings, 1 reply; 3+ messages in thread
From: Reiner Steib @ 2007-08-17  8:30 UTC (permalink / raw)
  To: ding

On Fri, Aug 17 2007, Wolfram Fenske wrote:

> According to
> <http://quimby.gnus.org/cgi-bin/cvsweb.cgi/gnus/contrib/smtpmail.el>,
> smptmail.el still isn't fixed.  

,----[ contrib/README ]
| sendmail.el
| smtpmail.el
| 
| 	Copies of the corresponding files from the Emacs lisp/mail/
| 	directory, to provide features (occasionally) needed by Gnus which
| 	may not be provided by the versions of these files in older Emacs
| 	distributions.  XEmacs users should NOT use this, since it doesn't
| 	work.  See the XEmacs mail-lib module instead.
`----

In contrib/smtpmail.el we even have:

;; This version of `smtpmail.el' should only be used with Emacs 21.
(if (featurep 'xemacs)
    (error "Please use `smtpmail.el' from the mail-lib package.")
  (when (>= emacs-major-version 22)
    (error "Please use `smtpmail.el' bundled with Emacs.")))

So it should be fixed in XEmacs or the smtpmail.el file in XEmacs
mail-lib package.

> ;;; XEmacs and older Emacs might not have `with-no-warnings'
> (unless (fboundp 'with-no-warnings)
>   ;; Taken from Emacs' byte-run.el
>   (defun with-no-warnings (&rest body)
>     "Like `progn', but prevents compiler warnings in the body."
>     ;; The implementation for the interpreter is basically trivial.
>     (car (last body))))

This is a bad idea.

,----[ (info "(elisp)Coding Conventions") ]
|    * If a package needs to define an alias or a new function for
|      compatibility with some other version of Emacs, name it with the
|      package prefix, not with the raw name with which it occurs in the
|      other version.  Here is an example from Gnus, which provides many
|      examples of such compatibility issues.
| 
|           (defalias 'gnus-point-at-bol
|             (if (fboundp 'point-at-bol)
|                 'point-at-bol
|               'line-beginning-position))
`----

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The return of starttls doesn't work in smtpmail
  2007-08-17  8:30 ` Reiner Steib
@ 2007-08-19 21:17   ` Wolfram Fenske
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Fenske @ 2007-08-19 21:17 UTC (permalink / raw)
  To: ding; +Cc: simon

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Fri, Aug 17 2007, Wolfram Fenske wrote:
>
>> According to
>> <http://quimby.gnus.org/cgi-bin/cvsweb.cgi/gnus/contrib/smtpmail.el>,
>> smptmail.el still isn't fixed.  
>
> ,----[ contrib/README ]
> | sendmail.el
> | smtpmail.el
> | 
> | 	Copies of the corresponding files from the Emacs lisp/mail/
> | 	directory, to provide features (occasionally) needed by Gnus which
> | 	may not be provided by the versions of these files in older Emacs
> | 	distributions.  XEmacs users should NOT use this, since it doesn't
> | 	work.  See the XEmacs mail-lib module instead.
> `----
>
> In contrib/smtpmail.el we even have:
>
> ;; This version of `smtpmail.el' should only be used with Emacs 21.
> (if (featurep 'xemacs)
>     (error "Please use `smtpmail.el' from the mail-lib package.")
>   (when (>= emacs-major-version 22)
>     (error "Please use `smtpmail.el' bundled with Emacs.")))
>
> So it should be fixed in XEmacs or the smtpmail.el file in XEmacs
> mail-lib package.

Thanks for the pointer.  However, it's not fixed in the XEmacs
mail-lib module, either (see
<http://cvs.xemacs.org/viewcvs.cgi/XEmacs/packages/xemacs-packages/mail-lib/smtpmail.el>).
In fact, I *am* using the version from the XEmacs sumo-mule package
collection, version 2007-04-27.  I didn't realize there were two "sort
of current" versions of smptmail.el.  So I guess I should contact the
package maintainer, which would be Simon Joseffson.

>> ;;; XEmacs and older Emacs might not have `with-no-warnings'
>> (unless (fboundp 'with-no-warnings)
>>   ;; Taken from Emacs' byte-run.el
>>   (defun with-no-warnings (&rest body)
>>     "Like `progn', but prevents compiler warnings in the body."
>>     ;; The implementation for the interpreter is basically trivial.
>>     (car (last body))))
>
> This is a bad idea.
>
> ,----[ (info "(elisp)Coding Conventions") ]
> |    * If a package needs to define an alias or a new function for
> |      compatibility with some other version of Emacs, name it with the
> |      package prefix, not with the raw name with which it occurs in the
> |      other version.  Here is an example from Gnus, which provides many
> |      examples of such compatibility issues.
> | 
> |           (defalias 'gnus-point-at-bol
> |             (if (fboundp 'point-at-bol)
> |                 'point-at-bol
> |               'line-beginning-position))
> `----

Would this be better?

--8<---------------cut here---------------start------------->8---
;;; XEmacs and older Emacs might not have `with-no-warnings'
(if (fboundp 'with-no-warnings)
    (defalias 'gnus-with-no-warnings 'with-no-warnings)
  ;; Taken from Emacs' byte-run.el
  (defun gnus-with-no-warnings (&rest body)
    "Like `progn', but prevents compiler warnings in the body."
    ;; The implementation for the interpreter is basically trivial.
    (car (last body))))
--8<---------------cut here---------------end--------------->8---

In any case, I think the specific piece code that caused my headaches
is problematic because the "condtition-case" form simply swallows all
errors (from "smtpmail-open-stream"):

--8<---------------cut here---------------start------------->8---
    ...
    (if (null (and cred (condition-case ()
			    (with-no-warnings
			      (require 'starttls)
			      (call-process (if starttls-use-gnutls
						starttls-gnutls-program
					      starttls-program)))
			  (error nil))))
	;; The normal case.
	(open-network-stream "SMTP" process-buffer host port)
    ...
--8<---------------cut here---------------end--------------->8---

If there really isn't a more specific kind of error it could catch,
then the "condition-case" should at least contain as few forms as
possible.  Otherwise real bugs like unbound functions (say,
"with-no-warnings") might go unnoticed.

-- 
Wolfram Fenske

A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting frowned upon?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-19 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-17  2:21 The return of starttls doesn't work in smtpmail Wolfram Fenske
2007-08-17  8:30 ` Reiner Steib
2007-08-19 21:17   ` Wolfram Fenske

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 NNTP newsgroup(s).