nightly status checks could fail if any domains had non-ASCII characters

https://discourse.mailinabox.email/t/status-check-emails-empty-after-upgrading-to-v0-16/1082/3

A user on that thread suggests an alternate solution, adding `PYTHONIOENCODING=utf-8` to `/etc/environment`. Python docs say that affects stdin/out/err. But we also use these environment variables elsewhere to ensure that config files we read/write are opened with UTF8 too. Maybe all that can be simplified too.
This commit is contained in:
Joshua Tauberer 2016-02-13 11:51:06 -05:00
parent 4ed23f44e6
commit 8ea42847da
4 changed files with 13 additions and 4 deletions

View File

@ -8,6 +8,7 @@ In Development
* On multi-homed machines, Postfix now binds to the right network interface when sending outbound mail so that SPF checks on the receiving end will pass.
* Backup times were displayed with the wrong time zone.
* On low-usage systems, don't hold backups for quite so long by taking a full backup more often.
* Nightly status checks might fail if any domains had non-ASCII characters.
v0.16 (January 30, 2016)
------------------------

View File

@ -27,9 +27,9 @@ EXEC_AS_USER=root
# Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in
# Python may not be able to read/write files. Set also
# setup/start.sh (where the locale is also installed if not
# already present).
# already present) and management/daily_tasks.sh.
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

View File

@ -1,6 +1,14 @@
#!/bin/bash
# This script is run daily (at 3am each night).
# Set character encoding flags to ensure that any non-ASCII
# characters don't cause problems. See setup/start.sh and
# the management daemon startup script.
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
# Take a backup.
management/backup.py | management/email_administrator.py "Backup Status"

View File

@ -10,8 +10,8 @@ source setup/preflight.sh
# Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in
# the management daemon startup script.
# Python may not be able to read/write files. This is also
# in the management daemon startup script and the cron script.
if [ -z `locale -a | grep en_US.utf8` ]; then
# Generate locale if not exists