After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 317615 - librsvg uses locale settings while parsing files (LC_NUMERIC)
librsvg uses locale settings while parsing files (LC_NUMERIC)
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
2.12.x
Other Linux
: Normal major
: ---
Assigned To: librsvg maintainers
librsvg maintainers
: 317610 317942 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-09-30 16:24 UTC by Łukasz Stelmach
Modified: 2005-10-04 17:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
gnotski.svg saved as PNG with eog, LC_NUMERIC=C (3.64 KB, image/png)
2005-09-30 20:55 UTC, Łukasz Stelmach
  Details
gnotski.svg saved as PNG with eog, LC_NUMERIC=pl_PL.utf8 (2.14 KB, image/png)
2005-09-30 20:56 UTC, Łukasz Stelmach
  Details
A patch to fix the problem (1.67 KB, patch)
2005-10-04 09:17 UTC, Callum McKenzie
none Details | Review

Description Łukasz Stelmach 2005-09-30 16:24:51 UTC
Distribution/Version: Freerock's GNOME (frg-current)

Set LC_NUMERIC to pl_PL.
Run Eye of Gnome, or Klotski (gnotski) or madjongg.

SVG images is misdisplayd. This happenes because in polish we use coma ',' as a
decimal point while SVG requires full stop '.' for this.

Everything works fine if I set LC_NUMERIC=C
Comment 1 Dominic Lachowicz 2005-09-30 20:09:07 UTC
i find this hard to believe, unless there is a bug in glib.

rsvg doesn't use printf or scanf with %g, %f, or %e arguments.

rsvg doesn't use strtod, atof, etc. we use g_ascii_strtod, which is supposed to
handle exactly this scanario.

as far as i can tell, we've been *very* careful about these numeric locale issues.
Comment 2 Łukasz Stelmach 2005-09-30 20:55:24 UTC
Yet still, there is something wrong and changin LC_NUMERIC *really* helps. I am
not 100% sure that this is the problem of the library. However, if I notice the
same problem with three different applications: eog, mahjongg and gnotski, which
all deal with SVG and all happen to fail if the LC_NUMERIC is pl_PL (',' decimal
point), I am quite convinced is in the library. I also tried to view gnotski.svg
and postmodern.svg with ImageMagic's display which isn't AFAIK linked against
librsvg (at least not dynamically) and despite it has some problems with
postmodern.svg it doesn't fail the way eog does.

There are two PNG files made from gnotski.svg eog.
Comment 3 Łukasz Stelmach 2005-09-30 20:55:36 UTC
Created attachment 52887 [details]
gnotski.svg saved as PNG with eog, LC_NUMERIC=C
Comment 4 Łukasz Stelmach 2005-09-30 20:56:52 UTC
Created attachment 52888 [details]
gnotski.svg saved as PNG with eog, LC_NUMERIC=pl_PL.utf8
Comment 5 Dominic Lachowicz 2005-09-30 21:37:31 UTC
what version of glib do you have installed?
Comment 6 Dominic Lachowicz 2005-10-01 16:50:51 UTC
moving to NEEDINFO state
Comment 7 Łukasz Stelmach 2005-10-03 05:04:39 UTC
It's 2.8.2-i486-1frg (frg == Freerock's GNOME for Slackware;
http://gsb.freerock.org)
Comment 8 Dominic Lachowicz 2005-10-03 12:42:43 UTC
reopening
Comment 9 Callum McKenzie 2005-10-04 03:16:13 UTC
*** Bug 317610 has been marked as a duplicate of this bug. ***
Comment 10 Callum McKenzie 2005-10-04 06:29:18 UTC
As per the bug I marked as a duplicate above, I can reproduce this on a recently
updated Ubunutu Breezy install with librsvg 2.12.4 (2.12.4-0ubuntu1).
Comment 11 Callum McKenzie 2005-10-04 06:57:22 UTC
I have found the cause of the bug. The input is parsed absolutely correctly, but
it turns out that Dom's second statement in comment #1 is wrong.

In the file rsvg-shapes.c, function _rsvg_node_poly_draw there are lines like:

g_string_append_printf (d, "M %f %f ", poly->pointlist[0], poly->pointlist[1] );

The data is being re-encoded, and when it is the locale settings are being used
producing commas in the string.

I'll look into getting a patch together after I've had some dinner.
Comment 12 Callum McKenzie 2005-10-04 09:17:04 UTC
Created attachment 53012 [details] [review]
A patch to fix the problem

This patch temporarily sets the locale back to the "C" locale while doing the
g_string_append_printf operations. It is basically the same as the example in
section 7.4 of the glibc manual. Quick and dirty, but it works.

An alternative would be to make librsvg handle polygons natively rather than
translating them to a path which is where the problem code lies.
Comment 13 Dominic Lachowicz 2005-10-04 12:18:41 UTC
ooh, good point... i'll fix this properly
Comment 14 Dominic Lachowicz 2005-10-04 12:29:13 UTC
fixed! thanks callum!
Comment 15 Richard Hoelscher 2005-10-04 17:40:39 UTC
*** Bug 317942 has been marked as a duplicate of this bug. ***