From sime@logos.hr  Fri Aug  4 10:08:51 2006
Return-Path: <sime@logos.hr>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D140116A4DD;
	Fri,  4 Aug 2006 10:08:51 +0000 (UTC)
	(envelope-from sime@logos.hr)
Received: from mail.logos.hr (gates.logos.hr [213.149.47.2])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6487943D45;
	Fri,  4 Aug 2006 10:08:50 +0000 (GMT)
	(envelope-from sime@logos.hr)
Received: from localhost (localhost.logos.hr [127.0.0.1])
	by mail.logos.hr (Postfix) with ESMTP id CAAA226D0FA;
	Fri,  4 Aug 2006 12:08:48 +0200 (CEST)
Received: from mail.logos.hr ([127.0.0.1])
 by localhost (mail.logos.hr [127.0.0.1]) (amavisd-new, port 10024) with LMTP
 id 74368-05; Fri,  4 Aug 2006 12:08:38 +0200 (CEST)
Received: by mail.logos.hr (Postfix, from userid 34062)
	id 4EC2B26D049; Fri,  4 Aug 2006 12:08:38 +0200 (CEST)
Message-Id: <20060804100838.4EC2B26D049@mail.logos.hr>
Date: Fri,  4 Aug 2006 12:08:38 +0200 (CEST)
From: Simun Mikecin <numisemis@yahoo.com>
Reply-To: Simun Mikecin <numisemis@yahoo.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: sem@ciam.ru, sem@freebsd.org
Subject: [fix] FD_SETSIZE checking is wrong: some client apps dont work
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         101352
>Category:       ports
>Synopsis:       [patch] devel/gsoap: FD_SETSIZE checking is wrong: some client apps dont work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sem
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 04 10:10:10 GMT 2006
>Closed-Date:    Sat Aug 05 08:31:29 GMT 2006
>Last-Modified:  Mon Aug  7 07:10:18 GMT 2006
>Originator:     Simun Mikecin
>Release:        FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
>Environment:
System: FreeBSD mail.logos.hr 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #1: Mon Jul 26 14:07:00 CEST 2004 root@mail.logos.hr:/usr/obj/usr/src.5.2.1-R/sys/MAIL i386
>Description:
gsoap 2.7.8c has file descriptor checking like this:
        if ((int)soap->socket > FD_SETSIZE)
          return SOAP_FD_EXCEEDED;      /* Hint: MUST increase FD_SETSIZE */
and on FreeBSD FD_SETSIZE is defined in /usr/include/sys/select.h like this:
#define FD_SETSIZE      1024U
unlike many other systems where it doesn't have 'U' suffix which makes it an "unsigned" type.

Problem is that comparing:
	if ((int) -1 > 1024U)
returns true, so the function call fails, but it shouldn't cause soap->socket initially has a value of -1.

I already reported this bug on the gsoap project tracker.
>How-To-Repeat:
As a consequence of this bug, I have experienced that SOAP calls from client
SOAP applications in some situations (like using HTTP keep-alive and one-way
message parsing) return with SOAP_FD_EXCEEDED instead of SOAP_OK.
>Fix:
diff -urN gsoap.orig/Makefile gsoap/Makefile
--- gsoap.orig/Makefile	Sat Jul 22 13:33:18 2006
+++ gsoap/Makefile	Fri Aug  4 11:36:41 2006
@@ -7,6 +7,7 @@
 
 PORTNAME=	gsoap
 PORTVERSION=	2.7.8c
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	gsoap2
@@ -21,5 +22,11 @@
 WRKSRC=		${WRKDIR}/${PORTNAME}-2.7
 
 ONLY_FOR_ARCHS=	i386 amd64
+
+post-patch:
+	${SED} 's/> FD_SETSIZE/> (int)FD_SETSIZE/g' ${WRKSRC}/soapcpp2/stdsoap2.c > ${WRKDIR}/stdsoap2.c
+	${SED} 's/> FD_SETSIZE/> (int)FD_SETSIZE/g' ${WRKSRC}/soapcpp2/stdsoap2.cpp > ${WRKDIR}/stdsoap2.cpp
+	${MV} ${WRKDIR}/stdsoap2.c ${WRKSRC}/soapcpp2/stdsoap2.c
+	${MV} ${WRKDIR}/stdsoap2.cpp ${WRKSRC}/soapcpp2/stdsoap2.cpp
 
 .include <bsd.port.mk>
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->sem 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Aug 4 11:07:29 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=101352 
State-Changed-From-To: open->closed 
State-Changed-By: sem 
State-Changed-When: Sat Aug 5 08:31:27 UTC 2006 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=101352 

From: Simun Mikecin <numisemis@yahoo.com>
To: Sergey Matveychuk <sem@FreeBSD.org>, bug-followup@freebsd.org
Cc:  
Subject: Re: ports/101352: [patch] devel/gsoap: FD_SETSIZE checking is wrong: some client apps dont work
Date: Mon, 7 Aug 2006 00:06:21 -0700 (PDT)

 Unfortunatelly with this commit it doesn't build on
 6.x anymore. I suppose the problem is with this part
 of the Makefile (which was not in the PR):
 
 +.if ${OSVERSION} < 500000
 +CONST=
 +.else
 +CONST= const
 +.endif
 
 
 __________________________________________________
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
>Unformatted:
