Subject: Re: mysql[45]-server error during the "build" phase on FreeBSD 6.1
To: None <pkgsrc-users@NetBSD.org>
From: Yarema <yds@CoolRat.org>
List: pkgsrc-users
Date: 06/26/2006 13:12:16
--==========D0A223A555CEAA2AEB5B==========
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--On Monday, June 26, 2006 14:33:57 +0200 joerg@britannica.bec.de wrote:

> On Mon, Jun 26, 2006 at 04:11:35AM -0400, Yarema wrote:
>> mysql[45]-client builds and installs just fine, but the -server pkg
>> fails  for both versions 4 and 5.  A copy of "work/.work.log " can be
>> found at: http://yds.CoolRat.org/pkgsrc/mysql5-server.log
>> and bmake 2>&1 output can be found at:
>> http://yds.CoolRat.org/pkgsrc/mysql5-server.out
>
> The tcpwrapper stuff seems to got broken by a API difference. See the
> tcpd.c in the build log. Want to cook a patch?

When comparing the the FreeBSD/ports version of the pkg to to pkgsrc's I 
did note that they do some weird patching for the sake of tcpwrappers:

post-extract:
        @${CP} /usr/include/tcpd.h ${WRKSRC}/sql/mytcpd.h

and then the two attached patches to sql/mysqld.cc and sql/mytcpd.h

Perhaps a quick fix would be to just apply similar patches wrapped in ifdef 
FreeBSD where need be.

Thanks Joerg for pointing me in the right direction..

-- 
Yarema
http://yds.CoolRat.org
--==========D0A223A555CEAA2AEB5B==========
Content-Type: text/plain; charset=us-ascii; name="patch-sql::mysqld.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="patch-sql::mysqld.cc"; size=505

--- sql/mysqld.cc.orig	Sat Aug  6 03:39:41 2005
+++ sql/mysqld.cc	Sun Aug 28 20:41:38 2005
@@ -121,7 +121,7 @@
 #endif /* __WIN__ */
 
 #ifdef HAVE_LIBWRAP
-#include <tcpd.h>
+#include "mytcpd.h"
 #include <syslog.h>
 #ifdef NEED_SYS_SYSLOG_H
 #include <sys/syslog.h>
@@ -3177,7 +3177,7 @@
   init_ssl();
 
 #ifdef HAVE_LIBWRAP
-  libwrapName= my_progname+dirname_length(my_progname);
+  libwrapName= (char *) my_progname+dirname_length(my_progname);
   openlog(libwrapName, LOG_PID, LOG_AUTH);
 #endif
 

--==========D0A223A555CEAA2AEB5B==========
Content-Type: text/plain; charset=iso-8859-1; name="patch-sql::mytcpd.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="patch-sql::mytcpd.h"; size=6033

--- sql/mytcpd.h.orig	Sun Jan  9 13:33:51 2005
+++ sql/mytcpd.h	Sun Jan  9 13:41:42 2005
@@ -6,6 +6,25 @@
   * $FreeBSD: ports/databases/mysql50-server/files/patch-sql::mytcpd.h,v =
1.1 2005/01/10 13:17:30 ale Exp $
   */
=20
+#ifndef _TCPWRAPPERS_TCPD_H
+#define _TCPWRAPPERS_TCPD_H
+
+/* someone else may have defined this */
+#undef  __P
+
+/* use prototypes if we have an ANSI C compiler or are using C++ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define __P(args)       args
+#else
+#define __P(args)       ()
+#endif
+
+/* Need definitions of struct sockaddr_in and FILE. */
+#include <netinet/in.h>
+#include <stdio.h>
+
+__BEGIN_DECLS
+
 /* Structure to describe one communications endpoint. */
=20
 #define STRING_LENGTH	128		/* hosts, users, processes */
@@ -31,10 +50,10 @@
     char    pid[10];			/* access via eval_pid(request) */
     struct host_info client[1];		/* client endpoint info */
     struct host_info server[1];		/* server endpoint info */
-    void  (*sink) ();			/* datagram sink function or 0 */
-    void  (*hostname) ();		/* address to printable hostname */
-    void  (*hostaddr) ();		/* address to printable address */
-    void  (*cleanup) ();		/* cleanup function or 0 */
+    void  (*sink) __P((int));		/* datagram sink function or 0 */
+    void  (*hostname) __P((struct host_info *)); /* address to printable =
hostname */
+    void  (*hostaddr) __P((struct host_info *)); /* address to printable =
address */
+    void  (*cleanup) __P((struct request_info *)); /* cleanup function or =
0 */
     struct netconfig *config;		/* netdir handle */
 };
=20
@@ -67,20 +86,23 @@
 /* Global functions. */
=20
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void fromhost();			/* get/validate client host info */
+extern void fromhost __P((struct request_info *));	/* get/validate client =
host info */
 #else
 #define fromhost sock_host		/* no TLI support needed */
 #endif
=20
-extern int hosts_access();		/* access control */
-extern void shell_cmd();		/* execute shell command */
-extern char *percent_x();		/* do %<char> expansion */
-extern void rfc931();			/* client name from RFC 931 daemon */
-extern void clean_exit();		/* clean up and exit */
-extern void refuse();			/* clean up and exit */
-extern char *xgets();			/* fgets() on steroids */
-extern char *split_at();		/* strchr() and split */
-extern unsigned long dot_quad_addr();	/* restricted inet_addr() */
+extern void shell_cmd __P((char *));	/* execute shell command */
+extern char *percent_x __P((char *, int, char *, struct request_info *)); =
/* do %<char> expansion */
+#ifdef INET6
+extern void rfc931 __P((struct sockaddr *, struct sockaddr *, char *)); /* =
client name from RFC 931 daemon */
+#else
+extern void rfc931 __P((struct sockaddr_in *, struct sockaddr_in *, char =
*)); /* client name from RFC 931 daemon */
+#endif
+extern void clean_exit __P((struct request_info *)); /* clean up and exit =
*/
+extern void refuse __P((struct request_info *));	/* clean up and exit */
+extern char *xgets __P((char *, int, FILE *));	/* fgets() on steroids */
+extern char *split_at __P((char *, int));	/* strchr() and split */
+extern unsigned long dot_quad_addr __P((char *)); /* restricted =
inet_addr() */
=20
 /* Global variables. */
=20
@@ -98,9 +120,14 @@
   */
=20
 #ifdef __STDC__
+extern int hosts_access(struct request_info *request);
+extern int hosts_ctl(char *daemon, char *client_name, char *client_addr,=20
+                     char *client_user);
 extern struct request_info *request_init(struct request_info *,...);
 extern struct request_info *request_set(struct request_info *,...);
 #else
+extern int hosts_access();
+extern int hosts_ctl();
 extern struct request_info *request_init();	/* initialize request */
 extern struct request_info *request_set();	/* update request structure */
 #endif
@@ -123,27 +150,27 @@
   * host_info structures serve as caches for the lookup results.
   */
=20
-extern char *eval_user();		/* client user */
-extern char *eval_hostname();		/* printable hostname */
-extern char *eval_hostaddr();		/* printable host address */
-extern char *eval_hostinfo();		/* host name or address */
-extern char *eval_client();		/* whatever is available */
-extern char *eval_server();		/* whatever is available */
+extern char *eval_user __P((struct request_info *));	/* client user */
+extern char *eval_hostname __P((struct host_info *));	/* printable =
hostname */
+extern char *eval_hostaddr __P((struct host_info *));	/* printable host =
address */
+extern char *eval_hostinfo __P((struct host_info *));	/* host name or =
address */
+extern char *eval_client __P((struct request_info *));	/* whatever is =
available */
+extern char *eval_server __P((struct request_info *));	/* whatever is =
available */
 #define eval_daemon(r)	((r)->daemon)	/* daemon process name */
 #define eval_pid(r)	((r)->pid)	/* process id */
=20
 /* Socket-specific methods, including DNS hostname lookups. */
=20
-extern void sock_host();		/* look up endpoint addresses */
-extern void sock_hostname();		/* translate address to hostname */
-extern void sock_hostaddr();		/* address to printable address */
+extern void sock_host __P((struct request_info *));
+extern void sock_hostname __P((struct host_info *));
+extern void sock_hostaddr __P((struct host_info *));
 #define sock_methods(r) \
 	{ (r)->hostname =3D sock_hostname; (r)->hostaddr =3D sock_hostaddr; }
=20
 /* The System V Transport-Level Interface (TLI) interface. */
=20
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void tli_host();			/* look up endpoint addresses etc. */
+extern void tli_host __P((struct request_info *));	/* look up endpoint =
addresses etc. */
 #endif
=20
  /*
@@ -184,7 +211,7 @@
   * behavior.
   */
=20
-extern void process_options();		/* execute options */
+extern void process_options __P((char *, struct request_info *)); /* =
execute options */
 extern int dry_run;			/* verification flag */
=20
 /* Bug workarounds. */
@@ -223,3 +250,7 @@
 #define strtok	my_strtok
 extern char *my_strtok();
 #endif
+
+__END_DECLS
+
+#endif /* tcpd.h */

--==========D0A223A555CEAA2AEB5B==========--