Re: json-glib: doubles serialization does not works
2012/1/10 Adam D. Barratt wrote:>If the bug is critical, I'm surprised that no-one appears to have filed
>it in the BTS by now.
Maybe there are just too few apps in Squeeze that utilizes serialization functionality of json-glib.
>Could you provide a little more information about
>which upstream version the fix was included in, and applications which
I noticed this problem while testing new versions of my game (Mokomaze ) on Squeeze. I use json-glib to store user settings. The fix is from official GNOME GIT source code repository. It was committed on March 18th 2010 and version 0.10.4 of the library was released on March 19th 2010 .
Absolutely the same bug was fixed in Ubuntu Maverick. The bug report  contains detailed description of the problem, a proper fix  for the package and even a test app .
>If you'd like to have a fix for the issue considered for an update in
>stable, please prepare a fixed package and send a debdiff to
>debian-release for consideration.
I have tried to do it - the diff is attached to this message.
=== modified file 'debian/changelog'
--- debian/changelog 2010-01-10 23:59:10 +0000
+++ debian/changelog 2012-01-11 01:30:45 +0000
@@ -1,3 +1,10 @@
+json-glib (0.10.2-2squeeze1) stable; urgency=low
+ * debian/patches/01_use_g_format_for_g_ascii_formatd.patch:
+ - Add upstream patch to fix serialization of doubles
+ -- Anton Olkhovik <email@example.com> Wed, 11 Jan 2012 01:30:45 +0400
json-glib (0.10.2-2) unstable; urgency=low
* Enable GObject introspection
=== added directory 'debian/patches'
=== added file 'debian/patches/01_use_g_format_for_g_ascii_formatd.patch'
--- debian/patches/01_use_g_format_for_g_ascii_formatd.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/01_use_g_format_for_g_ascii_formatd.patch 2012-01-11 01:30:45 +0000
@@ -0,0 +1,29 @@
+From f622ee8d8ba54ddea6fbb7311a905ffab7842e8d Mon Sep 17 00:00:00 2001
+From: Emmanuele Bassi <firstname.lastname@example.org>
+Date: Thu, 18 Mar 2010 17:05:57 +0000
+Subject: generator: Use %g format for g_ascii_formatd()
+I should read the documentation for the functions I use:
+ Converts a gdouble to a string, using the '.' as decimal point. To
+ format the number you pass in a printf()-style format string. Allowed
+ conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
+ -- from g_ascii_formatd() in GLib's API reference
+Epic reading fail.
+diff --git a/json-glib/json-generator.c b/json-glib/json-generator.c
+index bad239b..c77830e 100644
+@@ -309,7 +309,7 @@ dump_value (JsonGenerator *generator,
+ gchar buf;
+- g_ascii_formatd (buf, 65, "%d", g_value_get_double (&value));
++ g_ascii_formatd (buf, 65, "%g", g_value_get_double (&value));
+ g_string_append (buffer, buf);
=== added file 'debian/patches/series'
--- debian/patches/series 1970-01-01 00:00:00 +0000
+++ debian/patches/series 2012-01-11 01:30:45 +0000
@@ -0,0 +1,1 @@