From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jun 28 13:50:04 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78EFB16A41C for ; Tue, 28 Jun 2005 13:50:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CEB743D49 for ; Tue, 28 Jun 2005 13:50:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j5SDo34R000831 for ; Tue, 28 Jun 2005 13:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j5SDo32R000830; Tue, 28 Jun 2005 13:50:03 GMT (envelope-from gnats) Resent-Date: Tue, 28 Jun 2005 13:50:03 GMT Resent-Message-Id: <200506281350.j5SDo32R000830@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, vd@datamax.bg Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D1EE416A41C; Tue, 28 Jun 2005 13:43:07 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84C6343D5C; Tue, 28 Jun 2005 13:43:07 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1]) by jengal.datamax.bg (Postfix) with QMQP id 92F9187C8; Tue, 28 Jun 2005 16:43:05 +0300 (EEST) Received: (nullmailer pid 57873 invoked by uid 1004); Tue, 28 Jun 2005 13:43:05 -0000 Message-Id: <20050628134305.GA53143@sinanica.bg.datamax> Date: Tue, 28 Jun 2005 16:43:05 +0300 From: Vasil Dimov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: clement@FreeBSD.org, odumat@netkom-sachsen.de Subject: ports/82731: [patch] net/libnss-mysql is unable to connect to the mysql server via tcp X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vd@datamax.bg List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2005 13:50:04 -0000 >Number: 82731 >Category: ports >Synopsis: [patch] net/libnss-mysql is unable to connect to the mysql server via tcp >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 28 13:50:03 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Vasil Dimov >Release: FreeBSD 5.4-STABLE i386 >Organization: DataMax >Environment: >Description: As reported in ports/82476, libnss-mysql's connecting to mysql server fails immediately after attemp has began. The problem is that mysql_options(MYSQL_OPT_CONNECT_TIMEOUT) is called with last argument "3", to set the desired connect timeout to 3 seconds, but, according to http://dev.mysql.com/doc/mysql/en/mysql-options.html the argument should be unsigned int *, e.g. unsigned int x = 3, then &x This causes too large timeout (something like 164514388) to be passed as a timeout value resulting in subsequent select(2) call returning EINVAL (22). from select(2): [EINVAL] The specified time limit is invalid. One of its com- ponents is negative or too large. Note that this prog may be able to connect in some circumstances when connect(2) (with non-blocking socket) returns success immediately, instead of EINPROGESS, or if the select(2) implementation does not consider something like 164514388 (nearly 51 years! :) as a too large timeout. *But* the 3 seconds timeout has never been working. >How-To-Repeat: >Fix: --- libnss-mysql_def_timeout.diff begins here --- diff -urN libnss-mysql.orig/Makefile libnss-mysql/Makefile --- libnss-mysql.orig/Makefile Tue Jun 28 16:16:04 2005 +++ libnss-mysql/Makefile Tue Jun 28 16:11:49 2005 @@ -7,6 +7,7 @@ PORTNAME= libnss-mysql PORTVERSION= 1.4 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= libnss-mysql diff -urN libnss-mysql.orig/files/patch-src::mysql.c libnss-mysql/files/patch-src::mysql.c --- libnss-mysql.orig/files/patch-src::mysql.c Thu Jan 1 02:00:00 1970 +++ libnss-mysql/files/patch-src::mysql.c Tue Jun 28 16:18:50 2005 @@ -0,0 +1,15 @@ +--- src/mysql.c.orig Tue Jun 28 16:05:53 2005 ++++ src/mysql.c Tue Jun 28 16:18:17 2005 +@@ -137,10 +137,11 @@ + _nss_mysql_set_options (sql_server_t *server) + { + DN ("_nss_mysql_set_options") ++ static const unsigned def_timeout = DEF_TIMEOUT; + + DENTER + +- mysql_options(&ci.link, MYSQL_OPT_CONNECT_TIMEOUT, DEF_TIMEOUT); ++ mysql_options(&ci.link, MYSQL_OPT_CONNECT_TIMEOUT, &def_timeout); + mysql_options(&ci.link, MYSQL_READ_DEFAULT_GROUP, "libnss-mysql"); + + DEXIT diff -urN libnss-mysql.orig/files/patch-src::nss_mysql.h libnss-mysql/files/patch-src::nss_mysql.h --- libnss-mysql.orig/files/patch-src::nss_mysql.h Thu Jan 1 02:00:00 1970 +++ libnss-mysql/files/patch-src::nss_mysql.h Tue Jun 28 16:18:32 2005 @@ -0,0 +1,11 @@ +--- src/nss_mysql.h.orig Tue Jun 28 16:06:14 2005 ++++ src/nss_mysql.h Tue Jun 28 16:17:30 2005 +@@ -70,7 +70,7 @@ + #define MAX_QUERY_ATTEMPTS 3 /* # of query retries */ + + /* Default initializers */ +-#define DEF_TIMEOUT "3" ++#define DEF_TIMEOUT 3 + + #ifdef DEBUG + void _nss_mysql_debug (char *fmt, ...); --- libnss-mysql_def_timeout.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: