diff -Nru fwupdate-9/debian/changelog fwupdate-9/debian/changelog --- fwupdate-9/debian/changelog 2017-03-08 01:03:07.000000000 +0000 +++ fwupdate-9/debian/changelog 2017-08-04 21:11:35.000000000 +0000 @@ -1,3 +1,10 @@ +fwupdate (9-2) unstable; urgency=medium + + * Add patch to fix compilation with gcc-7. (Closes: #853409) + * Update build depends to efivar-31 to fix compilation with gcc-7 + + -- Mario Limonciello Fri, 04 Aug 2017 16:11:35 -0500 + fwupdate (9-1) unstable; urgency=medium * New upstream version (9) diff -Nru fwupdate-9/debian/control fwupdate-9/debian/control --- fwupdate-9/debian/control 2017-03-08 01:01:41.000000000 +0000 +++ fwupdate-9/debian/control 2017-08-04 21:05:18.000000000 +0000 @@ -2,7 +2,7 @@ Priority: optional Maintainer: Debian EFI Uploaders: Daniel Jared Dominguez , Steve McIntyre <93sam@debian.org>, Mario Limonciello -Build-Depends: debhelper (>= 9.0.0), pkg-config, libpopt-dev, libefivar-dev (>= 30), libefiboot-dev (>= 30), gnu-efi (>= 3.0.2), elfutils, libsmbios-dev [amd64 i386] +Build-Depends: debhelper (>= 9.0.0), pkg-config, libpopt-dev, libefivar-dev (>= 31), libefiboot-dev (>= 31), gnu-efi (>= 3.0.2), elfutils, libsmbios-dev [amd64 i386] Standards-Version: 3.9.8 Section: libs Homepage: https://github.com/rhinstaller/fwupdate diff -Nru fwupdate-9/debian/patches/0001-Fix-sprintf-formatting-for-Boot.patch fwupdate-9/debian/patches/0001-Fix-sprintf-formatting-for-Boot.patch --- fwupdate-9/debian/patches/0001-Fix-sprintf-formatting-for-Boot.patch 1970-01-01 00:00:00.000000000 +0000 +++ fwupdate-9/debian/patches/0001-Fix-sprintf-formatting-for-Boot.patch 2017-08-04 21:04:39.000000000 +0000 @@ -0,0 +1,65 @@ +From cd8f7d79f84155d1dfbff3bb169558a8b06fb719 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 19 May 2017 16:39:56 -0400 +Subject: [PATCH] Fix sprintf formatting for Boot####. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If you give it enough compiler flags, gcc believes the following: +----------------------- + libfwup.c: In function ‘set_up_boot_next’: + libfwup.c:1049:27: error: ‘__builtin___sprintf_chk’ may write a terminating nul past the end of the destination [-Werror=format-overflow=] + sprintf(boot_next_name, "Boot%04X", boot_next); + ^~~~~~~~~~ + In file included from /usr/include/stdio.h:939:0, + from libfwup.c:17: + /usr/include/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 9 and 10 bytes into a destination of size 9 + return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + __bos (__s), __fmt, __va_arg_pack ()); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + cc1: all warnings being treated as errors + make[1]: *** [Makefile:70: libfwup.o] Error 1 + make[1]: Leaving directory '/home/pjones/devel/rhel/fwupdate/fwupdate-9/linux' + make: *** [Makefile:10: all] Error 2 +----------------------- + +The code in question is: +----------------------- + if (boot_next >= 0x10000) { + efi_error("no free boot variables!"); + goto out; + } + + sprintf(boot_next_name, "Boot%04X", boot_next); +----------------------- + +It really should know it can't be a higher value than 0xffff. Even +so, while it's not true that this can happen, since we never get to that +code if boot_next is > 0xffff, the compiler can't figure that out, so +it's complaining about an int being crammed into 4 bytes of hex. + +So this patch just tells it the maximum value is 0xffff. + +Signed-off-by: Peter Jones +--- + linux/libfwup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux/libfwup.c b/linux/libfwup.c +index 929c106..1b9b72a 100644 +--- a/linux/libfwup.c ++++ b/linux/libfwup.c +@@ -1046,7 +1046,7 @@ do_next: + goto out; + } + +- sprintf(boot_next_name, "Boot%04X", boot_next); ++ sprintf(boot_next_name, "Boot%04hX", boot_next & 0xffff); + rc = efi_set_variable(efi_guid_global, boot_next_name, opt, + opt_size, + EFI_VARIABLE_NON_VOLATILE | +-- +2.7.4 + diff -Nru fwupdate-9/debian/patches/series fwupdate-9/debian/patches/series --- fwupdate-9/debian/patches/series 2017-03-08 01:03:07.000000000 +0000 +++ fwupdate-9/debian/patches/series 2017-08-04 21:05:01.000000000 +0000 @@ -1 +1,2 @@ uninitialized_boot_next.patch +0001-Fix-sprintf-formatting-for-Boot.patch