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