Bug #25461 mysqladmin accepts --sleep parameter without a defined --count
Submitted: 8 Jan 2007 6:00 Modified: 6 May 2008 17:18
Reporter: Lachlan Mulcahy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:Any OS:Any (Any)
Assigned to: Paul DuBois CPU Architecture:Any

[8 Jan 2007 6:00] Lachlan Mulcahy
Description:
mysqladmin accepts the --sleep parameter without a corrosponding --count parameter.

This causes mysqladmin to seemingly repeat a very long time and eventually just finish.

What it looks like is occurring in the code is that mysqladmin never really initialises the count variable (nr_iterations) properly at definition time, thus, if the user does not pass the parameter on the command-line it defaults to zero.

The code decrements nr_iterations which I assume causes it to wrap to the maximum value for an unsigned int.

Part of the test in the while loop for repeated outputs is the nr_iterations variable. 

ie. while(!interupted  && (!opt_count_iterations || nr_iterations) ) ...

Presumably the counter value eventually reaches zero again, breaking out of the loop and ending the mysqladmin process.

How to repeat:
mysqladmin -i 1

Suggested fix:
Perform correct initialisation of variables and more specific condition checking.
[1 May 2008 22:41] Jim Winstead
This is intentional behavior. Specifying --sleep without any --count just repeats the operation until interrupted. This is the similar to how the standard unix 'ping' command operates. (The difference is that the unix ping runs indefinitely by default, but mysqladmin only does so when an interval is specified.)

This should get documented, so I am re-classifying as a documentation bug.
[6 May 2008 17:18] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.