pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [pkgsrc-2019Q2] pkgsrc/devel/libusb1



Module Name:    pkgsrc
Committed By:   bsiegert
Date:           Sat Aug 10 12:32:34 UTC 2019

Modified Files:
        pkgsrc/devel/libusb1 [pkgsrc-2019Q2]: Makefile distinfo
Added Files:
        pkgsrc/devel/libusb1/patches [pkgsrc-2019Q2]: patch-ub

Log Message:
Pullup ticket #6027 - requested by maya
devel/libusb1: clang build fix

Revisions pulled up:
- devel/libusb1/Makefile                                        1.19
- devel/libusb1/distinfo                                        1.11
- devel/libusb1/patches/patch-ub                                1.1

---
   Module Name: pkgsrc
   Committed By:        maya
   Date:                Tue Aug  6 08:50:28 UTC 2019

   Modified Files:
        pkgsrc/devel/libusb1: Makefile distinfo
   Added Files:
        pkgsrc/devel/libusb1/patches: patch-ub

   Log Message:
   libusb1: patch some undefined behaviour, disable strict aliasing, change
   -O2 to -O1 when building with clang.

   This isn't in a separate hacks.mk file because I think that hides the
   problem too much, it's an issue with the code in the package, not with
   the compiler's choices.

   Fixes functionality when built with clang.

   >From Shingo Nishioka in PR pkg/54441.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.2.1 pkgsrc/devel/libusb1/Makefile
cvs rdiff -u -r1.10 -r1.10.2.1 pkgsrc/devel/libusb1/distinfo
cvs rdiff -u -r0 -r1.1.2.2 pkgsrc/devel/libusb1/patches/patch-ub

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/libusb1/Makefile
diff -u pkgsrc/devel/libusb1/Makefile:1.18 pkgsrc/devel/libusb1/Makefile:1.18.2.1
--- pkgsrc/devel/libusb1/Makefile:1.18  Sat Jun 22 11:30:11 2019
+++ pkgsrc/devel/libusb1/Makefile       Sat Aug 10 12:32:34 2019
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.18 2019/06/22 11:30:11 nia Exp $
+# $NetBSD: Makefile,v 1.18.2.1 2019/08/10 12:32:34 bsiegert Exp $
 
 DISTNAME=      libusb-1.0.22
 PKGNAME=       ${DISTNAME:S/libusb/libusb1/}
+PKGREVISION=   1
 CATEGORIES=    devel
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=libusb/}
 EXTRACT_SUFX=  .tar.bz2
@@ -20,6 +21,13 @@ USE_LIBTOOL= yes
 USE_TOOLS+=    pkg-config
 MAKE_JOBS_SAFE=            no
 
+.include "../../mk/compiler.mk"
+.if !empty(PKGSRC_COMPILER:Mclang)
+# Uses undefined behaviour
+BUILDLINK_TRANSFORM+=  opt:-O2:-O1
+CFLAGS+=               -fno-strict-aliasing
+.endif
+
 PKGCONFIG_OVERRIDE+=   libusb-1.0.pc.in
 
 # systemd dependency

Index: pkgsrc/devel/libusb1/distinfo
diff -u pkgsrc/devel/libusb1/distinfo:1.10 pkgsrc/devel/libusb1/distinfo:1.10.2.1
--- pkgsrc/devel/libusb1/distinfo:1.10  Fri Jun 21 16:58:23 2019
+++ pkgsrc/devel/libusb1/distinfo       Sat Aug 10 12:32:34 2019
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.10 2019/06/21 16:58:23 sjmulder Exp $
+$NetBSD: distinfo,v 1.10.2.1 2019/08/10 12:32:34 bsiegert Exp $
 
 SHA1 (libusb-1.0.22.tar.bz2) = 10116aa265aac4273a0c894faa089370262ec0dc
 RMD160 (libusb-1.0.22.tar.bz2) = 59b800abb0b4c088dbee950fa67bb31240b8a134
@@ -7,3 +7,4 @@ Size (libusb-1.0.22.tar.bz2) = 598833 by
 SHA1 (patch-configure) = 2776ff354ea8f17663a9a5330f6fe990af27d8fe
 SHA1 (patch-configure.ac) = 9344b3d6439348164410d1b2071cf14c3f388354
 SHA1 (patch-libusb_os_sunos__usb.c) = 4896e497d451487a09b3be9ad74f72595a441086
+SHA1 (patch-ub) = 14bffca93ec8445cbfccb613dfda92f652b0ceb0

Added files:

Index: pkgsrc/devel/libusb1/patches/patch-ub
diff -u /dev/null pkgsrc/devel/libusb1/patches/patch-ub:1.1.2.2
--- /dev/null   Sat Aug 10 12:32:34 2019
+++ pkgsrc/devel/libusb1/patches/patch-ub       Sat Aug 10 12:32:34 2019
@@ -0,0 +1,36 @@
+$NetBSD: patch-ub,v 1.1.2.2 2019/08/10 12:32:34 bsiegert Exp $
+
+Avoid undefined behaviour that breaks clang
+
+--- libusb/descriptor.c.orig   2019-08-02 09:59:25.784968424 +0900
++++ libusb/descriptor.c        2019-08-02 09:59:44.009134412 +0900
+@@ -54,7 +54,9 @@
+       for (cp = descriptor; *cp; cp++) {
+               switch (*cp) {
+                       case 'b':       /* 8-bit byte */
+-                              *dp++ = *sp++;
++                              memcpy(dp, sp, 1);
++                              dp += 1;
++                              sp += 1;
+                               break;
+                       case 'w':       /* 16-bit word, convert from little endian to CPU */
+                               dp += ((uintptr_t)dp & 1);      /* Align to word boundary */
+@@ -63,7 +65,7 @@
+                                       memcpy(dp, sp, 2);
+                               } else {
+                                       w = (sp[1] << 8) | sp[0];
+-                                      *((uint16_t *)dp) = w;
++                                      memcpy(dp, &w, 4);
+                               }
+                               sp += 2;
+                               dp += 2;
+@@ -76,7 +78,7 @@
+                               } else {
+                                       d = (sp[3] << 24) | (sp[2] << 16) |
+                                               (sp[1] << 8) | sp[0];
+-                                      *((uint32_t *)dp) = d;
++                                      memcpy(dp, &d, 4);
+                               }
+                               sp += 4;
+                               dp += 4;
+



Home | Main Index | Thread Index | Old Index