Commit graph

3399 commits

Author SHA1 Message Date
Tor Didriksen
4a35c6d44b Bug#16027468 ADDRESSSANITIZER BUG IN MYSQLTEST
DBUG_ENTER and DBUG_LEAVE must *always* match,
otherwise all subsequent DBUG_ENTER calls will 
be poking into undefined stack frames.
2012-12-20 10:56:09 +01:00
Anirudh Mangipudi
14dfe6fcc8 BUG#11762933: MYSQLDUMP WILL SILENTLY SKIP THE EVENT
TABLE DATA IF DUMPS MYSQL DATABA
Problem: If mysqldump is run without --events (or with --skip-events)
it will not dump the mysql.event table's data. This behaviour is inconsistent
with that of --routines option, which does not affect the dumping of
mysql.proc table. According to the Manual, --events (--skip-events) defines,
if the Event Scheduler events for the dumped databases should be included
in the mysqldump output and this has nothing to do with the mysql.event table
itself.
Solution: A warning has been added when mysqldump is used without --events 
(or with --skip-events) and a separate patch with the behavioral change 
will be prepared for 5.6/trunk.
2012-11-09 15:15:16 +05:30
Nirbhay Choubey
f820334bbf Bug#14645196 MYSQL CLIENT'S USE COMMAND FAILS
WHEN DBNAME CONTAINS MULTIPLE QUOTES

MySQL client's USE command might fail if the
database name contains multiple quotes (backticks).

The reason behind the failure being the method
that client uses to remove/escape the quotes
while parsing the USE command's option (dbname),
where the option parsing might terminate if a
matching quote is found.

Also, C-APIs like mysql_select_db() expect a
normalized dbname. Now, in certain cases, client
might fail to normalize dbname similar to that of
server and hence mysql_select_db() would fail.

Fixed by getting the normalized dbname (indirectly)
from the server by directly sending the "USE dbanme"
as query to the server followed by a "SELECT DATABASE()".
The above steps are only performed if number of quotes
in the dbname is greater than 2. Once the normalized
dbname is received, the original db is restored.
2012-09-21 23:28:55 +05:30
Rohit Kalhans
ff04c5bd6e BUG#11757312: MYSQLBINLOG DOES NOT ACCEPT INPUT FROM STDIN
WHEN STDIN IS A PIPE
            
Problem: Mysqlbinlog does not accept the input from STDIN when 
STDIN is a pipe. This prevents the users from passing the input file
through a shell pipe.    

Background: The my_seek() function does not check if the file descriptor
passed to it is regular (seekable) file. The check_header() function in
mysqlbinlog calls the my_b_seek() unconditionally and it fails when
the underlying file is a PIPE.  
            
Resolution: We resolve this problem by checking if the underlying file
is a regular file by using my_fstat() before calling my_b_seek(). 
If the underlying file is not seekable we skip the call to my_b_seek()
in check_header().

client/mysqlbinlog.cc:
  Added a check to avoid the my_b_seek() call if the
  underlying file is a PIPE.
2012-08-08 22:15:46 +05:30
Nirbhay Choubey
5ad8292c63 Bug#13928675 MYSQL CLIENT COPYRIGHT NOTICE MUST
SHOW 2012 INSTEAD OF 2011

* Added a new macro to hold the current year :
  COPYRIGHT_NOTICE_CURRENT_YEAR
* Modified ORACLE_WELCOME_COPYRIGHT_NOTICE macro
  to take the initial year as parameter and pick
  current year from the above mentioned macro.
2012-08-07 18:58:19 +05:30
Tor Didriksen
d24a78d1ea Backport of Bug#14171740 65562: STRING::SHRINK SHOULD BE A NO-OP WHEN ALLOCED=0 2012-07-26 15:05:24 +02:00
Venkata Sidagam
913e3a8475 Bug #12615411 - server side help doesn't work as first statement
Problem description:
Giving "help 'contents'" in the mysql client as a first statement
gives error

Analysis:
In com_server_help() function the "server_cmd" variable was
initialised with buffer->ptr(). And the "server_cmd" variable is not
updated since we are passing "'contents'"(with single quote) so the
buffer->ptr() consists of the previous buffer values and it was sent
to the mysql_real_query() hence we are getting error.

Fix:
We are not initialising the "server_cmd" variable and we are updating
the variable with "server_cmd= cmd_buf" in any of the case i.e with
single quote or without single quote for the contents.
As part of error message improvement, added new error message in case
of "help 'contents'".

client/mysql.cc:
  com_server_help(): Properly updated the server_cmd variable and improved
  the error message.
2012-07-19 13:52:34 +05:30
Sujatha Sivakumar
13f7f00288 BUG#11762670:MY_B_WRITE RETURN VALUE IGNORED
Problem:
=======
The return value from my_b_write is ignored by: `my_b_write_quoted',
`my_b_write_bit',`Query_log_event::print_query_header'

Most callers of `my_b_printf' ignore the return value. `log_event.cc' 
has many calls to it. 

Analysis:
========
`my_b_write' is used to write data into a file. If the write fails it
sets appropriate error number and error message through my_error()
function call and sets the IO_CACHE::error == -1.
`my_b_printf' function is also used to write data into a file, it
internally invokes my_b_write to do the write operation. Upon
success it returns number of characters written to file and on error
it returns -1 and sets the error through my_error() and also sets
IO_CACHE::error == -1.  Most of the event specific print functions
for example `Create_file_log_event::print', `Execute_load_log_event::print'
etc are the ones which make several calls to the above two functions and
they do not check for the return value after the 'print' call. All the above 
mentioned abuse cases deal with the client side.

Fix:
===
As part of bug fix a check for IO_CACHE::error == -1 has been added at 
a very high level after the call to the 'print' function.  There are 
few more places where the return value of "my_b_write" is ignored
those are mentioned below.

+++ mysys/mf_iocache2.c    2012-06-04 07:03:15 +0000
@@ -430,7 +430,8 @@
           memset(buffz, '0', minimum_width - length2);
         else
           memset(buffz, ' ', minimum_width - length2);
-        my_b_write(info, buffz, minimum_width - length2);

+++ sql/log.cc	2012-06-08 09:04:46 +0000
@@ -2388,7 +2388,12 @@
     {
       end= strxmov(buff, "# administrator command: ", NullS);
       buff_len= (ulong) (end - buff);
-      my_b_write(&log_file, (uchar*) buff, buff_len);

At these places appropriate return value handlers have been added.

client/mysqlbinlog.cc:
  check for IO_CACHE::error == -1 has been added after the call to
  the event specific print functions
mysys/mf_iocache2.c:
  Added handler to check the written value of `my_b_write'
sql/log.cc:
  Added handler to check the written value of `my_b_write'
sql/log_event.cc:
  Added error simulation statements in `Create_file_log_event::print`
  and `Execute_load_query_log_event::print'
sql/rpl_utility.h:
  Removed the extra ';'
2012-07-10 14:23:17 +05:30
Georgi Kodinov
107c894a54 Bug #13708485: malformed resultset packet crashes client
Several fixes :

* sql-common/client.c
Added a validity check of the fields metadata packet sent 
by the server.
Now libmysql will check if the length of the data sent by
the server matches what's expected by the protocol before
using the data.

* client/mysqltest.cc
Fixed the error handling code in mysqltest to avoid sending
new commands when the reading the result set failed (and 
there are unread data in the pipe).

* sql_common.h + libmysql/libmysql.c + sql-common/client.c
unpack_fields() now generates a proper error when it fails.
Added a new argument to this function to support the error 
generation.

* sql/protocol.cc
Added a debug trigger to cause the server to send a NULL
insted of the packet expected by the client for testing 
purposes.
2012-06-28 18:38:55 +03:00
Jon Olav Hauglid
1ede2dd814 Bug#14238406 NEW COMPILATION WARNINGS WITH GCC 4.7 (-WERROR=NARROWING)
This patch fixes various compilation warnings of the type
"error: narrowing conversion of 'x' from 'datatype1' to
'datatype2'
2012-06-29 13:25:57 +02:00
Rohit Kalhans
d8b2d4a069 Bug#11762667: MYSQLBINLOG IGNORES ERRORS WHILE WRITING OUTPUT
Problem: mysqlbinlog exits without any error code in case of
file write error. It is because of the fact that the calls
to Log_event::print() method does not return a value and the
thus any error were being ignored.

Resolution: We resolve this problem by checking for the 
IO_CACHE::error == -1 after every call to Log_event:: print()
and terminating the further execution.

client/mysqlbinlog.cc:
  - handled error conditions during event->print() calls
  - added check for error in end_io_cache()
mysys/my_write.c:
  Added debug code to simulate file write error.
  error returned will be ENOSPC=> error no space on the disk
sql/log_event.cc:
  Added debug code to simulate file write error, by reducing the size of io cache.
2012-05-29 12:11:30 +05:30
Venkata Sidagam
e7364ec29c Bug #11754178 45740: MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY
CAUSES RESTORE PROBLEM
Problem Statement:
------------------
mysqldump is not having the dump stmts for general_log and slow_log
tables. That is because of the fix for Bug#26121. Hence, after 
dropping the mysql database, and applying the dump by enabling the 
logging, "'general_log' table not found" errors are logged into the 
server log file.

Analysis:
---------
As part of the fix for Bug#26121, we skipped the dumping of tables 
for general_log and slow_log, because the data dump of those tables 
are taking LOCKS, which is not allowed for log tables.

Fix:
----
We came up with an approach that instead of taking both meta data 
and data dump information for those tables, take only the meta data 
dump which doesn't need LOCKS.
As part of fixing the issue we came up with below algorithm.
Design before fix:
1) mysql database is having tables like db, event,... general_log,
   ... slow_log...
2) Skip general_log and slow_log while preparing the tables list
3) Take the TL_READ lock on tables which are present in the table 
   list and do 'show create table'.
4) Release the lock.

Design with the fix:
1) mysql database is having tables like db, event,... general_log,
   ... slow_log...
2) Skip general_log and slow_log while preparing the tables list
3) Explicitly call the 'show create table' for general_log and 
   slow_log
3) Take the TL_READ lock on tables which are present in the table 
   list and do 'show create table'.
4) Release the lock.

While taking the meta data dump for general_log and slow_log the 
"CREATE TABLE" is replaced with "CREATE TABLE IF NOT EXISTS". 
This is because we skipped "DROP TABLE" for those tables, 
"DROP TABLE" fails for these tables if logging is enabled. 
Customer is applying the dump by enabling logging so, if the dump 
has "DROP TABLE" it will fail. Hence, removed the "DROP TABLE" 
stmts for those tables.
  
After the fix we could observe "Table 'mysql.general_log' 
doesn't exist" errors initially that is because in the customer 
scenario they are dropping the mysql database by enabling the 
logging, Hence, those errors are expected. Once we apply the 
dump which is taken before the "drop database mysql", the errors 
will not be there.

client/mysqldump.c:
  In get_table_structure() added code to skip the DROP TABLE stmts for general_log
  and slow_log tables, because when logging is enabled those stmts will fail. And
  replaced CREATE TABLE with CREATE IF NOT EXISTS for those tables, just to make 
  sure CREATE stmt for those tables doesn't fail since we removed DROP stmts for
  those tables.
  In dump_all_tables_in_db() added code to call get_table_structure() for 
  general_log and slow_log tables.
mysql-test/r/mysqldump.result:
  Added a test as part of fix for Bug #11754178
mysql-test/t/mysqldump.test:
  Added a test as part of fix for Bug #11754178
2012-05-07 16:46:44 +05:30
Venkata Sidagam
af90fc04ff Bug #11766072 59107: MYSQLSLAP CRASHES IF STARTED WITH NO ARGUMENTS ON WINDOWS
This bug is a duplicate of Bug #31173, which was pushed to the 
mysql-trunk 5.6 on 4th Aug, 2010. This is just a back-port of 
the fix


mysql-test/r/mysqlslap.result:
  A test added as part of the fix for Bug #59107
mysql-test/t/mysqlslap.test:
  A test added as part of the fix for Bug #59107
2012-04-09 16:42:41 +05:30
Karen Langford
2efa0ec676 AIX builds fail for comments using // 2012-02-28 17:20:30 +01:00
Kent Boortz
6a003dd8ef Updated/added copyright headers 2012-02-15 17:21:38 +01:00
MySQL Build Team
7177a2b9d7 Updated/added copyright headers 2012-02-15 17:13:47 +01:00
Nirbhay Choubey
2bffb8b1de Bug #11760384 52792: MYSQLDUMP IN XML MODE DOES NOT
DUMP ROUTINES

Minor post-fix to avoid build failure when built with
Werror.
2012-01-17 09:10:58 +05:30
Nirbhay Choubey
99e462ab0b BUG#11760384 - 52792: mysqldump in XML mode does not dump
routines.

mysqldump in xml mode did not dump routines, events or
triggers.

This patch fixes this issue by fixing the if conditions
that disallowed the dump of above mentioned objects in
xml mode, and added the required code to enable dump
in xml format.


client/mysqldump.c:
  BUG#11760384 - 52792: mysqldump in XML mode does not dump
                        routines.
  
  Fixed some if conditions to allow execution of dump methods
  for xml and further added the relevant code at places to produce
  the dump in xml format.
mysql-test/r/mysqldump.result:
  Added a test case for Bug#11760384.
mysql-test/t/mysqldump.test:
  Added a test case for Bug#11760384.
2012-01-10 13:33:45 +05:30
Tor Didriksen
98adda5095 Build broken for gcc 4.5.1 in optimized mode.
readline.cc: In function char* batch_readline(LINE_BUFFER*):
readline.cc:60:9: error: out_length may be used uninitialized in this function
log.cc: In function int find_uniq_filename(char*):
log.cc:1857:8: error: number may be used uninitialized in this function
2011-11-29 15:52:47 +01:00
Tor Didriksen
0e2af2cdd3 Bug#12406055 post-push fix: unused variable 'num_chars' in optimized build.
Also fixed possibly uninitialized use of need_copy_table_res.
2011-11-01 07:50:54 +01:00
Georgi Kodinov
98231daa6f auto-merge mysql-5.0->mysql-5.0-security 2011-10-12 14:33:09 +03:00
Raghav Kapoor
ffd0a785f4 BUG#11758062 - 50206: ER_TOO_BIG_SELECT REFERS TO OUTMODED
SYSTEM VARIABLE NAME SQL_MAX_JOIN_SI 

BACKGROUND:

ER_TOO_BIG_SELECT refers to SQL_MAX_JOIN_SIZE, which is the
old name for MAX_JOIN_SIZE.

FIX:

Support for old name SQL_MAX_JOIN_SIZE is removed in MySQL 5.6
and is renamed as MAX_JOIN_SIZE.So the errmsg.txt 
and mysql.cc files have been updated and the corresponding result
files have also been updated.
2011-09-28 15:39:21 +05:30
Bjorn Munch
031b52c415 merge from 5.1 main 2011-09-26 10:06:25 +02:00
Bjorn Munch
52960624d3 Bug #12793118 MYSQLTEST: --ERROR AND --DISABLE_ABORT_ON_ERROR DO NOT WORK FOR SQL IN COMMANDS
Call handle_error() instead of die() when evaluating these
  Must remember "current command" with link to errors to ignore
  Added test cases to mysqltest.test
2011-09-14 15:19:24 +02:00
Ramil Kalimullin
c7087cd53c Manual merge from mysql-5.1. 2011-08-09 11:42:07 +04:00
Alexander Nozdrin
3a786df2d5 Manual merge from mysql-5.0. 2011-07-22 11:46:45 +04:00
Alexander Nozdrin
cb5239954b For for Bug#12696072: FIX OUTDATED COPYRIGHT NOTICES IN RUNTIME RELATED CLIENT
TOOLS

Backport a fix for Bug 57094 from 5.5.
The following revision was backported:

# revision-id: alexander.nozdrin@oracle.com-20101006150613-ls60rb2tq5dpyb5c
# parent: bar@mysql.com-20101006121559-am1e05ykeicwnx48
# committer: Alexander Nozdrin <alexander.nozdrin@oracle.com>
# branch nick: mysql-5.5-bugteam-bug57094
# timestamp: Wed 2010-10-06 19:06:13 +0400
# message:
#   Fix for Bug 57094 (Copyright notice incorrect?).
#   
#   The fix is to:
#     - introduce ORACLE_WELCOME_COPYRIGHT_NOTICE define to have a single place
#       to specify copyright notice;
#     - replace custom copyright notices with ORACLE_WELCOME_COPYRIGHT_NOTICE
#       in programs.
2011-07-22 11:45:15 +04:00
Tor Didriksen
93915d0d50 merge 5.0-security => 5.1-security 2011-07-15 14:08:14 +02:00
Tor Didriksen
cfcd49b467 Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
The buffer was simply too small.
In 5.5 and trunk, the size is 311 + 31,
in 5.1 and below, the size is 331


client/sql_string.cc:
  Increase buffer size in String::set(double, ...)
include/m_string.h:
  Increase FLOATING_POINT_BUFFER
mysql-test/r/type_float.result:
  New test cases.
mysql-test/t/type_float.test:
  New test cases.
sql/sql_string.cc:
  Increase buffer size in String::set(double, ...)
sql/unireg.h:
  Move definition of FLOATING_POINT_BUFFER
2011-07-15 14:07:38 +02:00
Luis Soares
e018925a64 BUG#12695969
Manually merged mysql-5.0 into mysql-5.1.

conflicts
=========
client/mysqlibinlog.cc
2011-07-11 17:13:27 +01:00
Luis Soares
686182b273 BUG#12695969: FIX OUTDATED COPYRIGHT NOTICES IN REPLACTION
CLIENT TOOLS
      
The fix is to backport part of revision:
        
  - alexander.nozdrin@oracle.com-20101006150613-ls60rb2tq5dpyb5c
      
from mysql-5.5. In detail, we add the oracle welcome notice
header file proposed in the original patch and include/use it
in client/mysqlbinlog.cc, replacing the existing and obsolete
notice.
2011-07-11 17:11:41 +01:00
Kent Boortz
027b5f1ed4 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Luis Soares
902e64dafe BUG#12354268
Automerged bzr bundle from bug report:
luis.soares@oracle.com-20110505224815-6ob90n7suxsoizvs.bundle
2011-05-06 00:54:36 +01:00
Luis Soares
8a08fd4341 BUG#11762616: BUG#55229: 'POSTION'
Fix for all "postion" in Oracle files (s/postion/position). 
Updated the copyright notices where needed.
2011-05-06 00:46:53 +01:00
Luis Soares
0efb452e5e BUG#12354268: MYSQLBINLOG --BASE64-OUTPUT=DECODE-ROWS DOES NOT
WORK WITH --START-POSITION
      
If setting --start-position to start after the FD event, mysqlbinlog
will output an error stating that it has not found an FD event.
However, its not that mysqlbinlog does not find it but rather that it
does not processes it in the regular way (i.e., it does not print it).
Given that one is using --base64-output=DECODE-ROWS then not printing
it is actually fine.
      
To fix this, we make mysqlbinlog not to complain when it has not
printed the FD event, is outputing in base64, but is decoding the
rows.
2011-05-05 23:48:15 +01:00
Kent Boortz
f9abd1ab31 Remove soft links in the build directory, not the source directory (Bug#43312) 2011-05-03 16:02:31 +02:00
Vasil Dimov
6308205f05 Merge mysql-5.1 -> mysql-5.1-innodb 2011-04-21 11:08:05 +03:00
Nirbhay Choubey
cb0e49c000 Bug#11765157 - 58090: mysqlslap drops schema specified in
create_schema if auto-generate-sql also set.

mysqlslap uses a schema to run its tests on and later
drops it if auto-generate-sql is used. This can be a
problem, if the schema is an already existing one.

If create-schema is used with auto-generate-sql option,
mysqlslap while performing the cleanup, drops the specified
database.

Fixed by introducing an option --no-drop, which, if used,
will prevent the dropping of schema at the end of the test.


client/client_priv.h:
  Bug#11765157 - 58090: mysqlslap drops schema specified in
                 create_schema if auto-generate-sql also set.
  
  Added an option.
client/mysqlslap.c:
  Bug#11765157 - 58090: mysqlslap drops schema specified in
                 create_schema if auto-generate-sql also set.
  
  Introduced an option 'no-drop' to forbid the removal of schema
  even if 'create' or 'auto-generate-sql' options are used.
mysql-test/r/mysqlslap.result:
  Added a testcase for Bug#11765157.
mysql-test/t/mysqlslap.test:
  Added a testcase for Bug#11765157.
2011-04-08 12:22:44 +05:30
Marko Mäkelä
0ff2a182b6 Bug #11766513 - 59641: Prepared XA transaction in system after hard crash
causes future shutdown hang

InnoDB would hang on shutdown if any XA transactions exist in the
system in the PREPARED state. This has been masked by the fact that
MySQL would roll back any PREPARED transaction on shutdown, in the
spirit of Bug #12161 Xa recovery and client disconnection.

[mysql-test-run] do_shutdown_server: Interpret --shutdown_server 0 as
a request to kill the server immediately without initiating a
shutdown procedure.

xid_cache_insert(): Initialize XID_STATE::rm_error in order to avoid a
bogus error message on XA ROLLBACK of a recovered PREPARED transaction.

innobase_commit_by_xid(), innobase_rollback_by_xid(): Free the InnoDB
transaction object after rolling back a PREPARED transaction.

trx_get_trx_by_xid(): Only consider transactions whose
trx->is_prepared flag is set. The MySQL layer seems to prevent
attempts to roll back connected transactions that are in the PREPARED
state from another connection, but it is better to play it safe. The
is_prepared flag was introduced in the InnoDB Plugin.

trx_n_prepared: A new counter, counting the number of InnoDB
transactions in the PREPARED state.

logs_empty_and_mark_files_at_shutdown(): On shutdown, allow
trx_n_prepared transactions to exist in the system.

trx_undo_free_prepared(), trx_free_prepared(): New functions, to free
the memory objects of PREPARED transactions on shutdown. This is not
needed in the built-in InnoDB, because it would collect all allocated
memory on shutdown. The InnoDB Plugin needs this because of
innodb_use_sys_malloc.

trx_sys_close(): Invoke trx_free_prepared() on all remaining
transactions.
2011-04-07 21:12:54 +03:00
Sven Sandberg
f1b638d33c BUG#11766427, BUG#59539: Filter by server id in mysqlbinlog fails
Problem: mysqlbinlog --server-id may filter out Format_description_log_events.
If mysqlbinlog does not process the Format_description_log_event,
then mysqlbinlog cannot read the rest of the binary log correctly.
This can have the effect that mysqlbinlog crashes, generates an error,
or generates output that causes mysqld to crash, generate an error,
or corrupt data.
Fix: Never filter out Format_description_log_events. Also, never filter
out Rotate_log_events.


client/mysqlbinlog.cc:
  Process Format_description_log_events even when the
  server_id does not match the number given by --server-id.
mysql-test/t/mysqlbinlog.test:
  Add test case.
2011-03-25 15:16:13 +01:00
Bjorn Munch
c85237485a Bug #11885854 MYSQLTEST: PS-PROTOCOL IMPLIED BY CURSOR-PROTOCOL LOST AFTER ENABLE_PS_PROTOCOL
The condition cursor-protocol => ps-protocol was done at "current setting" level"
Moved it to "set by command line" level
2011-03-18 12:13:54 +01:00
Nirbhay Choubey
876502d743 Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH
("-") IN DATABASE NAMES IN ALTER DATABASE.

mysqldump did not quote database name in 'ALTER DATABASE'
statements in its output. This can further cause a failure
while loading if database name contains a hyphen '-'.

This happened as, while printing the 'ALTER DATABASE'
statements, the database name was not quoted.

Fixed by quoting the database name.


client/mysqldump.c:
  Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH
                 ("-") IN DATABASE NAMES IN ALTER DATABASE.
  
  Modified the print statement in order to print the quoted
  database name for 'ALTER DATABASE' statements.
mysql-test/r/mysqldump.result:
  Added a test case for bug#11766310.
mysql-test/t/mysqldump.test:
  Added a test case for bug#11766310.
2011-02-21 12:37:24 +05:30
Dmitry Shulga
960ae6da6a Follow up fix for bug#57450.
batch_readline_init() was modified - make check for 
type of file for input stream unless target platform
is WINDOWS since on this platform S_IFBLK is undefined.
2011-02-09 17:13:17 +06:00
Dmitry Shulga
c46e20f6c1 Follow up fix for bug#57450.
batch_readline_init() was modified - return an error
if the input source is a directory or a block device.

This follow-up is necessary because on some platforms,
such as Solaris, call to read() from directory may be
successful.
2011-02-09 12:46:12 +06:00
Dmitry Shulga
980868eb4e Fixed bug#57450 - mysql client enter in an infinite loop
if the standard input is a directory.

The problem is that mysql monitor try to read from stdin without
checking input source type.

The solution is to stop reading data from standard input if a call
to read(2) failed.

A new test case was added into mysql.test.

client/my_readline.h:
  Data members error and truncated was added to LINE_BUFFER structure.
  These data members used instead of out parameters in functions
  batch_readline, intern_read_line.
client/mysql.cc:
  read_and_execute() was modified: set status.exit_status to 1
  when the error occured while reading the next command line in
  non-interactive mode. Also the value of the truncated attribute
  of structure LINE_BUFF is taken into account only for non-iteractive mode.
client/readline.cc:
  intern_read_line() was modified: cancel reading from input if
  fill_buffer() returns -1, e.g. if call to read failed.
  batch_readline was modified: set the error data member of LINE_BUFFER
  structure to value of my_errno when system error happened during call
  to my_read/my_realloc.
mysql-test/t/mysql.test:
  Test for bug#57450 was added.
2011-02-05 11:02:00 +06:00
Mattias Jonsson
ad74ed74d9 merge 2011-01-26 16:34:34 +01:00
Bjorn Munch
5a85609d6b Fixed copyright headers in mtr src files 2011-01-18 11:03:44 +01:00
Nirbhay Choubey
208b677637 Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
When mysqldadmin is run with sleep and count options,
it goes into an infinite loop and keeps executing the
specified command.

This happened because the statement, responsible for
decrementing the count value, was missing.

Fixed by adding a statement which will decrement the
count value for each iteration.


client/mysqladmin.cc:
  Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
  
  Added a condition to check and decrement the count
  value stored in nr_iterations per iteration.
mysql-test/r/mysqladmin.result:
  Added a testcase for Bug#58221.
mysql-test/t/mysqladmin.test:
  Added a testcase for Bug#58221.
2011-01-16 02:04:08 +05:30