Bug 173038 - [patch] emulators/open-vm-tools: fix signage bugs with clang
[patch] emulators/open-vm-tools: fix signage bugs with clang
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Steve Wills
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-24 22:20 UTC by Garrett Cooper,425-314-3911
Modified: 2013-10-19 15:50 UTC (History)
0 users

See Also:


Attachments
file.diff (1.54 KB, patch)
2012-10-24 22:20 UTC, Garrett Cooper,425-314-3911
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Garrett Cooper,425-314-3911 freebsd_committer 2012-10-24 22:20:00 UTC
There are a number of bugs found by clang dealing with signed quantities that cause the build to fail. These are easy to fix and have already been fixed on the upstream git master, but it would be nice to have the fixes in ports as well.

Fix: Patch attached with submission follows:
How-To-Repeat: cd /usr/ports/emulators/open-vm-tools-nox11
make all CC=clang CXX=clang++ CPP=clang-cpp
Comment 1 Edwin Groothuis freebsd_committer 2012-10-24 22:20:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->swills

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2013-10-19 15:40:11 UTC
Author: tijl
Date: Sat Oct 19 14:39:55 2013
New Revision: 330878
URL: http://svnweb.freebsd.org/changeset/ports/330878

Log:
  - Fix build with clang and recent kernel API changes.
  - Use new style LIB_DEPENDS.
  
  PR:		173038, 174290, 180499
  Submitted by:	Garrett Cooper <yaneurabeya@gmail.com>
  Approved by:	swills (maintainer)

Added:
  head/emulators/open-vm-tools/files/patch-checkvm.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-dndLinux.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-hgfsProto.h   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-hgfsserver.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-os.c   (contents, props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c   (contents, props changed)
Modified:
  head/emulators/open-vm-tools/Makefile
  head/emulators/open-vm-tools/files/patch-vmmemctl-os.c   (contents, props changed)
Directory Properties:
  head/emulators/open-vm-tools/distinfo   (props changed)
  head/emulators/open-vm-tools/files/patch-appUtilX11.c   (props changed)
  head/emulators/open-vm-tools/files/patch-arch   (props changed)
  head/emulators/open-vm-tools/files/patch-freebsd-8   (props changed)
  head/emulators/open-vm-tools/files/patch-freebsd-9   (props changed)
  head/emulators/open-vm-tools/files/patch-getpwnam   (props changed)
  head/emulators/open-vm-tools/files/patch-guestApp.c   (props changed)
  head/emulators/open-vm-tools/files/patch-hgfsmounter-Makefile.in   (props changed)
  head/emulators/open-vm-tools/files/patch-hostinfoPosix.c   (props changed)
  head/emulators/open-vm-tools/files/patch-libguestlib-Makefile   (props changed)
  head/emulators/open-vm-tools/files/patch-modules-Makefile.in   (props changed)
  head/emulators/open-vm-tools/files/patch-net_compat.h   (props changed)
  head/emulators/open-vm-tools/files/patch-scripts-Makefile   (props changed)
  head/emulators/open-vm-tools/files/patch-scripts-network   (props changed)
  head/emulators/open-vm-tools/files/patch-services-Makefile   (props changed)
  head/emulators/open-vm-tools/files/patch-util_misc.c   (props changed)
  head/emulators/open-vm-tools/files/patch-vm_basic_types.h   (props changed)
  head/emulators/open-vm-tools/files/patch-vmblock-vnops.c   (props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-Makefile   (props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-kernelStubs.h   (props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-state.c   (props changed)
  head/emulators/open-vm-tools/files/patch-vmhgfs-vnopscommon.c   (props changed)
  head/emulators/open-vm-tools/files/patch-vmtoolsd-Makefile.in   (props changed)
  head/emulators/open-vm-tools/files/patch-wrapper-Makefile.am   (props changed)
  head/emulators/open-vm-tools/files/pkg-message.in   (props changed)
  head/emulators/open-vm-tools/files/vmware-guestd.in   (props changed)
  head/emulators/open-vm-tools/files/vmware-kmod.in   (props changed)
  head/emulators/open-vm-tools/pkg-descr   (props changed)
  head/emulators/open-vm-tools/pkg-plist   (props changed)

Modified: head/emulators/open-vm-tools/Makefile
==============================================================================
--- head/emulators/open-vm-tools/Makefile	Sat Oct 19 14:39:12 2013	(r330877)
+++ head/emulators/open-vm-tools/Makefile	Sat Oct 19 14:39:55 2013	(r330878)
@@ -3,7 +3,7 @@
 
 PORTNAME=		open-vm-tools
 PORTVERSION=		${BUILD_VER}
-PORTREVISION=		3
+PORTREVISION=		4
 PORTEPOCH=		1
 CATEGORIES=		emulators kld
 MASTER_SITES=		SF/${PORTNAME}/${PORTNAME}/stable-8.6.x
@@ -21,6 +21,7 @@ BUILD_VER=		425873
 WRKSRC=			${WRKDIR}/open-vm-tools-${RELEASE_VER}-${BUILD_VER}
 GNU_CONFIGURE=		yes
 USES=			pkgconfig
+USE_GNOME=		glib20
 USE_LDCONFIG=		yes
 CPPFLAGS+=		-Wno-deprecated-declarations
 
@@ -28,26 +29,24 @@ SSP_UNSAFE=		kernel module does not supp
 
 CONFIGURE_ARGS+=	--without-procps --sysconfdir=${LOCALBASE}/etc
 .if defined(WITHOUT_X11)
-LIB_DEPENDS+=		glib-2.0:${PORTSDIR}/devel/glib20
 CONFIGURE_ARGS+=	--without-x --without-gtk2 --without-gtkmm
 PLIST_SUB+=		X11="@comment "
 CONFLICTS=		open-vm-tools-[0-9]*
 .else
 .if !defined(WITHOUT_LIBNOTIFY)
-LIB_DEPENDS+=		notify.4:${PORTSDIR}/devel/libnotify
+LIB_DEPENDS+=		libnotify.so:${PORTSDIR}/devel/libnotify
 .endif
 .if defined(WITH_UNITY)
 CONFIGURE_ENV+=		CUSTOM_URIPARSER_CPPFLAGS="-I${LOCALBASE}/include/uriparser"
-LIB_DEPENDS+=		uriparser.1:${PORTSDIR}/net/uriparser
+LIB_DEPENDS+=		liburiparser.so:${PORTSDIR}/net/uriparser
 .else
 CONFIGURE_ARGS+=	--disable-unity
 .endif
-LIB_DEPENDS+=		gtkmm-2.4:${PORTSDIR}/x11-toolkits/gtkmm24
 CONFIGURE_ARGS+=	--with-x
 LDFLAGS+=		-L${LOCALBASE}/lib
 USE_XORG=		x11 ice sm xext xineramaproto xinerama xrandr xrender \
 			xtst
-USE_GNOME=		gtk20 glib20
+USE_GNOME+=		gtk20 gtkmm24
 PLIST_SUB+=		X11=""
 CONFLICTS=		open-vm-tools-nox11-[0-9]*
 .endif
@@ -65,13 +64,13 @@ SUB_FILES=		pkg-message
 .if defined(WITHOUT_DNET)
 CONFIGURE_ARGS+=	--without-dnet
 .else
-LIB_DEPENDS+=		dnet:${PORTSDIR}/net/libdnet
+LIB_DEPENDS+=		libdnet.so:${PORTSDIR}/net/libdnet
 .endif
 
 .if defined(WITHOUT_ICU)
 CONFIGURE_ARGS+=	--without-icu
 .else
-LIB_DEPENDS+=		icuuc:${PORTSDIR}/devel/icu
+LIB_DEPENDS+=		libicuuc.so:${PORTSDIR}/devel/icu
 .endif
 
 USE_RC_SUBR=		vmware-guestd vmware-kmod

Added: head/emulators/open-vm-tools/files/patch-checkvm.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-checkvm.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,47 @@
+--- checkvm/checkvm.c.orig
++++ checkvm/checkvm.c
+@@ -56,7 +56,7 @@
+     uint32       val
+ )
+ {
+-  __asm__ volatile("out%L0 (%%dx)" : :"a" (val), "d" (port));
++  __asm__ volatile("outl %%eax, %%dx" : :"a" (val), "d" (port));
+ }
+ 
+ static __inline__ uint32
+@@ -66,7 +66,7 @@
+ {
+   uint32 ret;
+ 
+-  __asm__ volatile("in%L0 (%%dx)" : "=a" (ret) : "d" (port));
++  __asm__ volatile("inl %%dx, %%eax" : "=a" (ret) : "d" (port));
+   return ret;
+ }
+ 
+@@ -79,7 +79,7 @@
+ {
+    uint32 eax, ebx, ecx, edx;
+    
+-   __asm__ volatile("inl (%%dx)" :
++   __asm__ volatile("inl %%dx, %%eax" :
+    	            "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
+ 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETVERSION),
+ 		    "2"(BDOOR_PORT) : "memory");
+@@ -96,7 +96,7 @@
+ {
+    uint32 eax, ebx, ecx, edx;
+    
+-   __asm__ volatile("inl (%%dx)" :
++   __asm__ volatile("inl %%dx, %%eax" :
+    	            "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
+ 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETHWVERSION),
+ 		    "2"(BDOOR_PORT) : "memory");
+@@ -112,7 +112,7 @@
+ {
+    uint32 eax, ebx, ecx, edx;
+    
+-   __asm__ volatile("inl (%%dx)" :
++   __asm__ volatile("inl %%dx, %%eax" :
+    		    "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
+ 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETSCREENSIZE),
+ 		    "2"(BDOOR_PORT) : "memory");

Added: head/emulators/open-vm-tools/files/patch-dndLinux.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-dndLinux.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,11 @@
+--- services/plugins/dndcp/dnd/dndLinux.c.orig
++++ services/plugins/dndcp/dnd/dndLinux.c
+@@ -455,7 +455,7 @@
+ DnD_CheckBlockFuse(int blockFd)                    // IN
+ {
+    char buf[sizeof(VMBLOCK_FUSE_READ_RESPONSE)];
+-   size_t size;
++   ssize_t size;
+ 
+    size = read(blockFd, buf, sizeof(VMBLOCK_FUSE_READ_RESPONSE));
+    if (size < 0) {

Added: head/emulators/open-vm-tools/files/patch-hgfsProto.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-hgfsProto.h	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,22 @@
+--- lib/include/hgfsProto.h.orig
++++ lib/include/hgfsProto.h
+@@ -148,6 +148,9 @@
+    HGFS_OP_SET_EAS_V4,            /* Add or modify extended attributes. */
+ 
+    HGFS_OP_MAX,                   /* Dummy op, must be last in enum */
++
++/* If a V4 packet is being processed as a legacy packet it will have this opcode. */
++   HGFS_V4_LEGACY_OPCODE = 0xff,
+ } HgfsOp;
+ 
+ 
+@@ -155,9 +158,6 @@
+ #define HGFS_VERSION_OLD           (1 << 0)
+ #define HGFS_VERSION_3             (1 << 1)
+ 
+-/* If a V4 packet is being processed as a legacy packet it will have this opcode. */
+-#define HGFS_V4_LEGACY_OPCODE      0xff
+-
+ /* XXX: Needs change when VMCI is supported. */
+ #define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest))
+ #define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply))

Added: head/emulators/open-vm-tools/files/patch-hgfsserver.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-hgfsserver.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,11 @@
+--- lib/hgfsServer/hgfsServer.c.orig
++++ lib/hgfsServer/hgfsServer.c
+@@ -3557,7 +3557,7 @@
+     * delimiter on copy. Allow 0 length drives so that hidden feature "" can
+     * work.
+     */
+-   if (pathLength < 0 || pathLength >= sizeof p.mountPoint) {
++   if (pathLength >= sizeof p.mountPoint) {
+       LOG(4, ("%s: could not get the volume name\n", __FUNCTION__));
+ 
+       return FALSE;

Added: head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,11 @@
+--- lib/hgfsServer/hgfsServerLinux.c.orig
++++ lib/hgfsServer/hgfsServerLinux.c
+@@ -551,7 +551,7 @@
+ 
+    arraySize = ARRAYSIZE(HgfsServerOpenFlags);
+ 
+-   if (flagsIn < 0 || flagsIn >= arraySize) {
++   if (flagsIn >= arraySize) {
+       Log("%s: Invalid HgfsOpenFlags %d\n", __FUNCTION__, flagsIn);
+ 
+       return FALSE;

Added: head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,11 @@
+--- modules/freebsd/vmblock/vfsops.c.orig
++++ modules/freebsd/vmblock/vfsops.c
+@@ -236,7 +236,7 @@
+     */
+    MNT_ILOCK(mp);
+    mp->mnt_flag |= lowerrootvp->v_mount->mnt_flag & MNT_LOCAL;
+-#if __FreeBSD_version >= 600000
++#if __FreeBSD_version >= 600000 && __FreeBSD_version < 1000021
+    mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE;
+ #endif
+    MNT_IUNLOCK(mp);

Added: head/emulators/open-vm-tools/files/patch-vmhgfs-os.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-vmhgfs-os.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,11 @@
+--- modules/freebsd/vmhgfs/os.c.orig
++++ modules/freebsd/vmhgfs/os.c
+@@ -647,7 +647,7 @@
+ 		 OS_THREAD_T *newThread)   // OUT
+ {
+    return compat_kthread_create(function, parameter,
+-                                newThread, 0, 0, threadName);
++                                newThread, 0, 0, "%s", threadName);
+ }
+ 
+ 

Added: head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -0,0 +1,12 @@
+--- modules/freebsd/vmhgfs/vfsops.c.orig
++++ modules/freebsd/vmhgfs/vfsops.c
+@@ -201,7 +201,9 @@
+     * structures, not oplocks/leases with the VM's host.)
+     */
++#if __FreeBSD_version < 1000021
+    MNT_ILOCK(mp);
+    mp->mnt_kern_flag |= MNTK_MPSAFE;
+    MNT_IUNLOCK(mp);
++#endif
+ 
+    /* Get a new unique filesystem ID */

Modified: head/emulators/open-vm-tools/files/patch-vmmemctl-os.c
==============================================================================
--- head/emulators/open-vm-tools/files/patch-vmmemctl-os.c	Sat Oct 19 14:39:12 2013	(r330877)
+++ head/emulators/open-vm-tools/files/patch-vmmemctl-os.c	Sat Oct 19 14:39:55 2013	(r330878)
@@ -1,12 +1,56 @@
---- modules/freebsd/vmmemctl/os.c.orig	2011-09-21 14:25:15.000000000 -0400
-+++ modules/freebsd/vmmemctl/os.c	2012-06-20 09:44:40.434083000 -0400
-@@ -344,12 +344,22 @@
+--- modules/freebsd/vmmemctl/os.c.orig	2011-09-21 20:25:15.000000000 +0200
++++ modules/freebsd/vmmemctl/os.c	2013-10-19 11:01:27.000000000 +0200
+@@ -37,9 +37,11 @@
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/kernel.h>
++#include <sys/lock.h>
+ #include <sys/malloc.h>
+ #include <sys/module.h>
+ #include <sys/conf.h>
++#include <sys/rwlock.h>
+ #include <sys/sysctl.h>
+ 
+ #include <vm/vm.h>
+@@ -264,14 +266,23 @@
+    p->size = (p->size + sizeof(unsigned long) - 1) & 
+                          ~(sizeof(unsigned long) - 1);
+ 
++#if __FreeBSD_version >= 1000042
++   p->bitmap = (unsigned long *)kmem_malloc(kernel_arena, p->size,
++                         M_WAITOK | M_ZERO);
++#else
+    p->bitmap = (unsigned long *)kmem_alloc(kernel_map, p->size);
++#endif
+ }
+ 
+ 
+ static void
+ os_pmap_free(os_pmap *p) // IN
+ {
++#if __FreeBSD_version >= 1000042
++   kmem_free(kernel_arena, (vm_offset_t)p->bitmap, p->size);
++#else
+    kmem_free(kernel_map, (vm_offset_t)p->bitmap, p->size);
++#endif
+    p->size = 0;
+    p->bitmap = NULL;
+ }
+@@ -344,12 +355,31 @@
     os_state *state = &global_state;
     os_pmap *pmap = &state->pmap;
  
 -   if ( !vm_page_lookup(state->vmobject, page->pindex) ) {
 -      return;
+-   }
+ 
+-   os_pmap_putindex(pmap, page->pindex);
+-   vm_page_free(page);
++#if __FreeBSD_version > 1000029
++   VM_OBJECT_WLOCK(state->vmobject);
++#else
 +   VM_OBJECT_LOCK(state->vmobject);
++#endif
 +   if ( vm_page_lookup(state->vmobject, page->pindex) ) {
 +   	os_pmap_putindex(pmap, page->pindex);
 +#if __FreeBSD_version >= 900000
@@ -20,31 +64,44 @@
 +#else
 +	vm_page_unlock_queues();
 +#endif
-    }
--
--   os_pmap_putindex(pmap, page->pindex);
--   vm_page_free(page);
++   }
++#if __FreeBSD_version > 1000029
++   VM_OBJECT_WUNLOCK(state->vmobject);
++#else
 +   VM_OBJECT_UNLOCK(state->vmobject);
++#endif
  }
  
  
-@@ -361,8 +371,11 @@
+@@ -361,8 +391,19 @@
     os_state *state = &global_state;
     os_pmap *pmap = &state->pmap;
  
++#if __FreeBSD_version > 1000029
++   VM_OBJECT_WLOCK(state->vmobject);
++#else
 +   VM_OBJECT_LOCK(state->vmobject);
++#endif
 +
     pindex = os_pmap_getindex(pmap);
     if (pindex == (vm_pindex_t)-1) {
++#if __FreeBSD_version > 1000029
++      VM_OBJECT_WUNLOCK(state->vmobject);
++#else
 +      VM_OBJECT_UNLOCK(state->vmobject);
++#endif
        return NULL;
     }
  
-@@ -383,6 +396,7 @@
+@@ -383,6 +424,11 @@
     if (!page) {
        os_pmap_putindex(pmap, pindex);
     }
++#if __FreeBSD_version > 1000029
++   VM_OBJECT_WUNLOCK(state->vmobject);
++#else
 +   VM_OBJECT_UNLOCK(state->vmobject);
++#endif
  
     return page;
  }
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Tijl Coosemans freebsd_committer 2013-10-19 15:40:55 UTC
State Changed
From-To: open->closed

Committed in r330878.