Commit graph

811 commits

Author SHA1 Message Date
Vladislav Vaintroub
2377eed362 Bug #47423 mtr connects to wrong database
The reason for the bug is that mysqtest as well as other client tools
running in test suite (mysqlbinlog, mysqldump) will first try to connect 
whatever database has created shared memory with default base name 
"MySQL" and use this. (Same effect could be seen on Unix if mtr would
not care to calculate "port" and "socket" parameter).
      
The fix ensures that all client tools and  running in mtr use unique  
per-database shared memory base parameters, so there is no possibility
to clash with already installed one. We use socket name for shared memory 
base (it's known to be unique). This shared-memory-base is written to the
MTR config file to the [client] and [mysqld] sections. Fix made also made 
sure all client tools understand and correctly handle --shared-memory-base.
Prior to this patch  it was not the case for  mysqltest, mysqlbinlog and 
mysql_client_test.
      
All new connections done from mtr scripts via connect() will by default 
set shared-memory-base. And finally, there is a possibility to force 
shared memory or pipe connection and overwrite shared memory/pipe base name
from within mtr scripts via optional PIPE or SHM modifier. This functionality
was manually backported from 6.0
(original patch  http://lists.mysql.com/commits/74749)
2009-11-03 01:19:37 +01:00
Georgi Kodinov
27065edafb fixed compilation warnings 2009-09-02 13:09:01 +03:00
Davi Arnaut
169f7da04c Fix for a few assorted compiler warnings.
client/mysql.cc:
  Remove leading whitespace.
  Remove extra text after #else directive.
client/mysqldump.c:
  Function does not take a parameter.
mysys/array.c:
  buffer is a uchar pointer.
sql/item.cc:
  Assert if it should not happen.
storage/myisam/mi_check.c:
  Cast to expected type. This is probably a bug, but it is
  casted in a similar way in another part of the code.
storage/ndb/include/mgmapi/ndb_logevent.h:
  Apply fix from cluster team.
tests/mysql_client_test.c:
  Remove extraneous slash.
2009-08-28 12:06:59 -03:00
Davi Arnaut
19b325499e Manual merge. 2009-08-10 15:46:20 -03:00
Davi Arnaut
c7163c630a Bug#45010: invalid memory reads during parsing some strange statements
The problem is that the lexer could inadvertently skip over the
end of a query being parsed if it encountered a malformed multibyte
character. A specially crated query string could cause the lexer
to jump up to six bytes past the end of the query buffer. Another
problem was that the laxer could use unfiltered user input as
a signed array index for the parser maps (having upper and lower
bounds 0 and 256 respectively).

The solution is to ensure that the lexer only skips over well-formed
multibyte characters and that the index value of the parser maps
is always a unsigned value.

mysql-test/r/ctype_recoding.result:
  Update test case result: ending backtick is not skipped over anymore.
sql/sql_lex.cc:
  Characters being analyzed must be unsigned as they can be
  used as indexes for the parser maps. Only skip over if the
  string is a valid multi-byte sequence.
tests/mysql_client_test.c:
  Add test case for Bug#45010
2009-08-07 23:32:01 -03:00
Davi Arnaut
ba7d1a514b Merge from mysql-5.1. 2009-08-04 10:50:20 -03:00
Davi Arnaut
b113183df2 Merge from mysql-5.0. 2009-08-04 10:47:18 -03:00
Davi Arnaut
c721cef54f Merge from mysql-5.0-bugteam. 2009-07-27 15:24:43 -03:00
Davi Arnaut
d5e84db34c Bug#20023: mysql_change_user() resets the value of SQL_BIG_SELECTS
Post-merge fix: test case could fail due to a conversion of the
max_join_size value to a integer. Fixed by preserving the value
as a string for comparison purposes.

tests/mysql_client_test.c:
  Preserve max_join_size value as a string instead of converting
  it to a integer -- value can be larger then the type used.
2009-07-27 12:31:28 -03:00
Joerg Bruehe
d1a60f9f88 Merge main 5.1 into 5.1-build. 2009-07-16 09:13:19 +02:00
Davi Arnaut
5f9440d2a6 Bug#44495: Prepared Statement: CALL p(<x>) - `thd->protocol == &thd->protocol_text' failed
Merge Konstantin's patch and add a test case.

tests/mysql_client_test.c:
  Add test case for Bug#44495
2009-07-15 15:22:50 -03:00
Joerg Bruehe
9313d74e91 Merge main 5.0 into 5.0-build. 2009-07-09 23:10:50 +02:00
Staale Smedseng
ab2f3dd2a2 Bug #43397 mysql headers redefine pthread_mutex_init
unnecessarily
      
The problem is that libmysqlclient.so is built with THREAD
undefined, while a client compiling against the same header
files will see THREAD as defined and definitions in
my_pthread.h will be included, possibly resulting in undefined
symbols that cannot be resolved with libmysqlclient.so.
      
The suggested solution is to require that clients wanting to
link with libmysqlclient.so should be built with
MYSQL_CLIENT_NO_THREADS defined. This requires a documentation
change, and more details for this will be supplied if this
patch is approved.
      
The MYSQL_CLIENT_NO_THREADS define was renamed from
UNDEF_THREADS_HACK, to get a more suitable (less suspicious)
name for the define. (The UNDEF_THREADS_HACK is retained for
backwards compatibility, though.)
      
This patch is also in anticipation of WL#4958, which will
remove this problem altogether by dropping the building of
libmysqlclient.
2009-07-08 16:49:45 +02:00
Georgi Kodinov
097c7b38c8 Bug #45287: phase 2 : 5.0 64 bit compilation warnings
Fixed various compilation warnings when compiling on a 
 64 bit windows.
2009-07-16 15:37:38 +03:00
Ramil Kalimullin
345e8347cb Fix for bug#42364 reverted. 2009-07-06 11:55:53 +05:00
Daniel Fischer
25ec6c7b86 merge fix 2009-07-03 14:12:35 +02:00
Daniel Fischer
a1af64f3ad Bug#44647 - fix file permissions. 2009-07-03 13:48:08 +02:00
Sergey Glukhov
45d59063cb Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
enabled message storing into error message list
for 'drop table' command


mysql-test/r/warnings.result:
  test result
mysql-test/t/warnings.test:
  test case
sql/sql_table.cc:
  We should skip error sending then we should return
  warnings to client as some functions may send its
  own errors, so we should set no_warnings_for_error= 0
  only in case of warning.
  The fix is to enable message storing into error message
  list for 'drop table' command(only for error case).
tests/mysql_client_test.c:
  test fix
2009-07-03 13:22:06 +05:00
Staale Smedseng
3cd431d553 Bug #45790 Potential DoS vector: Writing of user input to log
without proper formatting
      
The problem is that a suitably crafted database identifier
supplied to COM_CREATE_DB or COM_DROP_DB can cause a SIGSEGV,
and thereby a denial of service. The database name is printed
to the log without using a format string, so potential
attackers can control the behavior of my_b_vprintf() by
supplying their own format string. A CREATE or DROP privilege
would be required.
      
This patch supplies a format string to the printing of the
database name. A test case is added to mysql_client_test.


sql/sql_parse.cc:
  Added format strings.
tests/mysql_client_test.c:
  Added new test case.
2009-07-01 14:09:44 +02:00
Davi Arnaut
bd1c124681 Workaround a compiler that does not support certain C99 features for C code.
tests/mysql_client_test.c:
  Use a suitable constant for specifying the size of the array.
2009-05-23 10:19:58 -03:00
Staale Smedseng
059dba14b7 Recommit of bug 43560 after merge with mysql-5.1-bugteam 2009-05-20 16:17:47 +02:00
Bernt M. Johnsen
f27d9c267d Bug#23471 prepared for commit in 5.1 gca branch 2009-05-05 12:34:25 +02:00
Bernt M. Johnsen
ef65e32d70 Bug#23471 prepared for commit in 5.0 gca branch 2009-05-05 11:07:11 +02:00
Alexey Botchkov
88139cba8e merging 2009-04-30 12:54:45 +05:00
Alexey Botchkov
626a272ed4 mysql_client_test fixed.
per-file comments:
  tests/mysql_client_test.c
the test for bug 37956 isn't relevant anymore.
The query there 'select point(?,?)' doesn't produce an error.
2009-04-30 12:52:27 +05:00
Ignacio Galarza
675c3ce2bb auto-merge 2009-03-19 09:44:58 -04:00
Ignacio Galarza
0d588edf61 auto-merge 2009-03-17 16:29:24 -04:00
Kristofer Pettersson
55c779cdbf Manual merge 2009-03-06 11:49:39 +01:00
Kristofer Pettersson
ac821c6570 Bug#40363 Bug 20023 is not fixed on 5.0
This is a back port from 5.1 to 5.0.

Fix for BUG 20023: mysql_change_user() resets the value
of SQL_BIG_SELECTS.
  
The bug was that SQL_BIG_SELECTS was not properly set
in COM_CHANGE_USER.
  
The fix is to update SQL_BIG_SELECTS properly.



sql/sql_class.cc:
  Update THD::options with the respect to SQL_BIG_SELECTS
  in COM_CHANGE_USER.
tests/mysql_client_test.c:
  Add a test case BUG#20023.
2009-03-05 13:37:46 +01:00
Ramil Kalimullin
cd5744db13 Auto-merge 2009-02-26 16:14:33 +04:00
Ramil Kalimullin
c9e1884cd6 Fix for bug#19829:make test Failed in mysql_client_test
*with --with-charset=utf8*

Problem: wrong LONG TEXT field length is sent to a client 
when multibyte server character set used.

Fix: always limit field length sent to a client to 2^32,
as we store it in 4 byte slot.

Note: mysql_client_test changed accordingly.


sql/protocol.cc:
  Fix for bug#19829:make test Failed in mysql_client_test 
  *with --with-charset=utf8*
    - limit field length sent to client to UINT_MAX32 as 
      it may exceeds 32 bit slot for LONG TEXT fields if
      thd_charset->mbmaxlen > 1.
tests/mysql_client_test.c:
  Fix for bug#19829:make test Failed in mysql_client_test
  *with --with-charset=utf8*
    - checking field members have in mind that field length
      is limited to UINT_MAX32.
2009-02-26 12:34:15 +04:00
Alexey Kopytov
45e3327f9f Automerge. 2009-02-19 11:56:16 +03:00
Alexey Kopytov
321646095d Fix for bug #41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch()
returns short string value. 
 
Multibyte character sets were not taken into account when 
calculating max_length in Item_param::convert_str_value(). As a 
result, string parameters of a prepared statement could be 
truncated later when calculating string length in characters by 
dividing length in bytes by the charset's mbmaxlen value (e.g. in 
Field_varstring::store()). 
 
Fixed by taking charset's mbmaxlen into account when calculating 
max_length in Item_param::convert_str_value().


sql/item.cc:
  Multiply string's length in characters by charset's mbmaxlen when 
  calculating max_length.
tests/mysql_client_test.c:
  Added a test case for bug #41078.
2009-02-19 11:49:35 +03:00
Ignacio Galarza
5b7347bda3 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Ignacio Galarza
54fbbf9591 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Davi Arnaut
e48c7178f7 Merge from 5.0-bugteam 2009-01-15 08:28:10 -02:00
Davi Arnaut
3d6cea324a Bug#36326: nested transaction and select
The problem is that the query cache stores packets containing
the server status of the time when the cached statement was run.
This might lead to a wrong transaction status in the client side
if a statement is cached during a transaction and is later served
outside a transaction context (and vice-versa).

The solution is to take into account the transaction status when
storing in and serving from the query cache.

mysql-test/r/innodb_cache.result:
  Update test case result.
mysql-test/r/query_cache.result:
  Add test case result for Bug#36326
mysql-test/t/query_cache.test:
  Add test case for Bug#36326
sql/mysql_priv.h:
  Add new flags.
sql/sql_cache.cc:
  Remember the transaction and autocommit status stored in the packet.
tests/mysql_client_test.c:
  Add test case for Bug#36326
2009-01-13 20:07:06 -02:00
Sergey Glukhov
54f65ef151 5.0-bugteam->5.1-bugteam merge 2008-12-11 14:49:56 +04:00
Sergey Glukhov
d2cd545b53 fix for pushbuild failure on 64 linux 2008-12-11 14:37:18 +04:00
Sergey Glukhov
7f5d980af7 disable bug37956 test if geometry package is not enabled 2008-12-11 12:57:59 +04:00
Sergey Glukhov
1ca1439270 5.0-bugteam->5.1-bugteam merge 2008-12-10 18:16:21 +04:00
Sergey Glukhov
84de3b930b Bug#37956 memory leak and / or crash with geometry and prepared statements!
Bug#37671 crash on prepared statement + cursor + geometry + too many open files!
if mysql_execute_command() returns error then free materialized_cursor object.
is_rnd_inited is added to satisfy rnd_end() assertion
(handler may be uninitialized in some cases)


sql/sql_cursor.cc:
  if mysql_execute_command() returns error then free materialized_cursor object.
  is_rnd_inited is added to satisfy rnd_end() assertion
  (handler may be uninitialized in some cases)
sql/sql_select.cc:
  added result check
tests/mysql_client_test.c:
  test case
2008-12-10 18:13:11 +04:00
Sergey Glukhov
f171b7c61e 5.0-bugteam->5.1-bugteam merge 2008-11-27 18:27:44 +04:00
Sergey Glukhov
3a3d3527a3 removed unused variable 2008-11-27 18:26:22 +04:00
Sergey Glukhov
910d41725d 5.0-bugteam->5.1-bugteam merge 2008-11-27 17:05:38 +04:00
Sergey Glukhov
73960af037 Bug#40365 Prepared statements may insert invalid dates.
set DATE|DATETIME value to 0 if ALLOW_INVALID_DATES sql_mode is not enabled.


sql/field.cc:
  set DATE|DATETIME value to 0 if ALLOW_INVALID_DATES sql_mode is not enabled.
tests/mysql_client_test.c:
  test case
2008-11-27 16:41:25 +04:00
Georgi Kodinov
6d54b0443a Bug #32124: crash if prepared statements refer to variables in the where clause
The code to get read the value of a system variable was extracting its value 
on PREPARE stage and was substituting the value (as a constant) into the parse tree.
Note that this must be a reversible transformation, i.e. it must be reversed before
each re-execution.
Unfortunately this cannot be reliably done using the current code, because there are
other non-reversible source tree transformations that can interfere with this
reversible transformation.
Fixed by not resolving the value at PREPARE, but at EXECUTE (as the rest of the 
functions operate). Added a cache of the value (so that it's constant throughout
the execution of the query). Note that the cache also caches NULL values.
Updated an obsolete related test suite (variables-big) and the code to test the 
result type of system variables (as per bug 74).

mysql-test/extra/rpl_tests/rpl_insert_id.test:
  Bug #32124: removed ambiguous testcase
mysql-test/r/innodb_data_home_dir_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/innodb_flush_method_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/ps_11bugs.result:
  Bug #32124: test case
mysql-test/r/ssl_capath_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/ssl_cipher_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/variables.result:
  Bug #32124: system vars are shown as such in EXPLAIN EXTENDED, not as constants.
mysql-test/suite/rpl/r/rpl_insert_id.result:
  Bug #32124: removed ambiguous testcase
mysql-test/t/ps_11bugs.test:
  Bug #32124: test case
sql/item.cc:
  Bug #32124: placed the code to convert string to longlong or double 
  to a function (so that it can be reused)
sql/item.h:
  Bug #32124: placed the code to convert string to longlong or double 
  to a function (so that it can be reused)
sql/item_func.cc:
  Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/item_func.h:
  Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/set_var.cc:
  Bug #32124: removed the code that calculated the system variable's value 
  at PREPARE
sql/set_var.h:
  Bug #32124: removed the code that calculated the system variable's value 
  at PREPARE
tests/mysql_client_test.c:
  Bug #32124 : removed the reading of the system variable, because its max
  length is depended on the system charset and client charset and can't be
  easily calculated.
2008-10-08 14:23:53 +03:00
Sergey Glukhov
fad69f17c1 5.0-bugteam->5.1-bugteam merge 2008-08-20 16:42:01 +05:00
Sergey Glukhov
de73b72954 Bug#38291 memory corruption and server crash with view/sp/function
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes. 
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.

mysql-test/r/metadata.result:
  result fix
  The result file was changed because now forgotten attributes are properly set.
mysql-test/r/sp.result:
  test result
mysql-test/t/sp.test:
  test case
sql/item.cc:
  Send_field.org_col_name has broken value on secondary execution.
  It happens when result field is created from the field which belongs to view
  due to forgotten assignment of some Send_field attributes. 
  The fix:
  set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
tests/mysql_client_test.c:
  test case fix
  The test was changed because now forgotten attributes are properly set.
2008-08-20 14:49:28 +05:00
Sergey Glukhov
b9bfa25fb2 after merge fix, related to bug#37301 changes 2008-08-20 13:15:42 +05:00