Bug #47346 Error message does not show file name
Submitted: 16 Sep 2009 2:33 Modified: 16 Sep 2009 2:45
Reporter: Diego Medina Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Proxy: Core Severity:S2 (Serious)
Version:0.8.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[16 Sep 2009 2:33] Diego Medina
Description:
Some error messages show (or try to) show the name of the Lua script file you are using, but if the path to this file is long, the filename is not shown on the error

 (critical) proxy-plugin.c:1386: (connect_server) [string "/Applications/mysql/enterprise/mysql-proxy-..."]:90: attempt to compare number with nil

How to repeat:
1- Start the proxy
2- Save this file as bug.lua

function read_query(packet)
  printed
end

3- Start the proxy like this:

./sbin/mysql-proxy  --proxy-lua-script=delete.lua 

4- Send a query through port 4040
5- On the terminal where you started the proxy, you will see:

 (critical) network-mysqld-lua.c:232: lua_load_file(/Applications/mysql/enterprise/mysql-proxy-0.8.0-osx10.5-x86-64bit/delete.lua) failed: [string "/Applications/mysql/enterprise/mysql-proxy-0.8.0-osx10.5-x86-64..."]:4: '=' expected near 'end'

While from lua_load_file, you can see the fileame, the second time the file is mentioned, the name is not shown.

There are many cases where lua_load_file() is not part of the error.

Suggested fix:
Show the full path + name of the file, or at least show the "end" of the filename, (truncate from the beginning of the path, do not truncate the end)