Merge ~mateus-morais/ubuntu/+source/nvme-stas:nvme-stas-s390x-autopkgtest-failure into ubuntu/+source/nvme-stas:ubuntu/devel

Proposed by Mateus Rodrigues de Morais
Status: Merged
Merge reported by: Mateus Rodrigues de Morais
Merged at revision: 62ae9d566ed18a8b068a5bd9ee6ca33132cd7d23
Proposed branch: ~mateus-morais/ubuntu/+source/nvme-stas:nvme-stas-s390x-autopkgtest-failure
Merge into: ubuntu/+source/nvme-stas:ubuntu/devel
Diff against target: 112 lines (+80/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/1000-iputil-fix-byte-ordering.patch (+70/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Benjamin Drung (community) Approve
Review via email: mp+450606@code.launchpad.net

Description of the change

Fixes LP: #2026878.

On staslib/iputil.py, all byte-related operations were hardcoded as byteorder='little'. Since s390x is a big-endian architecture, the iputil unit tests were failing and, most likely, iputil itself was not working as expected on this platform.

This merge proposal changes the way byteorder is handled by replacing 'little' with sys.byteorder.

A PPA build is available at [1]. The s390x autopkgtest is now passing, as reported in [2].

[1] https://launchpad.net/~mateus-morais/+archive/ubuntu/nvme-stas-s390x-fix
[2] https://autopkgtest.ubuntu.com/results/autopkgtest-mantic-mateus-morais-nvme-stas-s390x-fix/mantic/s390x/n/nvme-stas/20230904_164958_d28c9@/log.gz

To post a comment you must log in.
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thanks. I took your patch, converted it to a "gbp pq" one and uploaded the fix to Debian unstable as 2.2.2-2.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 9320662..0145627 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1nvme-stas (2.2.2-1ubuntu1) mantic; urgency=medium
2
3 * d/p/1000-iputil-fix-byte-ordering.patch: made byteorder architecture-aware
4 in order to fix s390x autopkgtest failures. (LP: #2026878)
5
6 -- Mateus Rodrigues de Morais <mateus.morais@canonical.com> Mon, 04 Sep 2023 11:33:08 -0300
7
1nvme-stas (2.2.2-1) sid; urgency=medium8nvme-stas (2.2.2-1) sid; urgency=medium
29
3 * Uploading to sid.10 * Uploading to sid.
diff --git a/debian/control b/debian/control
index c26dae6..782f6b3 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
1Source: nvme-stas1Source: nvme-stas
2Section: net2Section: net
3Priority: optional3Priority: optional
4Maintainer: Daniel Baumann <daniel.baumann@progress-linux.org>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Daniel Baumann <daniel.baumann@progress-linux.org>
5Uploaders:6Uploaders:
6 Benjamin Drung <bdrung@debian.org>,7 Benjamin Drung <bdrung@debian.org>,
7Build-Depends:8Build-Depends:
diff --git a/debian/patches/1000-iputil-fix-byte-ordering.patch b/debian/patches/1000-iputil-fix-byte-ordering.patch
8new file mode 1006449new file mode 100644
index 0000000..a7aaeff
--- /dev/null
+++ b/debian/patches/1000-iputil-fix-byte-ordering.patch
@@ -0,0 +1,70 @@
1Description: Fix byte ordering in iputil operations
2 Previously, the byte ordering on all byte array operations in iputil were
3 hard-coded to 'little'. This patch makes the byteorder parameter arch-aware
4 by using sys.byteorder instead.
5Author: Mateus Rodrigues de Morais <mateus.morais@canonical.com>
6Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nvme-stas/+bug/2026878
7Last-Update: 2023-09-04
8---
9This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
10Index: nvme-stas-gu/staslib/iputil.py
11===================================================================
12--- nvme-stas-gu.orig/staslib/iputil.py 2023-09-04 11:01:16.238467138 -0300
13+++ nvme-stas-gu/staslib/iputil.py 2023-09-04 11:18:14.286867008 -0300
14@@ -8,6 +8,7 @@
15
16 '''A collection of IP address and network interface utilities'''
17
18+import sys
19 import socket
20 import logging
21 import ipaddress
22@@ -27,14 +28,14 @@
23 GETADDRCMD = (
24 # BEGIN: struct nlmsghdr
25 b'\0' * 4 # nlmsg_len (placeholder - actual length calculated below)
26- + (RTM_GETADDR).to_bytes(2, byteorder='little', signed=False) # nlmsg_type
27- + (NLM_F_REQUEST | NLM_F_ROOT).to_bytes(2, byteorder='little', signed=False) # nlmsg_flags
28+ + (RTM_GETADDR).to_bytes(2, byteorder=sys.byteorder, signed=False) # nlmsg_type
29+ + (NLM_F_REQUEST | NLM_F_ROOT).to_bytes(2, byteorder=sys.byteorder, signed=False) # nlmsg_flags
30 + b'\0' * 2 # nlmsg_seq
31 + b'\0' * 2 # nlmsg_pid
32 # END: struct nlmsghdr
33 + b'\0' * 8 # struct ifaddrmsg
34 )
35-GETADDRCMD = len(GETADDRCMD).to_bytes(4, byteorder='little') + GETADDRCMD[4:] # nlmsg_len
36+GETADDRCMD = len(GETADDRCMD).to_bytes(4, byteorder=sys.byteorder) + GETADDRCMD[4:] # nlmsg_len
37
38
39 # ******************************************************************************
40@@ -85,25 +86,25 @@
41 if nlmsg_idx >= len(nlmsg):
42 nlmsg += sock.recv(8192)
43
44- nlmsg_type = int.from_bytes(nlmsg[nlmsg_idx + 4 : nlmsg_idx + 6], byteorder='little', signed=False)
45+ nlmsg_type = int.from_bytes(nlmsg[nlmsg_idx + 4 : nlmsg_idx + 6], byteorder=sys.byteorder, signed=False)
46 if nlmsg_type == NLMSG_DONE:
47 break
48
49 if nlmsg_type != RTM_NEWADDR:
50 break
51
52- nlmsg_len = int.from_bytes(nlmsg[nlmsg_idx : nlmsg_idx + 4], byteorder='little', signed=False)
53+ nlmsg_len = int.from_bytes(nlmsg[nlmsg_idx : nlmsg_idx + 4], byteorder=sys.byteorder, signed=False)
54 if nlmsg_len % 4: # Is msg length not a multiple of 4?
55 break
56
57 ifaddrmsg_indx = nlmsg_idx + NLMSGHDR_SZ
58 ifa_family = nlmsg[ifaddrmsg_indx]
59- ifa_index = int.from_bytes(nlmsg[ifaddrmsg_indx + 4 : ifaddrmsg_indx + 8], byteorder='little', signed=False)
60+ ifa_index = int.from_bytes(nlmsg[ifaddrmsg_indx + 4 : ifaddrmsg_indx + 8], byteorder=sys.byteorder, signed=False)
61
62 rtattr_indx = ifaddrmsg_indx + IFADDRMSG_SZ
63 while rtattr_indx < (nlmsg_idx + nlmsg_len):
64- rta_len = int.from_bytes(nlmsg[rtattr_indx : rtattr_indx + 2], byteorder='little', signed=False)
65- rta_type = int.from_bytes(nlmsg[rtattr_indx + 2 : rtattr_indx + 4], byteorder='little', signed=False)
66+ rta_len = int.from_bytes(nlmsg[rtattr_indx : rtattr_indx + 2], byteorder=sys.byteorder, signed=False)
67+ rta_type = int.from_bytes(nlmsg[rtattr_indx + 2 : rtattr_indx + 4], byteorder=sys.byteorder, signed=False)
68 if rta_type == IFLA_ADDRESS:
69 data = nlmsg[rtattr_indx + RTATTR_SZ : rtattr_indx + rta_len]
70 if _data_matches_ip(ifa_family, data, src_addr):
diff --git a/debian/patches/series b/debian/patches/series
0new file mode 10064471new file mode 100644
index 0000000..245d0d2
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
11000-iputil-fix-byte-ordering.patch

Subscribers

People subscribed via source and target branches