Mailing List Archive

MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2"
Hi! On MinGW built binaries run under Wine, libgcrypt generates a lot
of these error messages:

DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2
DBG: rndw32: get performance data problem: ec=2

The relevant code in cipher/rndw32.c:registry_poll:

pPerfData = gcry_xmalloc (cbPerfData);
for (iterations=0; iterations < 10; iterations++)
{
dwSize = cbPerfData;
if ( debug_me )
log_debug ("rndw32#slow_gatherer_nt: get perf data\n" );

status = RegQueryValueEx (HKEY_PERFORMANCE_DATA, "Global", NULL,
NULL, (LPBYTE) pPerfData, &dwSize);
if (status == ERROR_SUCCESS)
{
if (!memcmp (pPerfData->Signature, L"PERF", 8))
(*add) ( pPerfData, dwSize, requester );
else
log_debug ("rndw32: no PERF signature\n");
break;
}
else if (status == ERROR_MORE_DATA)
{
cbPerfData += PERFORMANCE_BUFFER_STEP;
pPerfData = gcry_xrealloc (pPerfData, cbPerfData);
}
else
{
log_debug ("rndw32: get performance data problem: ec=%ld\n",
status);
break;
}
}
gcry_free (pPerfData);

The error code 2:

/usr/i586-mingw32msvc/include/winerror.h:#define ERROR_FILE_NOT_FOUND 2L

According to:

http://msdn2.microsoft.com/en-us/library/ms724911(VS.85).aspx

Return Value
...
If the lpValueName registry value does not exist, the function returns
ERROR_FILE_NOT_FOUND.

Libgcrypt can't know that the syscall will fail, but is there any reason
to believe that if the first of the 10 calls returns FILE_NOT_FOUND,
that another call to the same function with the same parameters will
succeed? Possibly the code should just abort the loop in this
situation.

In any case, other calls to log_debug in that file are protected behind
a 'if (debug_me)' so I would suggest the patch below as a first step.

Thanks,
Simon

Index: rndw32.c
===================================================================
--- rndw32.c (revision 1280)
+++ rndw32.c (working copy)
@@ -1,5 +1,5 @@
/* rndw32.c - W32 entropy gatherer
- * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
* Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
*
* This file is part of Libgcrypt.
@@ -440,8 +440,9 @@
}
else
{
- log_debug ("rndw32: get performance data problem: ec=%ld\n",
- status);
+ if ( debug_me )
+ log_debug ("rndw32: get performance data problem: ec=%ld\n",
+ status);
break;
}
}

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
On Wed, 16 Jan 2008 15:25, simon@josefsson.org said:

> Libgcrypt can't know that the syscall will fail, but is there any reason
> to believe that if the first of the 10 calls returns FILE_NOT_FOUND,
> that another call to the same function with the same parameters will
> succeed? Possibly the code should just abort the loop in this
> situation.

Frankly, I don't know. The code is by Peter Gutmann and I would need to
do some research why it fails.

> In any case, other calls to log_debug in that file are protected behind
> a 'if (debug_me)' so I would suggest the patch below as a first step.

Well, the reason for always printing it is so that you could send this
complaint ;-).

What about printing the warning only once per process?


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz.


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
Werner Koch <wk@gnupg.org> writes:

> On Wed, 16 Jan 2008 15:25, simon@josefsson.org said:
>
>> Libgcrypt can't know that the syscall will fail, but is there any reason
>> to believe that if the first of the 10 calls returns FILE_NOT_FOUND,
>> that another call to the same function with the same parameters will
>> succeed? Possibly the code should just abort the loop in this
>> situation.
>
> Frankly, I don't know. The code is by Peter Gutmann and I would need to
> do some research why it fails.

I suspect Wine doesn't emulate this part of Windows.

>> In any case, other calls to log_debug in that file are protected behind
>> a 'if (debug_me)' so I would suggest the patch below as a first step.
>
> Well, the reason for always printing it is so that you could send this
> complaint ;-).
>
> What about printing the warning only once per process?

Works for me. How about this patch?

/Simon

Index: rndw32.c
===================================================================
--- rndw32.c (revision 1280)
+++ rndw32.c (working copy)
@@ -1,5 +1,5 @@
/* rndw32.c - W32 entropy gatherer
- * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
* Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
*
* This file is part of Libgcrypt.
@@ -440,8 +440,11 @@
}
else
{
- log_debug ("rndw32: get performance data problem: ec=%ld\n",
- status);
+ static int been_here = 1;
+ if (been_here)
+ log_debug ("rndw32: get performance data problem: ec=%ld\n",
+ status);
+ been_here = 0;
break;
}
}

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
Simon Josefsson <simon@josefsson.org> writes:

> Works for me. How about this patch?

I reversed the logic in the variable name, here is a better patch...

/Simon

Index: rndw32.c
===================================================================
--- rndw32.c (revision 1280)
+++ rndw32.c (working copy)
@@ -1,5 +1,5 @@
/* rndw32.c - W32 entropy gatherer
- * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
* Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
*
* This file is part of Libgcrypt.
@@ -440,8 +440,11 @@
}
else
{
- log_debug ("rndw32: get performance data problem: ec=%ld\n",
- status);
+ static int been_here = 0;
+ if (!been_here)
+ log_debug ("rndw32: get performance data problem: ec=%ld\n",
+ status);
+ been_here = 1;
break;
}
}

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
Simon Josefsson <simon@josefsson.org> writes:

> Simon Josefsson <simon@josefsson.org> writes:
>
>> Works for me. How about this patch?
>
> I reversed the logic in the variable name, here is a better patch...

This patch is somewhat better -- if the return codes for some reason
differ between invocations, the code will print a new debug message
every time it changes.

(The first time, 'been_here' can never be ERROR_SUCCESS, or it wouldn't
have reached that if clause.)

/Simon

Index: rndw32.c
===================================================================
--- rndw32.c (revision 1280)
+++ rndw32.c (working copy)
@@ -1,5 +1,5 @@
/* rndw32.c - W32 entropy gatherer
- * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
* Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
*
* This file is part of Libgcrypt.
@@ -440,8 +440,11 @@
}
else
{
- log_debug ("rndw32: get performance data problem: ec=%ld\n",
- status);
+ static int been_here = ERROR_SUCCESS;
+ if (been_here != status)
+ log_debug ("rndw32: get performance data problem: ec=%ld\n",
+ status);
+ been_here = status;
break;
}
}

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
Simon Josefsson <simon@josefsson.org> writes:

> Simon Josefsson <simon@josefsson.org> writes:
>
>> Simon Josefsson <simon@josefsson.org> writes:
>>
>>> Works for me. How about this patch?
>>
>> I reversed the logic in the variable name, here is a better patch...
>
> This patch is somewhat better -- if the return codes for some reason
> differ between invocations, the code will print a new debug message
> every time it changes.
>
> (The first time, 'been_here' can never be ERROR_SUCCESS, or it wouldn't
> have reached that if clause.)

Any chance to apply this patch? The patch reduces noise from libgcrypt
under MinGW+Wine significantly. I tested that it applies and works
against 1.4.0.

Thanks,
> /Simon
>
> Index: rndw32.c
> ===================================================================
> --- rndw32.c (revision 1280)
> +++ rndw32.c (working copy)
> @@ -1,5 +1,5 @@
> /* rndw32.c - W32 entropy gatherer
> - * Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
> + * Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
> * Copyright Peter Gutmann, Matt Thomlinson and Blake Coverett 1996-2006
> *
> * This file is part of Libgcrypt.
> @@ -440,8 +440,11 @@
> }
> else
> {
> - log_debug ("rndw32: get performance data problem: ec=%ld\n",
> - status);
> + static int been_here = ERROR_SUCCESS;
> + if (been_here != status)
> + log_debug ("rndw32: get performance data problem: ec=%ld\n",
> + status);
> + been_here = status;
> break;
> }
> }

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: MinGW+Wine and "DBG: rndw32: get performance data problem: ec=2" [ In reply to ]
On Fri, 18 Apr 2008 09:17, simon@josefsson.org said:

> Any chance to apply this patch? The patch reduces noise from libgcrypt
> under MinGW+Wine significantly. I tested that it applies and works
> against 1.4.0.

Okay. I don't use Wine much so I never noticed.


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz.


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel