Package: netams
Version: 3.4.5-2
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu quantal ubuntu-patch

In Ubuntu, the attached patch was applied to achieve the following:

Netams does not work correctly with current version of MySQL (5.5).
When program uses "LOAD DATA CONCURRENT LOCAL INFILE ..." statement,
MySQL's "Malformed package" error occurs.
The reason is that in previous version of mysqlclient "local infile"
option is set to "true" by default and all works correctly,
but in the latest version it is set to "false".
So according to MySQL manual 
(http://dev.mysql.com/doc/refman/5.5/en/load-data-local.html),
using of "LOAD DATA LOCAL" statement requires call of
mysql_options(..., MYSQL_OPT_LOCAL_INFILE, 0) between mysql_init()
and mysql_connect().

-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-31-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/changelog'

=== added file 'debian/patches/16_fix_mysql_load_data.patch'
--- debian/patches/16_fix_mysql_load_data.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/16_fix_mysql_load_data.patch	2012-08-05 13:14:42 +0000
@@ -0,0 +1,18 @@
+Description: Set 'local-infile' option for using with MySQL.
+	According to MySQL's manual, using of "LOAD DATA LOCAL INFILE"
+	statement requires 'local-infile' option set to 'true'. Without that,
+	'Malformed packet' error occurs.
+Author: Dmitriy Alexandrov <[email protected]>
+Index: netams.dev/src/st_sql_mysql.c
+===================================================================
+--- netams.dev.orig/src/st_sql_mysql.c	2012-08-05 15:38:01.000000000 +0400
++++ netams.dev/src/st_sql_mysql.c	2012-08-05 15:45:01.000000000 +0400
+@@ -56,6 +56,8 @@
+ 		return NULL;
+ 	}
+ 
++	mysql_options(fd, MYSQL_OPT_LOCAL_INFILE, 0);
++
+ 	my_host=cfg->hostname;
+ 	my_user=cfg->username;
+ 	my_pass=cfg->password;

=== modified file 'debian/patches/series'
--- debian/patches/series	2010-07-06 03:29:43 +0000
+++ debian/patches/series	2012-08-05 11:41:54 +0000
@@ -7,3 +7,4 @@
 13_netams_web_conf.diff
 14_fix_pthread.diff
 15_fix_ftbfs_kfreebsd.diff
+16_fix_mysql_load_data.patch

Reply via email to