GNOME Bugzilla – Bug 126640
g_ascii_strtod not handling Persian decimal separator properly
Last modified: 2004-12-22 21:47:04 UTC
g_ascii_strtod is not handling Persian decimal separator properly. It has a problem if a decimal separator is more than one byte when encoded in UTF-8. See <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109568> for details and a patch. The patch itself is at <https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=95872&action=view>.
Created attachment 21342 [details] [review] Patch to fix the problem, against glib 2.2.3
Alex, could you look at this?
Changing priority to "Immediate", since "This bug blocks development or testing work and should be fixed ASAP". It blocks testing the Persian translation of GNOME.
This bugfix does seem right. However it would also be nice if the test in tests/strtod-test.c (which actually tests fa_IR!) could be extended to catch this case.
Created attachment 21792 [details] [review] patch to test the patch above
Attached a patch for strtod-test.c. Actually it's not quite easy to test the bug, as the erronous if statement, in an ideal world, would always evaluate to true. So it's hard to put both tests for true and false cases, and hope that one fails. Then comes this bug in the if condition. Now we should try hard to make it evaluate to false. As it's a wrong pointer comparison, it can be done by shaping the malloc memory, which the patch does. Oops, patch has errors, Roozbeh, would fix another one?
Created attachment 21799 [details] [review] Final patch for both the bugfix and the test
Last patch replaces both previous patches. It's what Alex approved to be a correct patch for the bug, plus an extension to tests/strtod-test.c that fails with current CVS head. May I apply?
Looks good to me.
Patch applied to HEAD and glib-2-2 branch. Behdad, would you test?
Tested by Behdad. Closing the bug as fixed.