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

Subscribers

People subscribed via source and target branches