[lxc-devel] [lxc/lxc] e0e34b: Make lxc-start-ephemeral Python 3.2-compatible

GitHub noreply at github.com
Thu Jan 26 16:45:55 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: e0e34b7e93ab75a8a4d006ba8429f7fd63de1b93
      https://github.com/lxc/lxc/commit/e0e34b7e93ab75a8a4d006ba8429f7fd63de1b93
  Author: Colin Watson <cjwatson at ubuntu.com>
  Date:   2017-01-26 (Thu, 26 Jan 2017)

  Changed paths:
    M src/lxc/tools/lxc-start-ephemeral.in

  Log Message:
  -----------
  Make lxc-start-ephemeral Python 3.2-compatible

On Ubuntu 12.04 LTS with Python 3.2, `lxc-start-ephemeral` breaks as
follows:

    Traceback (most recent call last):
      File "/usr/bin/lxc-start-ephemeral", line 371, in attach_as_user
      File "/usr/lib/python3.2/subprocess.py", line 515, in check_output
      File "/usr/lib/python3.2/subprocess.py", line 732, in __init__
    LookupError: unknown encoding: ANSI_X3.4-1968

This is because `universal_newlines=True` causes `subprocess` to use
`io.TextIOWrapper`, and in versions of Python earlier than 3.3 that
fetched the preferred encoding using `locale.getpreferredencoding()`
rather than `locale.getpreferredencoding(False)`, thereby changing the
locale and causing codecs to be reloaded.  However, `attach_as_user`
runs inside the container and thus can't rely on having access to the
same Python standard library on disk.

The workaround is to decode by hand instead, avoiding the temporary
change of locale.

Signed-off-by: Colin Watson <cjwatson at ubuntu.com>


  Commit: 42dc0de4e35c9bfc8eaa1c7f9bf54aa3b7dbebdd
      https://github.com/lxc/lxc/commit/42dc0de4e35c9bfc8eaa1c7f9bf54aa3b7dbebdd
  Author: Stéphane Graber <stgraber at stgraber.org>
  Date:   2017-01-26 (Thu, 26 Jan 2017)

  Changed paths:
    M src/lxc/tools/lxc-start-ephemeral.in

  Log Message:
  -----------
  Merge pull request #1392 from cjwatson/start-ephemeral-python32

Make lxc-start-ephemeral Python 3.2-compatible


Compare: https://github.com/lxc/lxc/compare/4893a4315c55...42dc0de4e35c


More information about the lxc-devel mailing list