Merge ~sergiodj/ubuntu/+source/gvm-libs:fix-ftbfs-uninitialized into ubuntu/+source/gvm-libs:ubuntu/devel

Proposed by Sergio Durigan Junior
Status: Merged
Merged at revision: dd69f2fb35bc6e5aaf38d916854bf80424d5af60
Proposed branch: ~sergiodj/ubuntu/+source/gvm-libs:fix-ftbfs-uninitialized
Merge into: ubuntu/+source/gvm-libs:ubuntu/devel
Diff against target: 73 lines (+39/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/Fix-FTBFS-uninitialized-var-GCC-12.patch (+29/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Canonical Server Reporter Pending
Review via email: mp+435217@code.launchpad.net

Description of the change

This MP fixes the FTBFS that's currently affecting gvm-libs.

The problem is simple: GCC 12 is more strict when checking for uninitialized variables, and the following error was caught when compiling the package:

In function ‘ip_islocalhost’,
    inlined from ‘gvm_routethrough’ at ./base/networking.c:1032:11:
./base/networking.c:863:22: error: ‘addr6.__in6_u.__u6_addr32[3]’ may be used uninitialized [-Werror=maybe-uninitialized]
./base/networking.c: In function ‘gvm_routethrough’:
./base/networking.c:790:19: note: ‘addr6.__in6_u.__u6_addr32[3]’ was declared here
...

https://launchpadlibrarian.net/643052273/buildlog_ubuntu-lunar-amd64.gvm-libs_22.4.1-2_BUILDING.txt.gz

To fix it, I'm initializing "addr6" with IN6ADDR_ANY_INIT, which is a convenience macro that means ::/0. If you look at the code, you'll notice that it is unlikely that "addr6" is ever uninitialized, but it's better to be safe here.

I submitted this fix to upstream as well: https://github.com/greenbone/gvm-libs/pull/728

There's a PPA with the proposed changes here:

https://launchpad.net/~sergiodj/+archive/ubuntu/gvm-libs/+packages

The package doesn't have autopkgtests.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Can you include an explanation (in the patch or bug report is fine) as to why it's initialized to IN6ADDR_ANY_INIT versus 0 or -1 or some other value?

review: Needs Information
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Done; comment added in the patch. Let me know what you think.

Thanks.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, looks great.

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Friday, January 06 2023, Bryce Harrington wrote:

> Thanks, looks great.

Thanks Bryce.

Uploaded:

$ dput gvm-libs_22.4.1-2ubuntu1_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/gvm-libs/gvm-libs_22.4.1-2ubuntu1_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/gvm-libs/gvm-libs_22.4.1-2ubuntu1.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading gvm-libs_22.4.1-2ubuntu1.dsc: done.
  Uploading gvm-libs_22.4.1-2ubuntu1.debian.tar.xz: done.
  Uploading gvm-libs_22.4.1-2ubuntu1_source.buildinfo: done.
  Uploading gvm-libs_22.4.1-2ubuntu1_source.changes: done.
Successfully uploaded packages.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

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 4d658fd..c797658 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+gvm-libs (22.4.1-2ubuntu1) lunar; urgency=medium
7+
8+ * d/p/Fix-FTBFS-uninitialized-var-GCC-12.patch: Fix FTBFS due to
9+ uninitialized variable. (LP: #2002022)
10+
11+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Thu, 05 Jan 2023 13:35:58 -0500
12+
13 gvm-libs (22.4.1-2) unstable; urgency=medium
14
15 * Fix build on 32 bit arch
16diff --git a/debian/control b/debian/control
17index 67a95db..a19cf3f 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,7 +1,8 @@
21 Source: gvm-libs
22 Section: libs
23 Priority: optional
24-Maintainer: Debian Security Tools <team+pkg-security@tracker.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Debian Security Tools <team+pkg-security@tracker.debian.org>
27 Uploaders: Sophie Brun <sophie@offensive-security.com>
28 Build-Depends: debhelper-compat (= 13),
29 cmake,
30diff --git a/debian/patches/Fix-FTBFS-uninitialized-var-GCC-12.patch b/debian/patches/Fix-FTBFS-uninitialized-var-GCC-12.patch
31new file mode 100644
32index 0000000..7ea0d0e
33--- /dev/null
34+++ b/debian/patches/Fix-FTBFS-uninitialized-var-GCC-12.patch
35@@ -0,0 +1,29 @@
36+From: Sergio Durigan Junior <sergio.durigan@canonical.com>
37+Date: Wed, 4 Jan 2023 22:28:43 -0500
38+Subject: Fix FTBFS due to uninitialized variable on GCC 12
39+
40+"addr6" is being initialized as IN6ADDR_ANY_INIT (instead of 0 or -1)
41+because, being a structure, we need to initialize all of its fields.
42+IN6ADDR_ANY_INIT is a macro that means "::/0", which is good enough
43+for an initial value here (especially because "addr6" will be
44+reassigned later on in the function).
45+
46+Forwarded: yes, https://github.com/greenbone/gvm-libs/pull/728
47+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gvm-libs/+bug/2002022
48+---
49+ base/networking.c | 2 +-
50+ 1 file changed, 1 insertion(+), 1 deletion(-)
51+
52+diff --git a/base/networking.c b/base/networking.c
53+index 1d1d7a1..7a1170c 100644
54+--- a/base/networking.c
55++++ b/base/networking.c
56+@@ -787,7 +787,7 @@ ip_islocalhost (struct sockaddr_storage *storage)
57+ {
58+ struct in_addr addr;
59+ struct in_addr *addr_p;
60+- struct in6_addr addr6;
61++ struct in6_addr addr6 = IN6ADDR_ANY_INIT;
62+ struct in6_addr *addr6_p;
63+ struct sockaddr_in *sin_p;
64+ struct sockaddr_in6 *sin6_p;
65diff --git a/debian/patches/series b/debian/patches/series
66index 61607cd..ef8e5f2 100644
67--- a/debian/patches/series
68+++ b/debian/patches/series
69@@ -1,3 +1,4 @@
70 disable-networking-test.patch
71 Fix-test-failure-on-ipv6-only-build-daemons.patch
72 Fix-build-with-gpgme-1.18.0-2.patch
73+Fix-FTBFS-uninitialized-var-GCC-12.patch

Subscribers

People subscribed via source and target branches