[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH f17-branch 4/5] fix text mode KeyError crash (#804483)



anaconda didn't know how to deal with LANG=C. So if we have LANG=C, just
treat it like we had no LANG set: reset to DEFAULT_LANG.

Just to be sure, use TTYReset=yes in anaconda.service, which will make
systemd reset the terminal to sane (and unicode-ready) settings.

Finally, emit the magic control sequence to set UTF-8 output, which fixes
the line-drawing characters in text-mode virtual terminals.
---
 anaconda                      |    5 +++++
 data/systemd/anaconda.service |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/anaconda b/anaconda
index 4fcc6b8..ae23d4f 100755
--- a/anaconda
+++ b/anaconda
@@ -643,6 +643,11 @@ if __name__ == "__main__":
     iutil.execWithRedirect("localedef",
                            ["-i", deflang, "-f", defcode, DEFAULT_LANG])
 
+    # to set UTF8 mode on the terminal, we need LANG to be set usefully
+    if os.environ.get("LANG", "C") == "C":
+        os.environ['LANG'] = DEFAULT_LANG
+    print "\033%G" # UTF8 power go!
+
     import gettext
     _ = lambda x: gettext.ldgettext("anaconda", x)
 
diff --git a/data/systemd/anaconda.service b/data/systemd/anaconda.service
index 8e853aa..45061cc 100644
--- a/data/systemd/anaconda.service
+++ b/data/systemd/anaconda.service
@@ -4,9 +4,10 @@ Wants=instperf.service rsyslog.service udev-settle.service NetworkManager.servic
 After=instperf.service rsyslog.service udev-settle.service NetworkManager.service
 
 [Service]
-Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin PYTHONPATH=/tmp/updates TERM=linux
+Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin PYTHONPATH=/tmp/updates
 Type=oneshot
 WorkingDirectory=/root
 ExecStart=/usr/sbin/anaconda
 StandardInput=tty-force
+TTYReset=yes
 TimeoutSec=0
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]