Bug #33809 Must specify full path to the mysql-proxy executable
Submitted: 10 Jan 2008 22:04 Modified: 25 Jun 2008 13:16
Reporter: Peter Lavin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S3 (Non-critical)
Version:0.7.0 OS:Linux (SuSE 10.3)
Assigned to: Kay Roepke CPU Architecture:Any
Tags: path

[10 Jan 2008 22:04] Peter Lavin
Description:
'mysql-proxy' is located in the default directory (/usr/local/sbin) and this directory is in my PATH variable. If I invoke mysql-proxy without the full path I can't use the "--proxy-lua-script" option. However, /usr/local/sbin/mysql-proxy --proxy-lua-script= ... works just fine.

I have the same issue with the --help-all option.

How to repeat:
See above.

Suggested fix:
See above
[11 Jan 2008 10:25] Kay Roepke
Hi Peter!

I cannot repeat this issue with the neither the current trunk version (reports itself as 0.7.0) and the upcoming release (0.6.1). Both versions work as expected.

Are you really using 0.7.0, because that version doesn't have a '--help-all' option any more.

What is the error message?

Thanks,
Kay
[11 Jan 2008 10:28] Kay Roepke
Sorry, I meant to say "it doesn't have the --proxy-lua-script option any more".
[11 Jan 2008 10:44] Giuseppe Maxia
I can repeat the fault on Linux.

$ /usr/local/sbin/mysql-proxy --version                                                               
mysql-proxy 0.7.0
  glib2: 2.12.9
  libevent: 1.1a

$ export PATH=/usr/local/sbin:$PATH                                                                   

$ which mysql-proxy                                                                                   
/usr/local/sbin/mysql-proxy

$ mysql-proxy --version                                                                               
mysql-proxy 0.7.0
  glib2: 2.12.9
  libevent: 1.1a

$ mysql-proxy --help-all                                                                              
Usage:
  mysql-proxy [OPTION...] - MySQL App Shell

Help Options:
  -?, --help                                         Show help options

Application Options:
  -V, --version                                      Show version
  --defaults-file=<file>                             configuration file
  --daemon                                           Start in daemon-mode
  --pid-file=<file>                                  PID file in case we are started as daemon
  --plugin-dir=<path>                                path to the plugins
  --plugins=<name>                                   plugins to load
  --log-level=(error|warning|info|message|debug)     log all messages of level ... or higer
  --log-file=<file>                                  log all messages in a file
  --log-use-syslog                                   send all log-messages to syslog

$ /usr/local/sbin/mysql-proxy --help-all                                                              
Usage:
  mysql-proxy [OPTION...] - MySQL App Shell

Help Options:
  -?, --help                                          Show help options
  --help-all                                          Show all help options
  --help-admin                                        Show options for the admin-module
  --help-proxy                                        Show options for the proxy-module

admin-module
  --admin-address=<host:port>                         listening address:port of the admin-server (default: :4040)

proxy-module
  --proxy-address=<host:port>                         listening address:port of the proxy-server (default: :4040)
  --proxy-read-only-backend-addresses=<host:port>     address:port of the remote slave-server (default: not set)
  --proxy-backend-addresses=<host:port>               address:port of the remote backend-servers (default: 127.0.0.1:3306)
  --proxy-skip-profiling                              disables profiling of queries (default: enabled)
  --proxy-fix-bug-25371                               fix bug #25371 (mysqld > 5.1.12) for older libmysql versions
  --proxy-lua-script=<file>                           filename of the lua script (default: not set)
  --no-proxy                                          don't start the proxy-module (default: enabled)

Application Options:
  -V, --version                                       Show version
  --defaults-file=<file>                              configuration file
  --daemon                                            Start in daemon-mode
  --pid-file=<file>                                   PID file in case we are started as daemon
  --plugin-dir=<path>                                 path to the plugins
  --plugins=<name>                                    plugins to load
  --log-level=(error|warning|info|message|debug)      log all messages of level ... or higer
  --log-file=<file>                                   log all messages in a file
  --log-use-syslog                                    send all log-messages to syslog

$ /usr/local/sbin/mysql-proxy --proxy-lua-script=/usr/local/share/mysql-proxy/xtab.lua                

# OK

$ mysql-proxy --proxy-lua-script=/usr/local/share/mysql-proxy/xtab.lua                                
2008-01-11 11:44:10: (critical) Unknown option --proxy-lua-script=/usr/local/share/mysql-proxy/xtab.lua
[11 Jan 2008 10:54] Kay Roepke
Scrap my comment about the option, I had a typo in my grep.
[11 Jan 2008 14:40] Peter Lavin
I get the exact same results as Giuseppe with the following minor difference in libraries:

glib2 2.14.1-4.2
libevent 1.3b-36
[23 Jan 2008 12:19] Kay Roepke
This will be fixed in an upcoming version. Here's the mini-patch:

Index: src/chassis.c
===================================================================
--- src/chassis.c	(revision 360)
+++ src/chassis.c	(working copy)
@@ -359,7 +359,7 @@
 		plugin_names = g_new0(char *, 3);
 
 #define IS_PNAME(pname) \
-		((strlen(argv[0]) > sizeof(pname) - 1) && \
+		((strlen(argv[0]) >= sizeof(pname) - 1) && \
 		 0 == strcmp(argv[0] + strlen(argv[0]) - (sizeof(pname) - 1), pname) \
 		)
[7 May 2008 15:59] Kay Roepke
Re-opening because:

On Windows, the macro doesn't take into account the optional .exe suffix and fails to load the default plugins.
[25 Jun 2008 13:16] Kay Roepke
the windows code path is now fixed to also look for .exe suffixes