public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ilmalakhov at yandex dot ru" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/18207] New: _initialize_python () may fail to restore initial locale in gdb configured with Python 3
Date: Tue, 07 Apr 2015 11:03:00 -0000	[thread overview]
Message-ID: <bug-18207-4717@http.sourceware.org/bugzilla/> (raw)

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.


                 reply	other threads:[~2015-04-07 11:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18207-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).