[f21-branch][master][PATCH 2/2] sgallagh: force defaultencoding to utf-8 on live (#1169019)

Adam Williamson awilliam at redhat.com
Tue Dec 2 06:33:17 UTC 2014


On Mon, 2014-12-01 at 20:32 -0800, Adam Williamson wrote:
> This has been done via pyanaconda/sitecustomize.py for non-live
> since Fedora 13, per #539904, commit 42a0227. However, that hack
> never worked for the live environment. This hack is about
> equally hacky, but works for live as well. This avoids crashes
> when we get unicode objects from pyparted and try to encode
> them. Written by Stephen Gallagher, he and I have tested that
> it resolves the crashes seen in F21 RC1 without breaking
> translations.

This is the result of sgallagh and I poking at #1169019 for quite a
while. We confirmed the crashes only happen on live, not on DVD/netinst
(you can reproduce the crash case reliably by running an RC1 install in
Russian; from a live image it will always crash, sooner or later,
depending on how soon you run into a translated size string).

I noticed that anaconda already has a hack to set python's default
encoding to utf-8, and found that it seems to work in non-live
environments but not live ones. That hack is
https://www.redhat.com/archives/anaconda-devel-list/2010-March/msg00284.html , commit 42a0227. The point of the hack is to act as a kind of 'backstop' in these cases, where something somehow winds up trying to encode a unicode object without having anything else set which would cause the utf-8 encoding to be used.

sgallagh spotted that that hack only works so long as sitecustomize.py
is in /usr/lib/python2.7/site-packages , and that's only the case in the
non-live install environment, because it's put there in non-live image
generation but not live image generation. At the time it was committed
this was done in scripts/upd-instroot, these days it's in lorax
share/runtime-postinstall.tmpl .

Upshot being, the default encoding has stayed as 'ascii' in live images
all along - it has never been 'utf-8'. I've tested this in at least F14,
F18, F19, F20 and various F21 images (the hack came with a change which
logs the default encoding right at the top of anaconda.log, so it's
pretty easy to check).

sgallagh then came up with a different hack for setting the default
encoding which will work in the live environment (but doesn't set it for
anything besides anaconda, which might not be a good idea for the live
image), and that's what this is. We both tested that it resolves the
crashes without breaking translations.

There are other ways to come at the problem, but this at least seems to
work, and in a way that's not too disruptive, since it effectively
brings the live installer into line with the non-live.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net



More information about the anaconda-patches mailing list