Bug 126714 - gnome_program_init() breaks setlocale() return value
Summary: gnome_program_init() breaks setlocale() return value
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: libgnome
Version: 2
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-25 07:55 UTC by Nakai
Modified: 2013-04-02 04:19 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-17 05:03:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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().


Note You need to log in before you can comment on or make changes to this bug.