Subject: pkg/22904: Fix sysutils/tcx on Solaris
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jonathan@perkin.org.uk>
List: netbsd-bugs
Date: 09/23/2003 08:35:28
>Number:         22904
>Category:       pkg
>Synopsis:       Fix sysutils/tcx on Solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 23 08:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        N/A
>Organization:
British Broadcasting Corporation
>Environment:
SunOS build1 5.9 Generic_112233-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
>Description:
Solaris does not support the old wait3 semantics, nor supply the `wait'
union.  Standard workaround is to use an int.

Detect whether we're running on Solaris with if defined(sun), as all
of GCC 2.x 3.x and Sun CC define this.

Compile and half-ran tested on Solaris (no root permissions to do an
untcx), and run tested on NetBSD/sparc64.  It should be trivial for
this to be fixed for IRIX too, which already includes half of the
patch.  I lack the hardware to test the simple fix though.
>How-To-Repeat:
===> Building for tcx-19940124
/home/jonp/pkg/gcc-3.3/bin/gcc -O -o tcx tcx.c 
tcx.c: In function `doencode':
tcx.c:294: error: storage size of `status' isn't known
*** Error code 1

Same for untcx.c
>Fix:
http://www.perkin.org.uk/projects/netbsd/tcx.diff

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/tcx/distinfo,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 distinfo
--- distinfo	2003/06/23 13:55:24	1.1.1.1
+++ distinfo	2003/09/23 08:28:12
@@ -4,5 +4,5 @@
 Size (tcx-linux.tar.gz) = 21028 bytes
 SHA1 (patch-aa) = 2e03b68d4c4ed05757fe788649eede461a11a4e5
 SHA1 (patch-ab) = 5e7e7247783090e3029504f80440b6faebe1d1dd
-SHA1 (patch-ac) = 9a285e8365a3e0151fd37e2bf86ee8c346599e3b
-SHA1 (patch-ad) = 5ba81fcec1e674054c532fc3c70a8a6d8f17c350
+SHA1 (patch-ac) = df9ef3447b471085b15f37ed0f9c0a58375a4e8d
+SHA1 (patch-ad) = b77a957357f65f33fc8e64377ac12568f078eeb6
Index: patches/patch-ac
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/tcx/patches/patch-ac,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-ac
--- patches/patch-ac	2003/06/23 13:55:24	1.1.1.1
+++ patches/patch-ac	2003/09/23 08:28:12
@@ -2,8 +2,8 @@
 
 Minor security audit - the world has moved on since 1994.
 
---- untcx.c	2003/06/20 07:59:56	1.1
-+++ untcx.c	2003/06/20 08:09:26
+--- untcx.c.orig	Sun Jan  9 22:47:53 1994
++++ untcx.c	Tue Sep 23 09:22:19 2003
 @@ -166,9 +166,9 @@
  
  	/* Set global paths */
@@ -17,7 +17,7 @@
  
  	/* Check and start tcxd as required */
  
-@@ -185,16 +185,16 @@
+@@ -185,7 +185,7 @@
  
  	/* Grab argv[0] and resolve to full path name via getwd() */
  
@@ -26,6 +26,7 @@
  	{
  		(void)fprintf(stderr, "Get Working Directory Error: %s\n", cwd);
  		exit(-1);
+@@ -192,9 +192,9 @@
  	}
  
  	if(*argv[0] == '/')
@@ -123,7 +124,7 @@
  	(void)write(lkfd, spid, strlen(spid));
  
  #ifdef UNPACK_IN_PLACE
-@@ -810,30 +810,30 @@
+@@ -810,22 +810,22 @@
  
  	/* resolve first stage of argv[0] */
  
@@ -151,6 +152,7 @@
  	if(mkdir(linkpath, 0777) < 0)
  	{
  		if(errno != EEXIST) { perror(linkpath); exit(-1); }
+@@ -832,8 +832,8 @@
  	}
  	else
  		(void)chmod(linkpath, 0777);
@@ -170,3 +172,12 @@
  #ifdef UNPACK_IN_PLACE
  		curr->pid = -1;
  		(strstr(newpath, ENFSDIR) == newpath) ? (curr->local = 0) : (curr->local = 1);
+@@ -1313,7 +1313,7 @@
+ dodecode(int infd, int outfd)
+ {
+ int	pid;
+-#if defined(IRIX) || defined(AIX)
++#if defined(IRIX) || defined(AIX) || defined(sun)
+ int	status;
+ #else
+ union wait status;
Index: patches/patch-ad
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/tcx/patches/patch-ad,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-ad
--- patches/patch-ad	2003/06/23 13:55:24	1.1.1.1
+++ patches/patch-ad	2003/09/23 08:28:12
@@ -2,8 +2,8 @@
 
 Minor security audit
 
---- tcx.c	2003/06/20 10:44:29	1.1
-+++ tcx.c	2003/06/20 10:45:54
+--- tcx.c.orig	Mon Dec 27 03:25:17 1993
++++ tcx.c	Tue Sep 23 09:24:12 2003
 @@ -120,16 +120,16 @@
  	/* If cannot, warn user and quit */
  
@@ -34,3 +34,15 @@
  	if(write(outfd, header, strlen(header)) < 0) { (void)perror("write"); exit(-1); }
  
  	c = 0;	if((write(outfd, &c, 1)) < 0) { (void)perror("write"); exit(-1); }
+@@ -291,7 +291,11 @@
+ doencode(int infd, int outfd)
+ {
+ int	pid;
++#if defined(sun)
++int	status;
++#else
+ union	wait	status;
++#endif
+ 
+ 	pid = fork();
+ 	if(pid < 0) return -1;
>Release-Note:
>Audit-Trail:
>Unformatted: