Bug #69293 auto_config.lua and boolean variables and literals
Submitted: 21 May 2013 15:46 Modified: 16 Jan 2015 18:52
Reporter: Konrad Stepien Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Proxy: Scripts Severity:S3 (Non-critical)
Version:0.8.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: auto_config lua boolean

[21 May 2013 15:46] Konrad Stepien
Description:
auto-config.lua script incorrectly handles boolean variables, and don't recognize literals witch underscore.

How to repeat:
mysql-proxy --proxy-lua-script=/usr/lib64/mysql-proxy/lua/analyze-query.lua

PROXY SET GLOBAL analyze_query.analyze_queries = true ;

Suggested fix:
--- /root/auto-config.lua	2013-05-21 17:27:46.568287484 +0200
+++ auto-config.lua	2013-05-21 17:40:05.502287704 +0200
@@ -36,7 +36,7 @@
 
 	if t == "boolean" then
 		if token[1] == "boolean" then
-			return token[2] == "true" and true and false
+			return token[2] == "true"
 		else
 			return nil, "(auto-config) expected a boolean, got " .. token[1]
 		end
@@ -116,7 +116,7 @@
 local FROM   = lpeg_ci_str("FROM") * WS^1
 local DOT    = l.P(".")
 local EQ     = WS^0 * l.P("=") * WS^0
-local literal = l.R("az", "AZ") ^ 1
+local literal = l.R("az", "AZ", "__") ^ 1
 local string_quoted  = l.P("\"") * ( 1 - l.P("\"") )^0 * l.P("\"") -- /".*"/
 local digit  = l.R("09")       -- [0-9]
 local number = (l.P("-") + "") * digit^1         -- [0-9]+
@@ -165,7 +165,7 @@
 				type = proxy.MYSQLD_PACKET_ERR,
 				errmsg = "module not known"
 			}
-		elseif not tbl[tokens[2]][tokens[3]] then
+		elseif tbl[tokens[2]][tokens[3]] == nil then
 			proxy.response = {
 				type = proxy.MYSQLD_PACKET_ERR,
 				errmsg = "option not know"
@@ -174,7 +174,7 @@
 			-- do the assignment
 			local val, errmsg = parse_value(tbl[tokens[2]][tokens[3]], tokens[4])
 
-			if not val then
+			if val == nil then
 				proxy.response = {
 					type = proxy.MYSQLD_PACKET_ERR,
 					errmsg = errmsg
[16 Dec 2014 18:52] Sveta Smirnova
Thank you for the report.

Please try with current version 0.8.5 and, if problem still exists, provide full command you use to start proxy.
[17 Jan 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".