Bug #50657 my_getopt barfs on --loose-foo if it knows --foo-bar and --foo-baz but not --foo
Submitted: 27 Jan 2010 11:49 Modified: 29 Jan 2010 21:55
Reporter: Bjørn Munch Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: my_getopt

[27 Jan 2010 11:49] Bjørn Munch
Description:
While attempting to fix Bug #47141, I got into trouble with mysqlbinlog. When the non-debug version is passed an argument --loose-debug=.... it should ignore it but instead fails:

/home/bm136801/my/dbgmyt-51/client/.libs/mysqlbinlog.real: ambiguous option '--loose-loose-debug=d:t:A,/home/bm136801/my/dbgmyt-51/mysql-test/var/log/mysqlbinlog.trace' (--loose-debug-check)

Looking at mysqlbinlog.cc I see that without debug it accepts options 'debug-check' and 'debug-info' but not 'debug'. I presume this is what causes it.

Note also that the error message is wrong, in that an extra -loose has been added. I have confirmed using a sh wrapper that mysqlbinlog is passed just --loose-debug.

How to repeat:
Having a debug server and a non-debug mysqlbinlog, run

./mtr  --debug binlog.binlog_incident
[28 Jan 2010 8:04] Sveta Smirnova
Thank you for the report.

Verified as described.
[28 Jan 2010 8:04] Sveta Smirnova
But why did you set category to libmysqld?
[2 Feb 2011 8:40] Kristofer Pettersson
I've just tested 5.5.10-log
"./mtr --mysqld=--loose-debug=asdasd alias"
and this worked fine. 

Running "./mtr --debug=asdasd" didn't work at all.

Running "./mtr --mysqld=--loose-debug" worked also.

Running "./mtr --mysqld=--debug binlog.binlog_incident" gives me:
binlog.binlog_incident   [ skipped ]  Test needs debug binaries

Are you sure you are running a non-debug version? In which version is "./mtr --debug" implemented?
[2 Feb 2011 8:55] Bjørn Munch
It does not affect mysqld, try mysqlbinlog. That's the client that failed for me (and still does).
[2 Feb 2011 12:43] Kristofer Pettersson
ok, got it:

thek@goblin:~/bzr/mysql-5.5/bld$ client/mysqlbinlog --debug
client/mysqlbinlog: ambiguous option '--debug' (debug-check, debug-info)
thek@goblin:~/bzr/mysql-5.5/bld$ client/mysqlbinlog --loose-debug
client/mysqlbinlog: ambiguous option '--loose-debug' (--loose-debug-check)

My interpretation of the loose prefix is that critical errors which interrupts execution should turn into (at most) warnings when you use the loose-prefix.