@Josep: that bug report is unrelated. (Although it touches the same
cron_default_mail_charset code.)
This issue is that:
(A) The cron daemon starts with no LANG (LANG=C)
(B) The processes start with the lang environment from /etc/default/locale
(LANG=en_US.UTF-8)
Now the processes will print stuff like:
$ rm abc
rm: cannot remove ‘abc’ <-- note the non-ascii characters, because it has
LANG=...UTF-8
But the mail with that error, will use:
Content-Type: text/plain; charset=ANSI_X3.4-1968
instead of:
Content-Type: text/plain; charset=UTF-8
That causes mail clients to get UTF-8 while it is told that it gets
ASCII, resulting in a crappy reading experience.
A working fix for me is to add the LANG variable to /etc/init/cron.conf so the
cron process gets
# echo 'env LANG=en_US.UTF-8' > /etc/init/cron.override
# stop cron; start cron
(Or alternately, the CONTENT_TYPE= setting in crontab as suggested in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410057 )
I believe this bug got introduced by using upstart instead of the init script:
- the processes get the environment from /etc/pam.d/cron (LANG=en_US.UTF-8)
- cron gets the environment from /etc/default/locale BUT ONLY if it was started
from /etc/init.d/cron. the upstart script does not load /etc/environment nor
/etc/default/locale.
.. so .. that should probably mean that this is a ubuntu/cron bug, not
an ubuntu/+source/cron bug.
And it first starts showing in Trusty because the tools use fancier
tokens when unicode is available:
ubuntu precise:
# locale | grep ^LANG=; rm /tmp/abc
LANG=en_US.UTF-8
rm: cannot remove `/tmp/abc': No such file or directory
ubuntu trusty
# locale | grep ^LANG=; rm /tmp/abc
LANG=en_US.UTF-8
rm: cannot remove ‘/tmp/abc’: No such file or directory <-- see the fancy
quotes here
Cheers,
Walter Doekes
OSSO B.V.
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
# dpkg -l cron | grep ^ii
ii cron 3.0pl1-124ubuntu2
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/140896
Title:
Cron does send mails with wrong charset
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/140896/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs