public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/18207] New: _initialize_python () may fail to restore initial locale in gdb configured with Python 3
@ 2015-04-07 11:03 ilmalakhov at yandex dot ru
  0 siblings, 0 replies; only message in thread
From: ilmalakhov at yandex dot ru @ 2015-04-07 11:03 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18207

            Bug ID: 18207
           Summary: _initialize_python () may fail to restore initial
                    locale in gdb configured with Python 3
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: ilmalakhov at yandex dot ru

Hi.

 Currently there is a bug in _initialize_python () in recent gdb versions
(including the one in master branch of binutils-gdb.git) configured with Python
3, which may show itself up when manipulating locales:

$ cat gdb/python/python.c
. . .
void
_initialize_python (void)
{
. . .
#ifdef IS_PY3K
  oldloc = setlocale (LC_ALL, NULL);
  setlocale (LC_ALL, "");
. . .
  setlocale (LC_ALL, oldloc);
. . .


 If the second setlocale () were to succeed, it might very well spoil the
string OLDLOC pointed to after the first one, because of which the third
setlocale () might fail. An obvious fix would be to strdup (OLDLOC) after the
first call to setlocale and free () it in the end, of course.

 From a user's point of view this bug can make it impossible to enter
floating-point numbers within gdb in a usual way, if his environment prevents
'.' from being interpreted as a decimal point:

$ LC_ALL=ru_RU.KOI8-R gdb
. . .
(gdb) p 1.5
Invalid number "1.5".
. . .

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-07 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 11:03 [Bug python/18207] New: _initialize_python () may fail to restore initial locale in gdb configured with Python 3 ilmalakhov at yandex dot ru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).