summaryrefslogtreecommitdiffstats
path: root/debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:46 +0000
commit745738d66d01d7ddacafdde4f8c6851f03aefdad (patch)
tree9b01d045aa5646ed2dc1a874b5ce5c60fa871f44 /debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-745738d66d01d7ddacafdde4f8c6851f03aefdad.tar.xz
ansible-745738d66d01d7ddacafdde4f8c6851f03aefdad.zip
Adding debian version 7.7.0+dfsg-3.debian/7.7.0+dfsg-3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch')
-rw-r--r--debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch b/debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch
new file mode 100644
index 000000000..4c8e2926c
--- /dev/null
+++ b/debian/patches/0002-fix-libvirt-encoding-errors-on-windows-guests.patch
@@ -0,0 +1,35 @@
+From fb6123b5419dee8de0bd739383ee1c67ad596216 Mon Sep 17 00:00:00 2001
+From: Lee Garrett <lgarrett@rocketjump.eu>
+Date: Fri, 1 Sep 2023 14:35:15 +0200
+Subject: [PATCH 1/2] Fix encoding errors on Windows guests (fixes: #156)
+
+On Windows guests the default encoding will be set to whatever
+default legacy encoding, not utf-8. This issue isn't apparent on English locale
+Windows guests, as there the encodings (ISO-8859-1, utf-8) happen to coincide.
+
+However, on e.g. German Windows guests this will cause an encoding error when
+reading any output from there.
+
+This patch ensures that the proper encoding is set on every command.
+---
+ plugins/connection/libvirt_qemu.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/ansible_collections/community/libvirt/plugins/connection/libvirt_qemu.py
++++ b/ansible_collections/community/libvirt/plugins/connection/libvirt_qemu.py
+@@ -161,6 +161,10 @@
+ # prompt that will not occur
+ sudoable = False
+
++ # Make sure our first command is to set the console encoding to
++ # utf-8, this must be done via chcp to get utf-8 (65001)
++ cmd = ' '.join(["chcp.com", "65001", self._shell._SHELL_REDIRECT_ALLNULL, self._shell._SHELL_AND, cmd])
++
+ # Generate powershell commands
+ cmd_args_list = self._shell._encode_script(cmd, as_list=True, strict_mode=False, preserve_rc=False)
+
+--- /dev/null
++++ b/ansible_collections/community/libvirt/changelogs/fragments/156_fix_windows_encoding.yml
+@@ -0,0 +1,2 @@
++bugfixes:
++ - libvirt_qemu - fix encoding errors on Windows guests for non-ASCII return values (https://github.com/ansible-collections/community.libvirt/pull/157)