From 8da8d0d0b9d5ca95da3a7e14b8592e439f87f00c Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Mon, 25 Feb 2019 20:19:37 +0000 Subject: [PATCH] Fix build for GCC 9 Signed-off-by: Jonathan Dieter --- .gitignore | 1 + sources | 2 +- usbip-4.18.9-compare-actual-name.patch | 12 ------- usbip-4.20-fix-gcc9.patch | 47 ++++++++++++++++++++++++++ usbip.spec | 10 ++++-- 5 files changed, 56 insertions(+), 16 deletions(-) delete mode 100644 usbip-4.18.9-compare-actual-name.patch create mode 100644 usbip-4.20-fix-gcc9.patch diff --git a/.gitignore b/.gitignore index 5dc95b4..6fb7306 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /usbip-4.14.11.tar.xz /usbip-4.15.10.tar.xz /usbip-4.18.9.tar.xz +/usbip-4.20.12.tar.xz diff --git a/sources b/sources index 50e67c2..5ab810f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (usbip-4.18.9.tar.xz) = 722556e8dfd25822dfd1325c3b2053819751c997fb77515667f7ff3ec410d6229a42395ad745533aefa22a2df0cbc361fe608fe9dd082cedaeddba76f6fbc4d4 +SHA512 (usbip-4.20.12.tar.xz) = b94e4212d0bf7614e3a331dfc056ec7da38e5d6666db323bf2d20353b7293ec36ed954b41dd5792a7e2530cc5c3bb4710f8374ab58b9c40a9faee5d4c0bbbfb0 diff --git a/usbip-4.18.9-compare-actual-name.patch b/usbip-4.18.9-compare-actual-name.patch deleted file mode 100644 index 767fae3..0000000 --- a/usbip-4.18.9-compare-actual-name.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urb usbip-4.18.9a/libsrc/vhci_driver.c usbip-4.18.9b/libsrc/vhci_driver.c ---- usbip-4.18.9a/libsrc/vhci_driver.c 2018-09-19 20:41:37.000000000 +0000 -+++ usbip-4.18.9b/libsrc/vhci_driver.c 2018-09-20 10:11:10.843791788 +0000 -@@ -150,7 +150,7 @@ - - static int vhci_hcd_filter(const struct dirent *dirent) - { -- return strcmp(dirent->d_name, "vhci_hcd") >= 0; -+ return !strncmp(dirent->d_name, "vhci_hcd.", 9); - } - - static int get_ncontrollers(void) diff --git a/usbip-4.20-fix-gcc9.patch b/usbip-4.20-fix-gcc9.patch new file mode 100644 index 0000000..f7f98bb --- /dev/null +++ b/usbip-4.20-fix-gcc9.patch @@ -0,0 +1,47 @@ +diff -urb usbip-4.20.12a/libsrc/usbip_common.c usbip-4.20.12b/libsrc/usbip_common.c +--- usbip-4.20.12a/libsrc/usbip_common.c 2019-02-23 08:08:07.000000000 +0000 ++++ usbip-4.20.12b/libsrc/usbip_common.c 2019-02-25 19:56:16.829743800 +0000 +@@ -226,8 +226,8 @@ + path = udev_device_get_syspath(sdev); + name = udev_device_get_sysname(sdev); + +- strncpy(udev->path, path, SYSFS_PATH_MAX); +- strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE); ++ snprintf(udev->path, SYSFS_PATH_MAX, "%s", path); ++ snprintf(udev->busid, SYSFS_BUS_ID_SIZE, "%s", name); + + sscanf(name, "%u-%u", &busnum, &devnum); + udev->busnum = busnum; +diff -urb usbip-4.20.12a/libsrc/usbip_device_driver.c usbip-4.20.12b/libsrc/usbip_device_driver.c +--- usbip-4.20.12a/libsrc/usbip_device_driver.c 2019-02-23 08:08:07.000000000 +0000 ++++ usbip-4.20.12b/libsrc/usbip_device_driver.c 2019-02-25 19:55:08.329692079 +0000 +@@ -103,7 +103,7 @@ + copy_descr_attr16(dev, &descr, idProduct); + copy_descr_attr16(dev, &descr, bcdDevice); + +- strncpy(dev->path, path, SYSFS_PATH_MAX); ++ snprintf(dev->path, SYSFS_PATH_MAX, "%s", path); + + dev->speed = USB_SPEED_UNKNOWN; + speed = udev_device_get_sysattr_value(sdev, "current_speed"); +@@ -122,7 +122,7 @@ + dev->busnum = 0; + + name = udev_device_get_sysname(plat); +- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE); ++ snprintf(dev->busid, SYSFS_BUS_ID_SIZE, "%s", name); + return 0; + err: + fclose(fd); +diff -urb usbip-4.20.12a/src/usbip_network.h usbip-4.20.12b/src/usbip_network.h +--- usbip-4.20.12a/src/usbip_network.h 2019-02-23 08:08:07.000000000 +0000 ++++ usbip-4.20.12b/src/usbip_network.h 2019-02-25 20:17:11.216594529 +0000 +@@ -14,6 +14,8 @@ + + #include + ++#pragma GCC diagnostic ignored "-Waddress-of-packed-member" ++ + extern int usbip_port; + extern char *usbip_port_string; + void usbip_setup_port_number(char *arg); diff --git a/usbip.spec b/usbip.spec index 52c4fb1..32b51f3 100644 --- a/usbip.spec +++ b/usbip.spec @@ -3,8 +3,8 @@ Name: usbip License: GPLv2+ Summary: USB/IP user-space -Version: 4.18.9 -Release: 3%{?dist} +Version: 4.20.12 +Release: 1%{?dist} #Source: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%%{version}.tar.xz # In the interests of keeping the source rpm from being ridiculously large, # download the Linux kernel from above and run `extract_usbip.sh ` @@ -17,7 +17,7 @@ Source: usbip-%{version}.tar.xz Source1: usbip-server.service Source2: usbip-client.service Source99: extract_usbip.sh -Patch0: usbip-4.18.9-compare-actual-name.patch +Patch0: usbip-4.20-fix-gcc9.patch Requires: kmod(usbip-core.ko) Requires: kmod(usbip-host.ko) Requires: kmod(vhci-hcd.ko) @@ -87,6 +87,10 @@ install -pm 644 %{SOURCE2} %{buildroot}%{_unitdir} %{_libdir}/*.so %changelog +* Mon Feb 25 2019 Jonathan Dieter - 4.20.12-1 +- Update to 4.20.12 +- Fix build failure on GCC 9.0 + * Sun Feb 03 2019 Fedora Release Engineering - 4.18.9-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild