Bug 126714 - gnome_program_init() breaks setlocale() return value
gnome_program_init() breaks setlocale() return value
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: libgnome (Show other bugs)
2
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jonathan Blandford
: i18n
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-25 03:55 EDT by Nakai
Modified: 2013-04-02 00:19 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-17 01:03:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nakai 2004-06-25 03:55:07 EDT
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 01:03:26 EDT
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.