From jylefort@brutele.be  Wed Feb 22 15:42:06 2006
Return-Path: <jylefort@brutele.be>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 807B316A420
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Feb 2006 15:42:06 +0000 (GMT)
	(envelope-from jylefort@brutele.be)
Received: from host-212-68-242-42.brutele.be (host-212-68-242-42.brutele.be [212.68.242.42])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1068E43D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Feb 2006 15:42:01 +0000 (GMT)
	(envelope-from jylefort@brutele.be)
Received: from jsite.lefort.net (jsite.lefort.net [192.168.1.2])
	by gateway.lefort.net (Postfix) with ESMTP id C34B25626
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Feb 2006 16:41:59 +0100 (CET)
Received: by jsite.lefort.net (Postfix, from userid 1000)
	id AAD44C181; Wed, 22 Feb 2006 16:41:59 +0100 (CET)
Message-Id: <20060222154159.AAD44C181@jsite.lefort.net>
Date: Wed, 22 Feb 2006 16:41:59 +0100 (CET)
From: Jean-Yves Lefort <jylefort@FreeBSD.org>
Reply-To: Jean-Yves Lefort <jylefort@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Update port: games/eboard (add timeseal support)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         93709
>Category:       ports
>Synopsis:       Update port: games/eboard (add timeseal support)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    petef
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 22 15:50:02 GMT 2006
>Closed-Date:    Sat Apr 08 17:05:05 GMT 2006
>Last-Modified:  Sat Apr 08 17:05:05 GMT 2006
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Sat Feb 11 20:20:04 CET 2006 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
- Add timeseal support
- Take maintainership?
>How-To-Repeat:
>Fix:
diff -ruN /usr/ports/games/eboard/Makefile eboard/Makefile
--- /usr/ports/games/eboard/Makefile	Sat Feb 11 03:00:35 2006
+++ eboard/Makefile	Tue Feb 21 11:40:57 2006
@@ -7,16 +7,18 @@
 
 PORTNAME=	eboard
 PORTVERSION=	0.9.5
-PORTREVISION=	2
+PORTREVISION=	3
 EXTRAS=		1pl2 2
 CATEGORIES=	games
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
 DISTFILES=	${DISTNAME}${EXTRACT_SUFX} eboard-extras-1pl2.tar.gz eboard-extras-2.tar.gz
 
-MAINTAINER=	petef@FreeBSD.org
+MAINTAINER=	jylefort@FreeBSD.org
 COMMENT=	GTK+ chess board interface (mainly for FICS and chessd)
 
+RUN_DEPENDS=	timeseal:${PORTSDIR}/games/timeseal
+
 HAS_CONFIGURE=	yes
 USE_GNOME=	imlib
 USE_REINPLACE=	yes
@@ -41,6 +43,7 @@
 		${WRKSRC}/configure
 
 post-install:
+	${LN} -sf ${LOCALBASE}/bin/timeseal ${DATADIR}/timeseal.FreeBSD
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
diff -ruN /usr/ports/games/eboard/files/patch-network.cc eboard/files/patch-network.cc
--- /usr/ports/games/eboard/files/patch-network.cc	Thu Jan  1 01:00:00 1970
+++ eboard/files/patch-network.cc	Wed Feb 22 16:34:49 2006
@@ -0,0 +1,56 @@
+--- network.cc.orig	Thu Nov 27 00:48:49 2003
++++ network.cc	Wed Feb 22 16:33:40 2006
+@@ -554,6 +554,7 @@
+   strcpy(HostName,"local pipe");
+   sprintf(HostAddress,"pipe[%d,%d]",pin,pout);
+   Quiet=0;
++  use_execve=0;
+ }
+ 
+ void PipeConnection::init() {
+@@ -564,6 +565,7 @@
+   strcpy(HostAddress,"unknown");
+   memset(HelperBin,0,512);
+   Quiet=0;
++  use_execve=0;
+   handshake.erase();
+ }
+ 
+@@ -594,6 +596,25 @@
+   Port=port;
+   strncpy(HostName,host,128);
+ 
++  // Special handling for timeseal on FreeBSD:
++  //
++  // On FreeBSD, the games/timeseal port provides an a.out timeseal
++  // binary. However, a.out support is disabled by default on FreeBSD
++  // >= 5.x. If the a.out kernel module is not loaded, or if a.out
++  // support is not compiled into the kernel, execvp()ing timeseal
++  // will not return (because it fallbacks to the shell when execve()
++  // returns NOEXEC): eboard will not notice the failure (in
++  // PipeConnection::open()) and will therefore not fallback to a
++  // direct connection.
++  //
++  // We solve the problem by executing timeseal with execve(), which
++  // will fail if a.out support is not available. Note that unlike
++  // execvp(), execve() does not search for the program in the path,
++  // but this is not a problem since eboard uses the absolute path to
++  // timeseal.
++  if (! strcmp(helperbin, "timeseal"))
++    use_execve = 1;
++
+   // build helper path
+   if (helpersuffix)
+     sprintf(z,"%s.%s",helperbin,helpersuffix);
+@@ -702,7 +723,10 @@
+     dup2(1,2);
+ 
+     setpgid(getpid(),0); // to broadcast SIGKILL later
+-    execvp(HelperBin,arguments);
++    if (use_execve)
++      execve(HelperBin,arguments,NULL);
++    else
++      execvp(HelperBin,arguments);
+     write(1,"exec failed\n",12);
+     global.debug("exec failed",HelperBin);
+     _exit(2); // eek
diff -ruN /usr/ports/games/eboard/files/patch-network.h eboard/files/patch-network.h
--- /usr/ports/games/eboard/files/patch-network.h	Thu Jan  1 01:00:00 1970
+++ eboard/files/patch-network.h	Wed Feb 22 16:34:59 2006
@@ -0,0 +1,10 @@
+--- network.h.orig	Thu Nov 27 00:48:49 2003
++++ network.h	Wed Feb 22 16:22:04 2006
+@@ -229,6 +229,7 @@
+   int  pid;
+   int  toid; // timeout
+   string handshake;
++  int  use_execve;
+ };
+ 
+ class FallBackConnection : public NetConnection {
diff -ruN /usr/ports/games/eboard/pkg-plist eboard/pkg-plist
--- /usr/ports/games/eboard/pkg-plist	Sat Feb 11 03:00:35 2006
+++ eboard/pkg-plist	Tue Feb 21 11:39:55 2006
@@ -70,6 +70,7 @@
 share/eboard/plastic.png
 share/eboard/themeconf.extras1
 share/eboard/themeconf.extras2
+share/eboard/timeseal.FreeBSD
 share/pixmaps/eboard.xpm
 @dirrm share/eboard
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->petef 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Feb 22 16:00:24 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

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

From: Jean-Yves Lefort <jylefort@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/93709: Update port: games/eboard (add timeseal support)
Date: Thu, 23 Feb 2006 18:37:05 +0100

 Actually, there should be no timeseal dependency, since it's only for
 i386 and amd64 (besides, some people might not like the idea to
 connect using a closed source application):
 
 diff -ruN /usr/ports/games/eboard/Makefile eboard/Makefile
 --- /usr/ports/games/eboard/Makefile	Sat Feb 11 03:00:35 2006
 +++ eboard/Makefile	Thu Feb 23 18:28:31 2006
 @@ -7,14 +7,14 @@
  
  PORTNAME=	eboard
  PORTVERSION=	0.9.5
 -PORTREVISION=	2
 +PORTREVISION=	3
  EXTRAS=		1pl2 2
  CATEGORIES=	games
  MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
  MASTER_SITE_SUBDIR=	${PORTNAME}
  DISTFILES=	${DISTNAME}${EXTRACT_SUFX} eboard-extras-1pl2.tar.gz eboard-extras-2.tar.gz
  
 -MAINTAINER=	petef@FreeBSD.org
 +MAINTAINER=	jylefort@FreeBSD.org
  COMMENT=	GTK+ chess board interface (mainly for FICS and chessd)
  
  HAS_CONFIGURE=	yes
 @@ -41,6 +41,7 @@
  		${WRKSRC}/configure
  
  post-install:
 +	${LN} -sf ${LOCALBASE}/bin/timeseal ${DATADIR}/timeseal.FreeBSD
  .if !defined(NOPORTDOCS)
  	@${MKDIR} ${DOCSDIR}
  	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
 @@ -55,5 +56,6 @@
  .endfor
  	${MKDIR} ${PREFIX}/share/pixmaps
  	${INSTALL_DATA} ${WRKSRC}/icon-eboard.xpm ${PREFIX}/share/pixmaps/eboard.xpm
 +	@${CAT} ${PKGMESSAGE}
  
  .include <bsd.port.mk>
 diff -ruN /usr/ports/games/eboard/files/patch-network.cc eboard/files/patch-network.cc
 --- /usr/ports/games/eboard/files/patch-network.cc	Thu Jan  1 01:00:00 1970
 +++ eboard/files/patch-network.cc	Wed Feb 22 16:34:49 2006
 @@ -0,0 +1,56 @@
 +--- network.cc.orig	Thu Nov 27 00:48:49 2003
 ++++ network.cc	Wed Feb 22 16:33:40 2006
 +@@ -554,6 +554,7 @@
 +   strcpy(HostName,"local pipe");
 +   sprintf(HostAddress,"pipe[%d,%d]",pin,pout);
 +   Quiet=0;
 ++  use_execve=0;
 + }
 + 
 + void PipeConnection::init() {
 +@@ -564,6 +565,7 @@
 +   strcpy(HostAddress,"unknown");
 +   memset(HelperBin,0,512);
 +   Quiet=0;
 ++  use_execve=0;
 +   handshake.erase();
 + }
 + 
 +@@ -594,6 +596,25 @@
 +   Port=port;
 +   strncpy(HostName,host,128);
 + 
 ++  // Special handling for timeseal on FreeBSD:
 ++  //
 ++  // On FreeBSD, the games/timeseal port provides an a.out timeseal
 ++  // binary. However, a.out support is disabled by default on FreeBSD
 ++  // >= 5.x. If the a.out kernel module is not loaded, or if a.out
 ++  // support is not compiled into the kernel, execvp()ing timeseal
 ++  // will not return (because it fallbacks to the shell when execve()
 ++  // returns NOEXEC): eboard will not notice the failure (in
 ++  // PipeConnection::open()) and will therefore not fallback to a
 ++  // direct connection.
 ++  //
 ++  // We solve the problem by executing timeseal with execve(), which
 ++  // will fail if a.out support is not available. Note that unlike
 ++  // execvp(), execve() does not search for the program in the path,
 ++  // but this is not a problem since eboard uses the absolute path to
 ++  // timeseal.
 ++  if (! strcmp(helperbin, "timeseal"))
 ++    use_execve = 1;
 ++
 +   // build helper path
 +   if (helpersuffix)
 +     sprintf(z,"%s.%s",helperbin,helpersuffix);
 +@@ -702,7 +723,10 @@
 +     dup2(1,2);
 + 
 +     setpgid(getpid(),0); // to broadcast SIGKILL later
 +-    execvp(HelperBin,arguments);
 ++    if (use_execve)
 ++      execve(HelperBin,arguments,NULL);
 ++    else
 ++      execvp(HelperBin,arguments);
 +     write(1,"exec failed\n",12);
 +     global.debug("exec failed",HelperBin);
 +     _exit(2); // eek
 diff -ruN /usr/ports/games/eboard/files/patch-network.h eboard/files/patch-network.h
 --- /usr/ports/games/eboard/files/patch-network.h	Thu Jan  1 01:00:00 1970
 +++ eboard/files/patch-network.h	Wed Feb 22 16:34:59 2006
 @@ -0,0 +1,10 @@
 +--- network.h.orig	Thu Nov 27 00:48:49 2003
 ++++ network.h	Wed Feb 22 16:22:04 2006
 +@@ -229,6 +229,7 @@
 +   int  pid;
 +   int  toid; // timeout
 +   string handshake;
 ++  int  use_execve;
 + };
 + 
 + class FallBackConnection : public NetConnection {
 diff -ruN /usr/ports/games/eboard/pkg-message eboard/pkg-message
 --- /usr/ports/games/eboard/pkg-message	Thu Jan  1 01:00:00 1970
 +++ eboard/pkg-message	Thu Feb 23 18:28:11 2006
 @@ -0,0 +1,7 @@
 +===============================================================================
 +
 +If you want to make FICS games fairer by accounting for network lag,
 +install the games/timeseal port (when timeseal is active, the
 +bottom-left icon changes to a orange/yellow locked clock).
 +
 +===============================================================================
 diff -ruN /usr/ports/games/eboard/pkg-plist eboard/pkg-plist
 --- /usr/ports/games/eboard/pkg-plist	Sat Feb 11 03:00:35 2006
 +++ eboard/pkg-plist	Tue Feb 21 11:39:55 2006
 @@ -70,6 +70,7 @@
  share/eboard/plastic.png
  share/eboard/themeconf.extras1
  share/eboard/themeconf.extras2
 +share/eboard/timeseal.FreeBSD
  share/pixmaps/eboard.xpm
  @dirrm share/eboard
  %%PORTDOCS%%@dirrm %%DOCSDIR%%
 
 
 -- 
 Jean-Yves Lefort
 
 jylefort@FreeBSD.org
 http://lefort.be.eu.org/
State-Changed-From-To: open->closed 
State-Changed-By: jylefort 
State-Changed-When: Sat Apr 8 17:05:00 UTC 2006 
State-Changed-Why:  
Committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93709 
>Unformatted:
