Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 97783 - gnumeric ignores locale settings on amd64
Summary: gnumeric ignores locale settings on amd64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: GNOME Office (OBSOLETE)
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2005-07-02 20:58 UTC by João Rafael Moraes Nicola
Modified: 2006-01-06 23:28 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
This fixes it! (gnumeric-1.4.3-fix-set-locale.patch,1.42 KB, patch)
2005-07-02 23:25 UTC, João Rafael Moraes Nicola
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description João Rafael Moraes Nicola 2005-07-02 20:58:38 UTC
Problem applies to: gnumeric versions 1.4.1 1.4.2 1.4.3 on amd64.
gnumeric ignores locale settings.

gnumeric is showing in english even with LANG=pt_BR LC_ALL=pt_BR LC_MESSAGES=pt_BR
inserting some printfs in strategic places seems to indicate that LC_ALL and LC_MESSAGES get changed to "C" at some point on the code. 
However, searching the source for "setlocale" shows that, whenever a call to setlocale occurs to change a locale for a category, a further call restores the old category.
I inserted a 'setlocale(LC_ALL,"")' and 'setlocale(LC_MESSAGES,"")' in the main() function of the application. Immediately after, I print the current locale for these categories, which shows "pt_BR". Again, when UI is created, the locale is "C".
Maybe this a problem with glibc? or libintl?
This problem only occurs at my amd64 machine. My x86 works correctly.
This is a showstopper bug for me because I intend to deply gnumeric as the spreadsheet application on brazillian company which is migrating to Linux.
I haven't seem any related bug reports here or in the gnumeric site.

Please enter in contact. I will be very happy to help debugging this with some help from someone more knowledgeable in this application.

Thanks,

Jo
Comment 1 João Rafael Moraes Nicola 2005-07-02 20:58:38 UTC
Problem applies to: gnumeric versions 1.4.1 1.4.2 1.4.3 on amd64.
gnumeric ignores locale settings.

gnumeric is showing in english even with LANG=pt_BR LC_ALL=pt_BR LC_MESSAGES=pt_BR
inserting some printfs in strategic places seems to indicate that LC_ALL and LC_MESSAGES get changed to "C" at some point on the code. 
However, searching the source for "setlocale" shows that, whenever a call to setlocale occurs to change a locale for a category, a further call restores the old category.
I inserted a 'setlocale(LC_ALL,"")' and 'setlocale(LC_MESSAGES,"")' in the main() function of the application. Immediately after, I print the current locale for these categories, which shows "pt_BR". Again, when UI is created, the locale is "C".
Maybe this a problem with glibc? or libintl?
This problem only occurs at my amd64 machine. My x86 works correctly.
This is a showstopper bug for me because I intend to deply gnumeric as the spreadsheet application on brazillian company which is migrating to Linux.
I haven't seem any related bug reports here or in the gnumeric site.

Please enter in contact. I will be very happy to help debugging this with some help from someone more knowledgeable in this application.

Thanks,

João Rafael Moraes Nicola
joaoraf@gmail.com
Comment 2 João Rafael Moraes Nicola 2005-07-02 23:25:06 UTC
Created attachment 62524 [details, diff]
This fixes it!

It seems that there is some code in go-math.c that assumes that the string
returned by the setlocale(..,NULL) function call is non-static. However, the
man page for setlocale says that the string MAY be static. This patch removes
that assumption by calling strdup to duplicate the string. I am not sure,
though, if I should free the string after the next call to setlocale, because I
don't know whether the setlocale function makes a copy or not of its parameter.
If it does, this should not be a serious leakage since the code gets executed
only once.
My gnumeric is now OK :-)
Comment 3 z4 2005-07-22 17:57:27 UTC
same problem here with gnumeric 1.4.3 on x86 but have not tried to apply the
patch yet.

Output of locale:
LANG=de_DE@euro
LC_CTYPE="de_DE@euro"
LC_NUMERIC="de_DE@euro"
LC_TIME="de_DE@euro"
LC_COLLATE="de_DE@euro"
LC_MONETARY="de_DE@euro"
LC_MESSAGES="de_DE@euro"
LC_PAPER="de_DE@euro"
LC_NAME="de_DE@euro"
LC_ADDRESS="de_DE@euro"
LC_TELEPHONE="de_DE@euro"
LC_MEASUREMENT="de_DE@euro"
LC_IDENTIFICATION="de_DE@euro"
LC_ALL=de_DE@euro
Comment 4 z4 2005-07-24 07:43:44 UTC
maybe this bug should be reassigned to gnome@gentoo.org ?
Comment 5 Erik Bergmann 2005-07-25 03:05:57 UTC
This patch worked for me (z4), too.
Please add it to the ebuild.
Comment 6 Simon Stelling (RETIRED) gentoo-dev 2005-08-31 08:45:34 UTC
reassigning to gnome@g.o as it seems not to be amd64-specific
Comment 7 Joe McCann (RETIRED) gentoo-dev 2005-10-30 10:27:54 UTC
Can you post an upstream bug at http://bugs.gentoo.org under the gnumeric
component to get the attention and advice of the maintainer.
Comment 8 Joe McCann (RETIRED) gentoo-dev 2006-01-06 23:28:48 UTC
This should be fixed with gnumeric-1.6.1 and new versions of libgsf/goffice.