Release candidate for Libgcrypt 1.4.2

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Wed Sep 24 15:56:55 CEST 2008


At Mon, 01 Sep 2008 21:56:43 +0200,
Simon Josefsson <simon at josefsson.org> wrote:
> 
> Werner Koch <wk at gnupg.org> writes:
> 
> > On Mon,  1 Sep 2008 18:36, simon at josefsson.org said:
> >
> >> -  snprintf (buf, sizeof buf, "%5lums", (unsigned long)t );
> >> +  snprintf (buf, sizeof buf, "%5.0fms", (double)t );
> >
> > Do you understand why this occurs only with Wine?  I have not tested it
> > on Wine but it works fine on a standard XP box.  Is there a problem with
> > my code or is Wine's snprintf broken?
> 
> I actually don't know where the problem is.  I can't reproduce it in a
> small snippet.  FWIW, this also works fine under mingw+wine:
> 
>   snprintf (buf, sizeof buf, "%5llums", t );
> 
> That is arguably more correct, but requires that all Windows supports
> %ll.
> 
> Something seems to go wrong when the 64-bit value is cast to a 32-bit
> value and then passed as an argument.  The values are interesting, see:
> 
> MD5          27574050817572874ms 5083798169452554ms 5083798169452604ms
> 
> That isn't even close to 64-bit or 32-bit boundaries.

Hi,

I posted this a couple of months ago on the gpg4win devel mailing
list.  Maybe it is relevant here:

if you use Ubuntu 8.04 or Debian unstable, you will encounter the
following bug in mingw32-runtime 3.13-1:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452977

Gpg4win packages built with this version of mingw32-runtime are badly
broken.  The INPUT FD=NR assuan commands will have bizarre NRs, due to
the misinterpretation of a %ld format string as %lld.

The attached patch fixes this particular problem.  This is how it can
be installed and used:

$ apt-get source mingw32-runtime
$ sudo apt-get build-dep mingw32-runtime
$ mkdir mingw32-runtime-3.13/debian/patches
$ cp 01-snprintf.patch mingw32-runtime-3.13/debian/patches/
$ cd mingw32-runtime-3.13
$ dpkg-buildpackage -rfakeroot -uc -us -b
$ sudo dpkg -i ../mingw32-runtime_3.13-1_all.deb

Note 1: If you do not recompile version 3.13-1, you might have to
change the paths in the patch file.

Note 2: You might want to add a new changelog entry to the package
(use version number 3.13-1.1).

Have fun,
Marcus

diff -rup mingw-runtime-3.13-20070825-1-orig/mingwex/gdtoa/mingw_snprintf.c mingw-runtime-3.13-20070825-1/mingwex/gdtoa/mingw_snprintf.c
--- mingw-runtime-3.13-20070825-1-orig/mingwex/gdtoa/mingw_snprintf.c	2007-08-24 12:57:04.000000000 +0200
+++ mingw-runtime-3.13-20070825-1/mingwex/gdtoa/mingw_snprintf.c	2008-05-14 17:22:06.000000000 +0200
@@ -465,7 +465,7 @@ x_sprintf
 				    len = LEN_LL;
 				  }
   				else
-				  len = LEN_LL;
+				  len = LEN_L;
 				goto fmtloop;
 			case 'L':
 				flag_ld++;
@@ -617,6 +617,7 @@ x_sprintf
 					break;
 				  case LEN_S:
 					*(short*)ip = c;
+					break;
 				  case LEN_LL:
 					*(long long*) ip = c;
 					break;




More information about the Gcrypt-devel mailing list