Bug #36153 Compiled search path for lua scripts like for tokenizer and parser is bad
Submitted: 16 Apr 2008 19:31 Modified: 3 Jun 2009 13:32
Reporter: Lachlan Mulcahy Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Proxy: Install/Config Severity:S3 (Non-critical)
Version:0.6.1 OS:MacOS (x86)
Assigned to: CPU Architecture:Any

[16 Apr 2008 19:31] Lachlan Mulcahy
Description:
The compiled in search path for tokenizer.lua, parser.lua, etc. seems inappropriate and causes an error easily on the default Mac OSX tarball.

How to repeat:
Download the Mac OSX x86 and extract tarball - mysql-proxy-0.6.1-osx10.4-x86-32bit

shell> cd mysql-proxy-0.6.1-osx10.4-x86-32bit/sbin

create bugtest.lua:

function read_query (packet)
    local tk = require("proxy.tokenizer")

    return proxy.PROXY_SEND_QUERY
end

shell> ./mysql-proxy --proxy-lua-script=bugtest.lua

Connect to proxy and issue some query.. observe the output to shell..

(read_query) /Users/lachlan/Desktop/trash.lua:48: module 'proxy.tokenizer' not found:
	no field package.preload['proxy.tokenizer']
	no file './proxy/tokenizer.lua'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/share/lua/5.1/proxy/tokenizer.lua'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/share/lua/5.1/proxy/tokenizer/init.lua'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/proxy/tokenizer.lua'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/proxy/tokenizer/init.lua'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/mysqlproxy/share/mysql-proxy/proxy/tokenizer.lua'
	no file './proxy/tokenizer.so'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/proxy/tokenizer.so'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/loadall.so'
	no file './proxy.so'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/proxy.so'
	no file '/Users/mysqldev/mysql-proxy-32bit/inst/lua/lib/lua/5.1/loadall.so'

Suggested fix:
Fix the search path that is compiled in.
[25 Apr 2008 9:10] Sveta Smirnova
Thank you for the report.

Verified as described.

Workaround: replace libraries into searchable directories manually.
[3 Jun 2009 13:32] Kay Roepke
We believe this issue has been addressed in the latest version (0.7.1) of MySQL Proxy.

Formerly the actual executable was found in sbin/ but it needed the environment variables set in the bin/mysql-proxy script.
We moved the actual executable to libexec/mysql-proxy to make clear that it should not be executed directly by the user.

Calling sbin/mysql-proxy now works as expected.