W32 testsuite results

LRN lrn1986 at gmail.com
Wed Apr 6 00:16:14 CEST 2011


On 05.04.2011 23:08, LRN wrote:
> On 05.04.2011 22:59, Nikos Mavrogiannopoulos wrote:
>> On 04/05/2011 02:27 PM, LRN wrote:
>>
>>>> This shouldn't be a problem. The mini-* programs use fd==0xfffffff
>>>> because they emulate the communication and don't really use an fd.
>>> I think i've found the problem. The code in client_pull() in mini.c
>>> calls gnutls_transport_set_global_errno (EAGAIN); to tell gnutls 
>>> library
>>> code that the pull operation should be postponed. However, gnutls
>>> library code in _gnutls_read() in gnutls_buffers.c:306 calls int err =
>>> get_errno (session); to obain errno, which, in turn, returns
>>> session->internals.errno_func (session->internals.transport_recv_ptr);,
>>> which is the same as 
>>> system_errno(session->internals.transport_recv_ptr)
>>> at system.c:55, which simply calls WSAGetLastError(), switch'es over 
>>> its
>>> value and sets errno.
>>> That is, the problem is in the fact that on Windows gnutls assumes that
>>> underlying read() implementation is incapable of setting errno and is,
>>> in fact, a socket (since gnutls uses WSAGetLastError()).
>>> Possible fixes:
>>> A) Fix gnutls_transport_set_global_errno() to call SetLastError() (note
>>> that there's no difference between WSAGLE and GLE, unless you're 
>>> writing
>>> for WinSock 1.x, which is crazy, because WinSock 2.x has been shipped
>>> with NT since NT 4.0). And maybe set errno too, just to be safe.
>> I think I'll switch it to gnutls_transport_set_errno(), fix and
>> deprecate the set_global_errno() function. I don't see any point
>> in it as a function.
> How do you access a session object in pull function?
Anyway, i've fixed it in my local copy (patch is attached; since i don't 
know how to access session in pull(), my patch is a bit crude)

FAIL: hostname-check.exe
FAIL: chainverify.exe
FAIL: pgps2kgnu.exe
FAIL: testdsa
FAIL: testselfsigs

Obviously, the improvement is considerable. Half of safe-renegotiation 
tests failed previously, now they all pass. Mini and its variants all pass.

hostname check might fail because function_to_get_host_by_ip(127.0.0.1) 
!= "localhost" (known winsock bug).

chainverify fails because 2 certificates have expired in January 2011. A 
patch fixes that (although it would be better to get some new 
certificates for this test, no?)

pgps2kgnu fails because of unexplainable (and quiet!) strstr() failure 
in armor_decode:
Starting program: 
f:\src\for-mingwmsys\gnutls\bld\tests/./.libs/pgps2kgnu.exe -v
[New Thread 7464.0x1524]
[New Thread 7464.0x3dc8]
[New Thread 7464.0x450c]

Breakpoint 9, armor_decode (data=0x21547f0, in=0x75f92960, 
out=0x75f92980) at armor.c:488
488       armor_filter_t *afx = data;
(gdb) n
492       u32 crc2 = 0;
(gdb)
493       ssize_t nread = 0;
(gdb)
494       int i, pgp_data = 0;
(gdb)
495       cdk_error_t rc = 0;
(gdb)
497       if (!afx)
(gdb)
503       _gnutls_buffers_log ("armor filter: decode\n");
(gdb)
505       fseek (in, 0, SEEK_SET);
(gdb)
507       while (!feof (in) && !pgp_data)
(gdb)
509           s = fgets (buf, DIM (buf) - 1, in);
(gdb)
510           if (!s)
(gdb)
512           afx->idx = search_header (buf, armor_begin);
(gdb)
513           if (afx->idx >= 0)
(gdb)
514             pgp_data = 1;
(gdb)
507       while (!feof (in) && !pgp_data)
(gdb)
517       if (feof (in) || !pgp_data)
(gdb)
524       while (!feof (in))
(gdb)
526           s = fgets (buf, DIM (buf) - 1, in);
(gdb)
527           if (!s)
(gdb)
529           if (strlen (s) == strlen (LF))
(gdb)
537           if (!strstr (buf, ": "))
(gdb) p buf
$68 = "Version: GnuPG v1.4.9 
(GNU/Linux)\n\000--\n\000ё:щu<э(\000\003\000\000\000\000\000\000\000иь(\000B¤пu:ьМw6?-u\f\001\000\000$э(\000,э(\000\b\000\000\00
0\016\000\000\000\000\000\000\000\003\000\000\000\000\005щuj\000\000 at l\000\000\000|\n=\000\066?-u\f\001\000\000Tэ("
(gdb) call strstr(buf, ": ")
$69 = 0
(gdb) call strstr(buf, ":")
$70 = 0
(gdb) p strstr
$71 = {<text variable, no debug info>} 0x77d79715 <strstr>
(gdb) s
542           rc = CDK_General_Error;
(gdb) call strstr(buf, ":")
$72 = 0
(gdb) call strstr(buf, "V")
$73 = 0
(gdb) call strstr("V", buf)
$74 = 0
(gdb) call strstr("123","1")
$75 = 0

I have no explanation whatsoever. Gnulib does not override this 
function, it is imported from msvcrt.
mbsstr works correctly (at least when called from gdb). Also, gnulib 
warns about strstr() not working with multibyte charsets. This is not 
the case here, but makes me wonder. I'll dig further.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 04-mingw32-fix-global-error-processing.mingw32.patch
URL: </pipermail/attachments/20110406/94e86b21/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 05-fix-expired-certs.all.patch
URL: </pipermail/attachments/20110406/94e86b21/attachment.asc>


More information about the Gnutls-devel mailing list