D8039: chg: force-set LC_CTYPE on server start to actual value from the environment
Yuya Nishihara
yuya at tcha.org
Thu Jan 30 09:52:56 EST 2020
> - # Python3 has some logic to "coerce" the C locale to a UTF-8 capable
> - # one, and it sets LC_CTYPE in the environment to C.UTF-8 if none of
> - # 'LC_CTYPE', 'LC_ALL' or 'LANG' are set (to any value). This can be
> - # disabled with PYTHONCOERCECLOCALE=0 in the environment.
> - #
> - # When fromui is called via _inithashstate, python has already set
> - # this, so that's in the environment right when we start up the hg
> - # process. Then chg will call us and tell us to set the environment to
> - # the one it has; this might NOT have LC_CTYPE, so we'll need to
> - # carry-forward the LC_CTYPE that was coerced in these situations.
> - #
> - # If this is not handled, we will fail config+env validation and fail
> - # to start chg. If this is just ignored instead of carried forward, we
> - # may have different behavior between chg and non-chg.
Can you move and rephrase this comment?
> @@ -730,6 +696,11 @@
> # environ cleaner.
> if b'CHGINTERNALMARK' in encoding.environ:
> del encoding.environ[b'CHGINTERNALMARK']
> + if b'CHGORIG_LC_CTYPE' in encoding.environ:
> + encoding.environ[b'LC_CTYPE'] = encoding.environ[b'CHGORIG_LC_CTYPE']
> + del encoding.environ[b'CHGORIG_LC_CTYPE']
> + elif b'CHG_CLEAR_LC_CTYPE' in encoding.environ:
> + del encoding.environ[b'LC_CTYPE']
would crash if `LC_CTYPE` wasn't set, and probably needs to delete
`CHG_CLEAR_LC_CTYPE`.
> diff --git a/hg b/hg
> --- a/hg
> +++ b/hg
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
Unrelated change.
More information about the Mercurial-devel
mailing list