Bug 870761

Summary: [ar_AA.ISO8859-6] locale.Error: unsupported locale setting
Product: [Fedora] Fedora Reporter: Steve Tyler <stephent98>
Component: pythonAssignee: Bohuslav "Slavek" Kabrda <bkabrda>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: bkabrda, dmalcolm, ivazqueznet, jonathansteffan, stephent98, tomspur
Target Milestone: ---Keywords: i18n
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 14:32:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
report listing unknown locales returned by locale.normalize()
none
locale-normalize-test-1.py report generator none

Description Steve Tyler 2012-10-28 15:19:25 UTC
Description of problem:
locale.normalize() returns a locale string that locale.setlocale() rejects.

>>> locale.normalize('ar')
'ar_AA.ISO8859-6'
>>> locale.setlocale(locale.LC_ALL, 'ar_AA.ISO8859-6')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Version-Release number of selected component (if applicable):
python-2.7.3-7.2.fc17.x86_64
glibc-common-2.15-57.fc17.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. See above.
  
Actual results:
See above.

Expected results:
locale.normalize() returns a locale string that is accepted by locale.setlocale().

Additional info:

Comment 1 Steve Tyler 2012-10-28 17:00:45 UTC
Created attachment 634620 [details]
report listing unknown locales returned by locale.normalize()

This attachment shows that out of 843 locales in locale.locale_alias, 297 raise an "unsupported locale setting" exception when passed to setlocale(). However, the Python documentation says that they are "formatted for use with setlocale()":

locale.normalize(localename)

    Returns a normalized locale code for the given locale name. The returned locale code is formatted for use with setlocale(). If normalization fails, the original name is returned unchanged.

    If the given encoding is not known, the function defaults to the default encoding for the locale code just like setlocale().

http://docs.python.org/2.7/library/locale.html#locale.normalize

Comment 2 Steve Tyler 2012-10-28 17:04:04 UTC
Created attachment 634622 [details]
locale-normalize-test-1.py report generator

This is the Python program used to generate the previously attached report.

Comment 3 Steve Tyler 2012-11-02 21:03:29 UTC
Here's another example:

'sr_RS.UTF-8@latin' is a valid locale, but locale.normalize('sr_RS.UTF-8@latin') returns 'sr_RS.utf_8_latin', which is an invalid locale:

>>> locale.setlocale(locale.LC_ALL, 'sr_RS.UTF-8@latin')
'sr_RS.UTF-8@latin'

>>> locale.normalize('sr_RS.UTF-8@latin')
'sr_RS.utf_8_latin'

>>> locale.setlocale(locale.LC_ALL, 'sr_RS.utf_8_latin')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Comment 4 Fedora Admin XMLRPC Client 2013-05-10 05:07:46 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2013-05-10 05:07:49 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora Admin XMLRPC Client 2013-05-10 05:10:22 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Fedora End Of Life 2013-07-03 20:15:44 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Steve Tyler 2013-07-03 20:43:13 UTC
(In reply to Fedora End Of Life from comment #7)
> This message is a reminder that Fedora 17 is nearing its end of life.
...

Bumping to F19:
python-2.7.5-1.fc19.x86_64
glibc-common-2.17-11.fc19.x86_64

$ python
Python 2.7.5 (default, May 16 2013, 13:44:12) 
[GCC 4.8.0 20130412 (Red Hat 4.8.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.normalize('ar')
'ar_AA.ISO8859-6'
>>> locale.setlocale(locale.LC_ALL, 'ar_AA.ISO8859-6')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Comment 9 Fedora End Of Life 2015-01-09 17:26:42 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-02-17 14:32:09 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.