# HG changeset patch # User Marcin Kuzminski # Date 2018-08-17 09:09:26 # Node ID 84e9d5effd02381a806b1421d2579925c72d2f93 # Parent 6a73abb98623003475bec9d5f9da619ccc73ed42 locale: use a hacky way to catch the locale set error. We rather "cleanup" the env ourselfs then make it fatal crash. This could be removed when glibc situation gets stable. diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -32,6 +32,20 @@ from pyramid.settings import asbool, asl from pyramid.wsgi import wsgiapp from pyramid.compat import configparser + +log = logging.getLogger(__name__) + +# due to Mercurial/glibc2.27 problems we need to detect if locale settings are +# causing problems and "fix" it in case they do and fallback to LC_ALL = C + +try: + locale.setlocale(locale.LC_ALL, '') +except locale.Error as e: + log.error( + 'LOCALE ERROR: failed to set LC_ALL, fallback to LC_ALL=C, org error: %s', e) + os.environ['LC_ALL'] = 'C' + + from vcsserver import remote_wsgi, scm_app, settings, hgpatches from vcsserver.git_lfs.app import GIT_LFS_CONTENT_TYPE, GIT_LFS_PROTO_PAT from vcsserver.echo_stub import remote_wsgi as remote_wsgi_stub @@ -58,7 +72,7 @@ except ImportError: SubversionFactory = None SvnRemote = None -log = logging.getLogger(__name__) + def _is_request_chunked(environ):