Bug 1590680

Summary: Unsupported locale C.UTF-8
Product: Red Hat Enterprise Linux 7 Reporter: Christian Heimes <cheimes>
Component: glibcAssignee: glibc team <glibc-bugzilla>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.6CC: ashankar, codonell, dj, fweimer, mnewsome, pfrankli, pvoborni
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-13 08:23:49 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:

Description Christian Heimes 2018-06-13 08:14:50 UTC
Description of problem:
RHEL doesn't support the generic locale "C.UTF-8". Only "C" and language specific locales like "en_US.UTF-8" are supported.

The lack of "C.UTF-8" breaks IdM/IPA. IPA sets LC_ALL=C.UTF-8 in httpd.service file in order to force Python to use UTF-8 file system encoding instead of ASCII file system encoding. Without LC_CTYPE=C.UTF-8 or LC_ALL=C.UTF-8, sys.getfilesystemencoding() is ANSI_X3.4-1968 (aka ASCII), so no file names with non-ASCII chars are supported. You can find more details in https://www.python.org/dev/peps/pep-0538/

I'm opening this bug against glibc, because on Fedora the locale is provided by glibc-common:
# rpm -qf /usr/lib/locale/C.utf8/LC_CTYPE
glibc-common-2.27-15.fc28.x86_64


Version-Release number of selected component (if applicable):
glibc-common-2.17-254.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"

Actual results:
ANSI_X3.4-1968

Expected results:
UTF-8

Additional info:

On RHEL 7.5 and 7.6:
$ env -i LC_ALL=C python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=en_US.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ python -c "import locale; print locale.setlocale(locale.LC_ALL, 'C.UTF-8')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

On Fedora 27 and 28:
$ env -i LC_ALL=C python -c "import sys; print sys.getfilesystemencoding()"
ANSI_X3.4-1968
$ env -i LC_ALL=C.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ env -i LC_ALL=en_US.UTF-8 python -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ python -c "import locale; print locale.setlocale(locale.LC_ALL, 'C.UTF-8')"
C.UTF-8

Comment 2 Florian Weimer 2018-06-13 08:23:49 UTC

*** This bug has been marked as a duplicate of bug 1361965 ***