Merge ~liushuyu-011/ubuntu/+source/rust-glib-sys:ubuntu/devel into ubuntu/+source/rust-glib-sys:ubuntu/devel

Proposed by Zixing Liu
Status: Merged
Merged at revision: b153bb28022d568ceb5bee169e395b0ed74a5a87
Proposed branch: ~liushuyu-011/ubuntu/+source/rust-glib-sys:ubuntu/devel
Merge into: ubuntu/+source/rust-glib-sys:ubuntu/devel
Diff against target: 104 lines (+78/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/add-missing-headers-definitions.patch (+32/-0)
debian/patches/gir-type-size.patch (+35/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
Steve Langasek (community) Approve
Review via email: mp+464244@code.launchpad.net

Description of the change

This MP fixes the autopkgtest failure with rust-glib-sys due to mismatching definitions in the GIR data and the actual C headers.

The padding fields are removed from the size calculation to workaround this issue.

To post a comment you must log in.
Revision history for this message
Zixing Liu (liushuyu-011) wrote :
Revision history for this message
Dan Bungert (dbungert) :
Revision history for this message
Zixing Liu (liushuyu-011) wrote :

Done. Addressed comments.

Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7403430..75beaa9 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+rust-glib-sys (0.19.0-1ubuntu1) noble; urgency=medium
7+
8+ * debian/patches/add-missing-headers-definitions.patch: Add missing
9+ glib headers to the tests. (LP: #2061202).
10+ * debian/patches/gir-type-size.patch: Add a patch to fix GIR type size
11+ comparison. (LP: #2061202).
12+
13+ -- Zixing Liu <zixing.liu@canonical.com> Fri, 12 Apr 2024 19:27:41 -0600
14+
15 rust-glib-sys (0.19.0-1build1) noble; urgency=medium
16
17 * No-change rebuild for CVE-2024-3094
18diff --git a/debian/patches/add-missing-headers-definitions.patch b/debian/patches/add-missing-headers-definitions.patch
19new file mode 100644
20index 0000000..8ff6c0f
21--- /dev/null
22+++ b/debian/patches/add-missing-headers-definitions.patch
23@@ -0,0 +1,32 @@
24+Description: Add missing glib headers and platform defines to the tests
25+ This also includes adding macros and constants that present in the
26+ GIR data but not present in C headers on certain platforms.
27+Author: Zixing Liu <zixing.liu@canonical.com>
28+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/rust-glib-sys/+bug/2061202
29+Forwarded: no
30+Last-Update: 2024-04-12
31+---
32+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
33+--- rust-glib-sys-0.19.0.orig/tests/manual.h
34++++ rust-glib-sys-0.19.0/tests/manual.h
35+@@ -2,6 +2,20 @@
36+
37+ #include <glib.h>
38+ #include <glib-object.h>
39++#include <glib-unix.h>
40++
41++#ifndef G_TRACE_CURRENT_TIME
42++#define G_TRACE_CURRENT_TIME 0
43++#endif
44++
45++#ifndef G_PLATFORM_WIN32
46++typedef enum
47++{
48++ G_WIN32_OS_ANY,
49++ G_WIN32_OS_WORKSTATION,
50++ G_WIN32_OS_SERVER,
51++} GWin32OSType;
52++#endif
53+
54+ // included in Gir on all platforms even though it is only present on windows
55+ #ifndef G_WIN32_MSG_HANDLE
56diff --git a/debian/patches/gir-type-size.patch b/debian/patches/gir-type-size.patch
57new file mode 100644
58index 0000000..7548a6e
59--- /dev/null
60+++ b/debian/patches/gir-type-size.patch
61@@ -0,0 +1,35 @@
62+Description: Add a patch to fix GIR type size comparison
63+ This adjust the structure sizes so that the sizes match the GIR
64+ data. In gthread.h file, the types GStaticRWLock, GStaticMutex,
65+ GStaticRecMutex have padding fields for backward-compatibility
66+ purposes (mostly for memory layout/ABI stability).
67+ Those padding fields are not present in the GIR data since FFI
68+ calls from other languages do not need to know the padding fields
69+ (since GLib internals do not read those fields).
70+ However, since the size is part of the tests, we still have to
71+ adjust the C result so that it matches the expected record size from
72+ GIR data.
73+Author: Zixing Liu <zixing.liu@canonical.com>
74+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/rust-glib-sys/+bug/2061202
75+Forwarded: no
76+Last-Update: 2024-04-12
77+---
78+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
79+Index: rust-glib-sys/tests/layout.c
80+===================================================================
81+--- rust-glib-sys.orig/tests/layout.c
82++++ rust-glib-sys/tests/layout.c
83+@@ -83,10 +83,10 @@ int main() {
84+ printf("%s;%zu;%zu\n", "GSourceFuncs", sizeof(GSourceFuncs), alignof(GSourceFuncs));
85+ printf("%s;%zu;%zu\n", "GSpawnError", sizeof(GSpawnError), alignof(GSpawnError));
86+ printf("%s;%zu;%zu\n", "GSpawnFlags", sizeof(GSpawnFlags), alignof(GSpawnFlags));
87+- printf("%s;%zu;%zu\n", "GStaticMutex", sizeof(GStaticMutex), alignof(GStaticMutex));
88++ printf("%s;%zu;%zu\n", "GStaticMutex", sizeof(GMutex), alignof(GStaticMutex));
89+ printf("%s;%zu;%zu\n", "GStaticPrivate", sizeof(GStaticPrivate), alignof(GStaticPrivate));
90+- printf("%s;%zu;%zu\n", "GStaticRWLock", sizeof(GStaticRWLock), alignof(GStaticRWLock));
91+- printf("%s;%zu;%zu\n", "GStaticRecMutex", sizeof(GStaticRecMutex), alignof(GStaticRecMutex));
92++ printf("%s;%zu;%zu\n", "GStaticRWLock", sizeof(GStaticRWLock) - sizeof(pthread_mutex_t), alignof(GStaticRWLock));
93++ printf("%s;%zu;%zu\n", "GStaticRecMutex", sizeof(GStaticRecMutex) - sizeof(pthread_mutex_t) - sizeof(gdouble), alignof(GStaticRecMutex));
94+ printf("%s;%zu;%zu\n", "GString", sizeof(GString), alignof(GString));
95+ printf("%s;%zu;%zu\n", "GStrv", sizeof(GStrv), alignof(GStrv));
96+ printf("%s;%zu;%zu\n", "GTestConfig", sizeof(GTestConfig), alignof(GTestConfig));
97diff --git a/debian/patches/series b/debian/patches/series
98new file mode 100644
99index 0000000..19ffd4f
100--- /dev/null
101+++ b/debian/patches/series
102@@ -0,0 +1,2 @@
103+add-missing-headers-definitions.patch
104+gir-type-size.patch

Subscribers

People subscribed via source and target branches

to all changes: