Bug 126714

Summary: gnome_program_init() breaks setlocale() return value
Product: [Fedora] Fedora Reporter: Nakai <ynakai>
Component: libgnomeAssignee: Jonathan Blandford <jrb>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 2CC: ddumas, eng-i18n-bugs
Target Milestone: ---Keywords: i18n
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-17 05:03:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nakai 2004-06-25 07:55:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.6) Gecko/20040510

Description of problem:
gnome_program_init() breaks setlocale() return value.

With the below program, 2 g_print() should show same value,
but doesn't on FC2:

#include <locale.h>
#include <libgnome/libgnome.h>
                                                                     
          
static GnomeProgram* program;
                                                                     
          
int main(int argc, char** argv) {
  gchar* locale = setlocale(LC_ALL, "");
  g_print("locale before: %s\n", locale);
  program = gnome_program_init("a", "0", LIBGNOME_MODULE, argc,argv,
NULL);
  g_print("locale after: %s\n", locale);
  return 0;
}


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. LANG=ja_JP.eucJP ./main
2. It's broken.
3. LANG=C ./main
4. It works.
5. LANG=en_US.UTF-8 ./main
6. It's broken.
    

Actual Results:  locale before: ja_JP.UTF-8
locale after: /tmp


Expected Results:  locale before: ja_JP.UTF-8
locale after: ja_JP.UTF-8

Additional info:

I confirmed it works on FC1. (libgnome-2.4.0-1)
And I think it worked around FC2 test3 or its beta stage.
But FC2 final breaks.

My program at http://cvs.gnome.org/viewcvs/gnome-u2ps/
uses setlocale() return value to choose correct font. It is not
in the distro, but a sample app that this bug affects.

I set the severity as high, because it seems a loss of data.

Comment 1 Nakai 2004-08-17 05:03:26 UTC
Seems to be correct behavior. Should g_strdup().