Package: libcloud
Version: 3.4.1-2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch

Dear Maintainer,

Since the move to upstream 3.4.1, a new test breaks autopkgtest on
big-endian architectures:

          chan.recv.side_effect = ['🤦'.encode('utf-32'), 'a', 'b']
  
          stdout = client._consume_stdout(chan).getvalue()
  > self.assertEqual('\x00\x00&\x01\x00ab', stdout)
  E AssertionError: '\x00\x00&\x01\x00ab' != '\x00\x00\x00\x01&ab'
  
  test/compute/test_ssh_client.py:563: AssertionError

In Ubuntu, the attached patch was applied to achieve the following:

  * Fix autopkgtest failure on s390x (big-endian) (LP: #1973158)
  * The bug also affects Debian as shown in this log:
  
https://ci.debian.net/data/autopkgtest/testing/s390x/libc/libcloud/21309362/log.gz


Thanks for considering the patch.


-- System Information:
Debian Release: bookworm/sid
  APT prefers jammy-updates
  APT policy: (500, 'jammy-updates'), (500, 'jammy-security'), (500, 'jammy')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-27-generic (SMP w/4 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru libcloud-3.4.1/debian/control libcloud-3.4.1/debian/control
--- libcloud-3.4.1/debian/control       2022-05-11 15:51:43.000000000 +0200
+++ libcloud-3.4.1/debian/control       2022-05-11 15:51:43.000000000 +0200
@@ -1,8 +1,7 @@
 Source: libcloud
 Section: python
 Priority: optional
-Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
-XSBC-Original-Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
+Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
 Uploaders:
  Soren Hansen <so...@ubuntu.com>,
  Hans-Christoph Steiner <h...@eds.org>,
diff -Nru 
libcloud-3.4.1/debian/patches/df060de6ea325cba2b6411780728705252543bc3.patch 
libcloud-3.4.1/debian/patches/df060de6ea325cba2b6411780728705252543bc3.patch
--- 
libcloud-3.4.1/debian/patches/df060de6ea325cba2b6411780728705252543bc3.patch    
    1970-01-01 01:00:00.000000000 +0100
+++ 
libcloud-3.4.1/debian/patches/df060de6ea325cba2b6411780728705252543bc3.patch    
    2022-05-11 15:51:43.000000000 +0200
@@ -0,0 +1,45 @@
+Description: test: fix test_ssh_client on big-endian architectures
+ The tests test_consume_*_chunk_contains_no_utf8_character are meant to
+ ensure support for non-UTF-8 characters. To do so, we use UTF-8
+ characters and compare their binary representation after being fed to
+ paramiko.
+ 
+ Unfortunately, UTF-32 is affected by endianness, resulting in failed
+ tests on big-endian architectures.
+ 
+ Fixed by checking the endianness and comparing the UTF-32 characters to
+ their respective binary representation.
+Author: Olivier Gayot <olivier.ga...@canonical.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1973158
+Forwarded: https://github.com/apache/libcloud/pull/1693
+Last-Update: 2022-05-12
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: libcloud-3.4.1/libcloud/test/compute/test_ssh_client.py
+===================================================================
+--- libcloud-3.4.1.orig/libcloud/test/compute/test_ssh_client.py       
2022-05-12 12:36:47.037706112 +0200
++++ libcloud-3.4.1/libcloud/test/compute/test_ssh_client.py    2022-05-12 
12:37:34.529747766 +0200
+@@ -560,7 +560,10 @@
+         chan.recv.side_effect = ['🤦'.encode('utf-32'), 'a', 'b']
+ 
+         stdout = client._consume_stdout(chan).getvalue()
+-        self.assertEqual('\x00\x00&\x01\x00ab', stdout)
++        if sys.byteorder == "little":
++            self.assertEqual("\x00\x00&\x01\x00ab", stdout)
++        else:
++            self.assertEqual("\x00\x00\x00\x01&ab", stdout)
+         self.assertEqual(len(stdout), 7)
+ 
+     def test_consume_stderr_chunk_contains_non_utf8_character(self):
+@@ -574,7 +577,10 @@
+         chan.recv_stderr.side_effect = ['🤦'.encode('utf-32'), 'a', 'b']
+ 
+         stderr = client._consume_stderr(chan).getvalue()
+-        self.assertEqual('\x00\x00&\x01\x00ab', stderr)
++        if sys.byteorder == "little":
++            self.assertEqual("\x00\x00&\x01\x00ab", stderr)
++        else:
++            self.assertEqual("\x00\x00\x00\x01&ab", stderr)
+         self.assertEqual(len(stderr), 7)
+ 
+     def test_keep_alive_and_compression(self):
diff -Nru libcloud-3.4.1/debian/patches/series 
libcloud-3.4.1/debian/patches/series
--- libcloud-3.4.1/debian/patches/series        2022-05-11 15:51:43.000000000 
+0200
+++ libcloud-3.4.1/debian/patches/series        2022-05-11 15:51:43.000000000 
+0200
@@ -3,3 +3,4 @@
 43b71091ebd159570302b695f0a244f4d0a7e497.patch
 83bd562337abdda4b1ba6706999b13aa358bdd28.patch
 disable-online-test.patch
+df060de6ea325cba2b6411780728705252543bc3.patch

Reply via email to