unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs on windows and GnuTLS
@ 2013-11-01 22:13 Fabrice Popineau
  2013-11-03 11:33 ` Ted Zlatanov
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2013-11-01 22:13 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

Hi,

I wanted to check that GnuTLS is ok on my Emacs installation
and after doing:

(require 'gnutls)

(setq gnutls-log-level 2)
(open-gnutls-stream "tls" "tls-buffer" "imap.gmail.com" "imaps")

I find these annoying messages:

gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable,
try again.
gnutls.c: [2] ASSERT: gnutls_buffers.c:1015

gnutls.c: [2] ASSERT: gnutls_buffers.c:508

gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable,
try again.
gnutls.c: [2] ASSERT: gnutls_buffers.c:1015

thousands of times.

With a log level of 1 :

gnutls.c: [1] (Emacs) GnuTLS library loaded: libgnutls-28.dll
gnutls.c: [1] (Emacs) allocating credentials
gnutls.c: [1] (Emacs) setting the trustfile:
 c:/Local/Emacs/etc/ca-bundle.crt
gnutls.c: [1] (Emacs) gnutls callbacks
gnutls.c: [1] (Emacs) gnutls_init
gnutls.c: [1] (Emacs) got non-default priority string: NORMAL
gnutls.c: [1] (Emacs) setting the priority string
gnutls.c: [audit] Note that the security level of the Diffie-Hellman key
exchange has been lowered to 256 bits and this may allow decryption of the
session data

gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable,
try again. [981 times]
#<process tls>


This is with GnuTLS-3.1.12 and 3.1.16 / Emacs current trunk compiled with
MinGW64
I'm not sure it is even harmful.
Any idea what could be wrong there ?

Thanks and best regards,

Fabrice

[-- Attachment #2: Type: text/html, Size: 2072 bytes --]

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

* Re: Emacs on windows and GnuTLS
  2013-11-01 22:13 Emacs on windows and GnuTLS Fabrice Popineau
@ 2013-11-03 11:33 ` Ted Zlatanov
  2013-11-03 17:16   ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Ted Zlatanov @ 2013-11-03 11:33 UTC (permalink / raw)
  To: emacs-devel

On Fri, 1 Nov 2013 23:13:21 +0100 Fabrice Popineau <fabrice.popineau@gmail.com> wrote: 

FP> I wanted to check that GnuTLS is ok on my Emacs installation
FP> and after doing:

FP> (require 'gnutls)

FP> (setq gnutls-log-level 2)
FP> (open-gnutls-stream "tls" "tls-buffer" "imap.gmail.com" "imaps")

FP> I find these annoying messages:

FP> gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable,
FP> try again.
FP> gnutls.c: [2] ASSERT: gnutls_buffers.c:1015

FP> gnutls.c: [2] ASSERT: gnutls_buffers.c:508

FP> gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable,
FP> try again.
FP> gnutls.c: [2] ASSERT: gnutls_buffers.c:1015

FP> thousands of times.

The ASERTs are coming from GnuTLS itself.  You'll have to raise the
`gnutls-log-level' to 1 or 0.  The non-fatal retries are probably
network-related.  We don't have a way, IIRC, to tell the error's
severity in advance so we always issue it at level 1.  But I have a note
in gnutls.c:

      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */

so specifically for GNUTLS_EAGAIN we can go up to level 3.  Could you
try that change on your own?  See below for suggested patch.  I will
install if it works for you.

FP> I'm not sure it is even harmful.
FP> Any idea what could be wrong there ?

Not harmful, just annoying :)

Ted

=== modified file 'src/gnutls.c'
--- src/gnutls.c        2013-10-17 06:42:21 +0000
+++ src/gnutls.c        2013-11-03 11:31:16 +0000
@@ -487,9 +487,13 @@
     }
   else
     {
+      bool eagain = (err == GNUTLS_E_AGAIN);
+      int level =  eagain ? 1 : 3;
       ret = 1;
-      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
-      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
+      GNUTLS_LOG2 (level,
+                   max_log_level,
+                   eagain ? "retry:" : "non-fatal error:",
+                   str);
     }
 
   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED





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

* Re: Emacs on windows and GnuTLS
  2013-11-03 11:33 ` Ted Zlatanov
@ 2013-11-03 17:16   ` Fabrice Popineau
  2013-11-04 16:20     ` Ted Zlatanov
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2013-11-03 17:16 UTC (permalink / raw)
  To: emacs-devel

Ted Zlatanov <tzz <at> lifelogs.com> writes:
> 
> The ASERTs are coming from GnuTLS itself.  You'll have to raise the
> `gnutls-log-level' to 1 or 0.  The non-fatal retries are probably
> network-related.  We don't have a way, IIRC, to tell the error's
> severity in advance so we always issue it at level 1.  But I have a note
> in gnutls.c:
> 
>       GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
>       /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
> 
> so specifically for GNUTLS_EAGAIN we can go up to level 3.  Could you
> try that change on your own?  See below for suggested patch.  I will
> install if it works for you.
> 
> FP> I'm not sure it is even harmful.
> FP> Any idea what could be wrong there ?
> 
> Not harmful, just annoying :)
> 
> Ted
> 
> === modified file 'src/gnutls.c'
> --- src/gnutls.c        2013-10-17 06:42:21 +0000
> +++ src/gnutls.c        2013-11-03 11:31:16 +0000
>  <at>  <at>  -487,9 +487,13  <at>  <at> 
>      }
>    else
>      {
> +      bool eagain = (err == GNUTLS_E_AGAIN);
> +      int level =  eagain ? 1 : 3;
>        ret = 1;
> -      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
> -      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
> +      GNUTLS_LOG2 (level,
> +                   max_log_level,
> +                   eagain ? "retry:" : "non-fatal error:",
> +                   str);
>      }
> 
>    if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
> 
> 


Thanks for the reply and the patch.
From what I have tested, I can make the following comments:
- if I understand correctly, you want to put EAGAIN at level 3, so you need 
to :

int level = eagain ? 3 : 1;

- GNUTLS_LOG2 is a macro in which string concatenation is used for the third 
argument, so you can't put a ? : instruction there.

So this gives me the following:

@@ -463,9 +487,19 @@
     }
   else
     {
+      bool eagain = (err == GNUTLS_E_AGAIN);
+      int level =  eagain ? 3 : 1;
       ret = 1;
-      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
-      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
+      if (eagain)
+       GNUTLS_LOG2 (level,
+                    max_log_level,
+                    "retry:",
+                    str);
+      else
+       GNUTLS_LOG2 (level,
+                    max_log_level,
+                    "non-fatal error:",
+                    str);
     }

   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED

And now the warning is not issued at level 1.

Best regards,

Fabrice





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

* Re: Emacs on windows and GnuTLS
  2013-11-03 17:16   ` Fabrice Popineau
@ 2013-11-04 16:20     ` Ted Zlatanov
  2013-11-05  2:31       ` Ted Zlatanov
  0 siblings, 1 reply; 6+ messages in thread
From: Ted Zlatanov @ 2013-11-04 16:20 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

Thanks for the review, Fabrice.

Anticipating the need for more of these special cases, here's a
switch-based approach that avoids special variables and makes the level
explicit in each case.  It's easier to read, too.  Let me know if this
works for you and I will install it.

Ted


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnutls.eagain-lower.patch --]
[-- Type: text/x-diff, Size: 719 bytes --]

=== modified file 'src/gnutls.c'
--- src/gnutls.c	2013-11-04 06:09:03 +0000
+++ src/gnutls.c	2013-11-04 16:16:31 +0000
@@ -488,8 +488,20 @@
   else
     {
       ret = 1;
-      GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
-      /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2.  */
+
+      switch (err)
+        {
+        case GNUTLS_E_AGAIN:
+          GNUTLS_LOG2 (3,
+                       max_log_level,
+                       "retry:",
+                       str);
+        default:
+          GNUTLS_LOG2 (1,
+                       max_log_level,
+                       "non-fatal error:",
+                       str);
+        }
     }
 
   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED


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

* Re: Emacs on windows and GnuTLS
  2013-11-04 16:20     ` Ted Zlatanov
@ 2013-11-05  2:31       ` Ted Zlatanov
  2013-11-05 11:59         ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Ted Zlatanov @ 2013-11-05  2:31 UTC (permalink / raw)
  To: emacs-devel

On Mon, 04 Nov 2013 11:20:34 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> Anticipating the need for more of these special cases, here's a
TZ> switch-based approach that avoids special variables and makes the level
TZ> explicit in each case.  It's easier to read, too.  Let me know if this
TZ> works for you and I will install it.

I used it today and it worked for me, so I've installed it.  Let me know
if you find any issues.

Ted




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

* Re: Emacs on windows and GnuTLS
  2013-11-05  2:31       ` Ted Zlatanov
@ 2013-11-05 11:59         ` Fabrice Popineau
  0 siblings, 0 replies; 6+ messages in thread
From: Fabrice Popineau @ 2013-11-05 11:59 UTC (permalink / raw)
  To: emacs-devel

Ted Zlatanov <tzz <at> lifelogs.com> writes:

> I used it today and it worked for me, so I've installed it.  Let me know
> if you find any issues.

It is ok for me too.

Thanks,

Fabrice







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

end of thread, other threads:[~2013-11-05 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 22:13 Emacs on windows and GnuTLS Fabrice Popineau
2013-11-03 11:33 ` Ted Zlatanov
2013-11-03 17:16   ` Fabrice Popineau
2013-11-04 16:20     ` Ted Zlatanov
2013-11-05  2:31       ` Ted Zlatanov
2013-11-05 11:59         ` Fabrice Popineau

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).