ad1545
From eaa2dd2de04147dbca127673d3c2473955b9289c Mon Sep 17 00:00:00 2001
f65af0
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
f65af0
Date: Fri, 10 Aug 2018 13:16:38 +0200
f65af0
Subject: [PATCH] Removing filesystem encoding check
f65af0
f65af0
RHEL doesn't support the generic locale "C.UTF-8"
f65af0
See BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1590680
f65af0
f65af0
Revertis commit: e1bd827bbf56970ddd02ec174bf2317b64e75514
f65af0
---
f65af0
 install/conf/ipa.conf                 |  3 +--
f65af0
 install/share/ipa-httpd.conf.template |  1 -
f65af0
 ipalib/errors.py                      | 11 -----------
f65af0
 ipalib/plugable.py                    |  5 -----
f65af0
 ipatests/test_cmdline/test_cli.py     | 24 +-----------------------
f65af0
 5 files changed, 2 insertions(+), 42 deletions(-)
f65af0
f65af0
diff --git a/install/conf/ipa.conf b/install/conf/ipa.conf
f65af0
index c5fc518f803d379287043b405efeb46dd53a6b28..e15437b1804203ab85caaea420dde8fc12b15070 100644
f65af0
--- a/install/conf/ipa.conf
f65af0
+++ b/install/conf/ipa.conf
f65af0
@@ -48,8 +48,7 @@ WSGISocketPrefix /run/httpd/wsgi
f65af0
 
f65af0
 # Configure mod_wsgi handler for /ipa
f65af0
 WSGIDaemonProcess ipa processes=$WSGI_PROCESSES threads=1 maximum-requests=500 \
f65af0
-  user=ipaapi group=ipaapi display-name=%{GROUP} \
f65af0
-  lang=C.UTF-8 locale=C.UTF-8
f65af0
+  user=ipaapi group=ipaapi display-name=%{GROUP}
f65af0
 WSGIImportScript /usr/share/ipa/wsgi.py process-group=ipa application-group=ipa
f65af0
 WSGIScriptAlias /ipa /usr/share/ipa/wsgi.py
f65af0
 WSGIScriptReloading Off
f65af0
diff --git a/install/share/ipa-httpd.conf.template b/install/share/ipa-httpd.conf.template
f65af0
index 210d5d3883705b25b36050f50fdc1b49e830eb81..39bcfcca791c76f034224c00c9c2f85b652f78bb 100644
f65af0
--- a/install/share/ipa-httpd.conf.template
f65af0
+++ b/install/share/ipa-httpd.conf.template
f65af0
@@ -4,5 +4,4 @@
f65af0
 Environment=KRB5CCNAME=$KRB5CC_HTTPD
f65af0
 Environment=GSS_USE_PROXY=yes
f65af0
 Environment=KDCPROXY_CONFIG=$KDCPROXY_CONFIG
f65af0
-Environment=LC_ALL=C.UTF-8
f65af0
 ExecStartPre=$IPA_HTTPD_KDCPROXY
f65af0
diff --git a/ipalib/errors.py b/ipalib/errors.py
f65af0
index 6356d523e8c0ac63e8892292dd9991c9ee8211aa..ae940798779d20cb83b7f96a625c6facfe983f95 100644
f65af0
--- a/ipalib/errors.py
f65af0
+++ b/ipalib/errors.py
f65af0
@@ -453,17 +453,6 @@ class EnvironmentError(PublicError):
f65af0
     errno = 912
f65af0
 
f65af0
 
f65af0
-class SystemEncodingError(PublicError):
f65af0
-    """
f65af0
-    **913** Raised when system encoding is not UTF-8
f65af0
-    """
f65af0
-
f65af0
-    errno = 913
f65af0
-    format = _(
f65af0
-        "System encoding must be UTF-8, '%(encoding)s' is not supported. "
f65af0
-        "Set LC_ALL=\"C.UTF-8\", or LC_ALL=\"\" and LC_CTYPE=\"C.UTF-8\"."
f65af0
-    )
f65af0
-
f65af0
 ##############################################################################
f65af0
 # 1000 - 1999: Authentication errors
f65af0
 class AuthenticationError(PublicError):
f65af0
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
f65af0
index d78a607123907813d6327212ee6e85b356112791..6aad8d90c9df071b5372cae920e800daae563133 100644
f65af0
--- a/ipalib/plugable.py
f65af0
+++ b/ipalib/plugable.py
f65af0
@@ -485,11 +485,6 @@ class API(ReadOnly):
f65af0
         handler.setFormatter(ipa_log_manager.Formatter(LOGGING_FORMAT_STDERR))
f65af0
         root_logger.addHandler(handler)
f65af0
 
f65af0
-        # check after logging is set up but before we create files.
f65af0
-        fse = sys.getfilesystemencoding()
f65af0
-        if fse.lower() not in {'utf-8', 'utf8'}:
f65af0
-            raise errors.SystemEncodingError(encoding=fse)
f65af0
-
f65af0
         # Add file handler:
f65af0
         if self.env.mode in ('dummy', 'unit_test'):
f65af0
             return  # But not if in unit-test mode
f65af0
diff --git a/ipatests/test_cmdline/test_cli.py b/ipatests/test_cmdline/test_cli.py
f65af0
index 8211c03515bf70b681da49d27ae11a4e8cb3b44d..a40b5d45ff8406c3ebbb69465e8d71d7d5bdb63a 100644
f65af0
--- a/ipatests/test_cmdline/test_cli.py
f65af0
+++ b/ipatests/test_cmdline/test_cli.py
f65af0
@@ -1,8 +1,6 @@
f65af0
-import contextlib
f65af0
-import os
f65af0
 import shlex
f65af0
-import subprocess
f65af0
 import sys
f65af0
+import contextlib
f65af0
 import tempfile
f65af0
 
f65af0
 import nose
f65af0
@@ -19,8 +17,6 @@ if six.PY3:
f65af0
 
f65af0
 TEST_ZONE = u'zoneadd.%(domain)s' % api.env
f65af0
 
f65af0
-HERE = os.path.abspath(os.path.dirname(__file__))
f65af0
-BASE_DIR = os.path.abspath(os.path.join(HERE, os.pardir, os.pardir))
f65af0
 
f65af0
 
f65af0
 @pytest.mark.tier0
f65af0
@@ -324,21 +320,3 @@ class TestCLIParsing(object):
f65af0
                 file=goodcert_headers
f65af0
             )
f65af0
 
f65af0
-
f65af0
-def test_cli_fsencoding():
f65af0
-    # https://pagure.io/freeipa/issue/5887
f65af0
-    env = {
f65af0
-        key: value for key, value in os.environ.items()
f65af0
-        if not key.startswith(('LC_', 'LANG'))
f65af0
-    }
f65af0
-    env['LC_ALL'] = 'C'
f65af0
-    env['PYTHONPATH'] = BASE_DIR
f65af0
-    p = subprocess.Popen(
f65af0
-        [sys.executable, '-m', 'ipaclient', 'help'],
f65af0
-        stdout=subprocess.PIPE,
f65af0
-        stderr=subprocess.PIPE,
f65af0
-        env=env,
f65af0
-    )
f65af0
-    out, err = p.communicate()
f65af0
-    assert p.returncode > 0, (out, err)
f65af0
-    assert b'System encoding must be UTF-8' in err, (out, err)
f65af0
-- 
ad1545
2.17.2
f65af0