Commit graph

3292 commits

Author SHA1 Message Date
Davi Arnaut
f801ca68c6 Use UNINIT_VAR workaround instead of LINT_INIT. 2010-07-09 16:37:52 -03:00
Davi Arnaut
11fae04527 Bug#45288: pb2 returns a lot of compilation warnings on linux
Although the C standard mandates that sprintf return the number
of bytes written, some very ancient systems (i.e. SunOS 4)
returned a pointer to the buffer instead. Since these systems
are not supported anymore and are hopefully long dead by now,
simply remove the portability wrapper that dealt with this
discrepancy. The autoconf check was causing trouble with GCC.
2010-07-09 09:00:17 -03:00
Davi Arnaut
0eb26fdfa8 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.

BUILD/SETUP.sh:
  Remove flags that are implied by -Wall and -Wextra.
  Do not warn about unused parameters in C++.
BUILD/check-cpu:
  Print only the compiler version instead of verbose banner.
  Although the option is gcc specific, the check was only
  being used for GCC specific checks anyway.
client/mysql.cc:
  bcmp is no longer defined.
client/mysqltest.cc:
  Pass a string to function expecting a format string.
  Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
  Always define _GNU_SOURCE when compiling GNU readline.
  Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
  Condition for the code to be meaningful.
configure.in:
  Remove check for bcmp.
extra/comp_err.c:
  Use appropriate type.
extra/replace.c:
  Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
  Do not ignore the return value of fgets. Retrieve the file
  position if fgets succeed -- if it fails, the function will
  bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
  Use a single array instead of accessing positions of the sbox_
  through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
  One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
  Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
  Do not define type within a anonymous union.
  Use a variable to return a value instead of
  leaving the result in a register -- compiler
  does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
  Define handler for pure virtual functions.
  Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
  Function must have C language linkage.
include/m_string.h:
  Remove check which relied on bcmp being defined -- they weren't
  being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
  Remove bogus helpers which were used only in a few files and
  were causing warnings about dead code.
include/my_global.h:
  Due to G++ bug, always silence false-positive uninitialized
  variables warnings when compiling C++ code with G++.
  Remove bogus helper.
libmysql/Makefile.shared:
  Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
  Leave space of the ending nul.
mysys/mf_pack.c:
  Replace bcmp with memcmp.
mysys/my_bitmap.c:
  Dead code removal.
mysys/my_gethwaddr.c:
  Remove unused variable.
mysys/my_getopt.c:
  Silence bogus uninitialized variable warning.
  Do not cast away the constant qualifier.
mysys/safemalloc.c:
  Cast to expected type.
mysys/thr_lock.c:
  Silence bogus uninitialized variable warning.
sql/field.cc:
  Replace bogus helper with a more appropriate logic which is
  used throughout the code.
sql/item.cc:
  Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
  Simplify code to avoid signedness related warnings.
sql/log_event.cc:
  Replace use of bcmp with memcmp.
  No need to use helpers for simple bit operations.
sql/log_event_old.cc:
  Replace bmove_align with memcpy.
sql/mysqld.cc:
  Move use declaration of variable to the ifdef block where it
  is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
  Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
  Cast to expected type and silence bogus warning.
sql/sql_class.h:
  Don't use enum values as bit flags, the supposed type safety is
  bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
  Only declare variable when necessary.
sql/unireg.h:
  Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
  Silence bogus warning.
storage/myisam/mi_open.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
storage/myisam/mi_page.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
strings/bcmp.c:
  Remove built-in bcmp.
strings/ctype-ucs2.c:
  Silence bogus warning.
tests/mysql_client_test.c:
  Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
Davi Arnaut
6f3a540c37 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.

client/mysql.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysql_upgrade.c:
  Remove now-unnecessary casts.
client/mysqladmin.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysqlbinlog.cc:
  Remove now-unnecessary casts.
client/mysqlcheck.c:
  Remove now-unnecessary casts.
client/mysqldump.c:
  Remove now-unnecessary casts.
client/mysqlimport.c:
  Remove now-unnecessary casts.
client/mysqlshow.c:
  Remove now-unnecessary casts.
client/mysqlslap.c:
  Remove now-unnecessary casts.
client/mysqltest.cc:
  Remove now-unnecessary casts.
extra/comp_err.c:
  Remove now-unnecessary casts.
extra/my_print_defaults.c:
  Remove now-unnecessary casts.
  Break up large strings.
extra/mysql_waitpid.c:
  Remove now-unnecessary casts.
extra/perror.c:
  Remove now-unnecessary casts.
extra/resolve_stack_dump.c:
  Remove now-unnecessary casts.
extra/resolveip.c:
  Remove now-unnecessary casts.
include/my_getopt.h:
  Use a void pointer type as the opaque type to avoid problems with type
  incompatibility -- GCC issues warnings when the type name is not type
  compatible with a operand. As a side bonus, a explicit cast won't be
  necessary anymore.
include/sslopt-longopts.h:
  Remove now-unnecessary casts.
  Break up large strings.
mysys/my_getopt.c:
  Update opaque type and introduce a type definition for the
  argument to my_getopt_register_get_addr.
server-tools/instance-manager/options.cc:
  Remove now-unnecessary casts.
sql/mysqld.cc:
  Remove now-unnecessary casts.
  Break up large strings.
  Update mysql_getopt_value prototype (the old prototype
  was different from the definition anyway).
sql/sql_plugin.cc:
  The type of a pointer to a function must be compatible with the
  pointed-to function type, otherwise the behavior is undefined.
sql/table.cc:
  The variable buf pointer to pointer to pointer to constant char
  could improperly alias a incompatible type in call to fix_type_
  pointers. Since this was actually dead code, it is simply removed.
sql/unireg.cc:
  Remove call to get_form_pos. The code creates a new FRM file which
  is always truncated and writes the form position as 0. Hence, no
  need to retrieve it, we now for sure it is 0.
storage/archive/archive_reader.c:
  Remove now-unnecessary casts.
storage/myisam/ft_nlq_search.c:
  Read weight directly from the buffer.
storage/myisam/fulltext.h:
  Add explanation about the type duality of a key buffer.
  Add accessor macro to retrieve a FT float value.
storage/myisam/mi_test1.c:
  Remove now-unnecessary casts.
storage/myisam/myisam_ftdump.c:
  Read weight directly from the buffer.
storage/myisam/myisamchk.c:
  Remove now-unnecessary casts.
storage/myisam/myisamlog.c:
  A pointer to char was used to alias a pointer to pointer to
  unsigned char, thus violating strict aliasing rules.
storage/myisam/myisampack.c:
  Remove now-unnecessary casts.
strings/decimal.c:
  Remove aliasing violation, printing the value is enough for
  debugging purposes.
tests/mysql_client_test.c:
  Remove now-unnecessary casts.
2010-06-10 17:16:43 -03:00
unknown
454c003a5c Bug #50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs
When mysqlbinlog was given the --database=X flag, it always printed
'ROLLBACK TO', but the corresponding 'SAVEPOINT' statement was not
printed. The replicated filter(replicated-do/ignore-db) and binlog
filter (binlog-do/ignore-db) has the same problem. They are solved
in this patch together.

After this patch, We always check whether the query is 'SAVEPOINT'
statement or not. Because this is a literal check, 'SAVEPOINT' and
'ROLLBACK TO' statements are also binlogged in uppercase with no
any comments.

The binlog before this patch can be handled correctly except one case
that any comments are in front of the keywords. for example:
 /* bla bla */ SAVEPOINT a;
 /* bla bla */ ROLLBACK TO a;
2010-03-28 19:57:33 +08:00
Georgi Kodinov
b182c9bd20 Bug #44178: mysql cli does not comply with GPLv2 clause 2c
Applied a path from Jim Winstead : Added a GPL notice.
Added the missing '(c)' and 'v2'.
2010-03-11 15:16:54 +02:00
Georgi Kodinov
d03dd16b21 merge 2010-03-10 12:19:49 +02:00
Georgi Kodinov
df8642b212 Bug #41057: mysql_update fails FATAL ERROR: Failed to create temporary file for defaults
mysql_upgrade was passing an non-initialized non-null tmpdir to create_temp_file() if no 
--tmpdir was specified. This prevents create_temp_file() from taking the system 
temporary file path and as a result mysql_upgrade was trying to open a file in a 
directory that it may not have write access to.
Fixed by making sure mysql_upgrade will pass a zero length temp dir string to 
create_temp_file() if no --tmpdir is specified.
2010-03-09 11:18:46 +02:00
Luis Soares
17a30e02af Automerge: BUG 48993 bundle from bug report --> mysql-5.1-bugteam. 2010-03-08 23:55:19 +00:00
Davi Arnaut
d585322474 Bug#37316: Anonymous error messages noticed sometimes, while running tests in MTR
The problem was that mysqltest could attempt to execute a
SHOW WARNINGS statement through a connection that was not
properly reaped, thus violating its own rules.

The solution is to skip SHOW WARNINGS if a connection has
not been properly repeaed.

client/mysqltest.cc:
  Skip SHOW WARNINGS if connection hasn't been reaped.
2010-03-08 11:30:20 -03:00
Luis Soares
f0b38904aa BUG#48993: valgrind errors in mysqlbinlog
I found three issues during the analysis:
 1. Memory leak caused by temp_buf not being freed;
 2. Memory leak caused when handling argv;
 3. Conditional jump that depended on unitialized values.

Issue #1
--------

  DESCRIPTION: when mysqlbinlog is reading from a remote location
  the event temp_buf references the incoming stream (in NET
  object), which is not freed by mysqlbinlog explicitly. On the
  other hand, when it is reading local binary log, it points to a
  temporary buffer that needs to be explicitly freed. For both
  cases, the temp_buf was not freed by mysqlbinlog, instead was
  set to 0.  This clearly disregards the free required in the
  second case, thence creating a memory leak.

  FIX: we make temp_buf to be conditionally freed depending on
  the value of remote_opt. Found out that similar fix is already
  in most recent codebases.

Issue #2 
--------

  DESCRIPTION: load_defaults is called by parse_args, and it
  reads default options from configuration files and put them
  BEFORE the arguments that are already in argc and argv. This is
  done resorting to MEM_ROOT. However, parse_args calls
  handle_options immediately after which changes argv. Later when
  freeing the defaults, pointers to MEM_ROOT won't match, causing
  the memory not to be freed:

  void free_defaults(char **argv)
  {
    MEM_ROOT ptr
    memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
    free_root(&ptr,MYF(0));
  }

  FIX: we remove load_defaults from parse_args and call it
  before. Then we save argv with defaults in defaults_argv BEFORE
  calling parse_args (which inside can then call handle_options
  at will). Actually, found out that this is in fact kind of a
  backport for BUG#38468 into 5.1, so I merged in the test case
  as well and added error check for load_defaults call.

  Fix based on:
  revid:zhenxing.he@sun.com-20091002081840-uv26f0flw4uvo33y


Issue #3 
--------

  DESCRIPTION: the structure st_print_event_info constructor
  would not initialize the sql_mode member, although it did for
  sql_mode_inited (set to false). This would later raise the
  warning in valgrind when printing the sql_mode in the event
  header, as this print out is protected by a check against
  sql_mode_inited and sql_mode variables. Given that sql_mode was
  not initialized valgrind would output the warning.

  FIX: we add initialization of sql_mode to the
  st_print_event_info constructor.
 

client/mysqlbinlog.cc:
  - Conditionally free ev->temp_buf.
  - save defaults_argv before handle_options is called.
mysql-test/t/mysqlbinlog.test:
  Added test case from BUG#38468.
sql/log_event.cc:
  Added initialization of sql_mode for st_print_event_info.
2010-02-17 18:07:28 +00:00
Bjorn Munch
ac0d9be196 merge from 5.1-mtr 2010-02-22 14:52:11 +01:00
Bjorn Munch
90c3ace052 Bug #51135 Please increase the maximum number of connections allowed in mysqltest
Added --max-connections= argument to mysqltest and mtr
Small fix to first patch: forgot to check before free'ing connections array
2010-02-17 16:28:02 +01:00
Bjorn Munch
0ad9a5992d Bug #50618 Please allow 'sleep $variable' in mtr
Made mtr's sleep function understand $variables
A few fixes since previous patch, added tests
2010-02-09 18:13:57 +01:00
Bjorn Munch
97219cb9ef merge from 5.1 main 2010-02-07 12:21:11 +01:00
Bjorn Munch
01c0d46af8 Bug #39774 mysql-test-run's remove_file can't use wildcards, this should be documented
Added remove_files_wildcard that allows to remove multiple files at once.
This is a port of original patch to Windows.
2010-02-04 13:15:42 +01:00
Staale Smedseng
18761a9223 Bug #49223 Change help description for mysqldump
--extended-insert

Help message changed to the same as in the 5.1 online 
documentation.
2010-01-27 16:13:39 +01:00
Magne Mahre
35c6bb89e6 WL#5182 Remove more deprecated 4.1/5.0 features
WL#5182 is a follow-up to WL#5154, deprecating a few more options
and system variables.


client/client_priv.h:
  The warning message has been changed to not include
  a specific version number in the text.
client/mysql.cc:
  --no-tee is deprecated
client/mysqldump.c:
  --all is deprecated
  -a now points to create-options
mysql-test/r/mysqlbinlog.result:
  Warning text changed
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result:
  Warning text changed
sql/mysql_priv.h:
  The warning message has been changed to not include
  a specific version number in the text.
sql/mysqld.cc:
  --use-symbolic-links is deprecated
  -s now points to --symbolic-links
  --warnings is deprecated
  -W now points to --log-warnings
          
  myisam_max_extra_sort_file_size is deprecated
  record_buffer is deprecated
          
  --log-update is deprecated
  --sql-bin-update-same is deprecated
  --skip-locking is deprecated
  --skip-symlink is deprecated
  --enable-locking is deprecated
  --delay-key-write-for-all-tables is deprecated
2010-01-27 13:23:28 +01:00
Magne Mahre
132b46e96e WL#5154 Remove deprecated 4.1 features
Several items said to be deprecated in the 4.1 manual
have never been removed.  This worklog adds deprecation
warnings when these items are used, and warns the user 
that the items will be removed in MySQL 5.6.

A couple of previously deprecation decision have been
reversed (see single file comments)



client/client_priv.h:
  Macro similar to the one in the server (mysql_priv.h)
  for printing a deprecation warning message
client/mysql.cc:
  no-auto-rehash  will not be deprecated
  skip-line-numbers will not be deprecated
  skip-column-names will not be deprecated
  no-pager is deprecated
  set-variable is deprecated
  no-named-commands is deprecated
client/mysqladmin.cc:
  set-variable is deprecated
client/mysqlbinlog.cc:
  position is deprecated
client/mysqldump.c:
  first-slave is deprecated
  no-set-names is deprecated
  set-variable is deprecated
mysql-test/r/mysqlbinlog.result:
  Adding the [Warning] to the test case, just to show that the
  deprecation works.
  The test case will be changed in Celosia to use --start-position.
mysys/my_getopt.c:
  set-variable (include -O) is deprecated
scripts/mysqld_multi.sh:
  Warning for mysqld_multi
sql/mysqld.cc:
  default-collation is deprecated
  log-bin-trust-routine-creators is deprecated
  set-variable is deprecated
  default-character-set is deprecated
  safe-show-database is deprecated
sql/share/errmsg.txt:
  Added version number for sql_log_update deprecation message.
2010-01-21 09:10:05 +01:00
Bjorn Munch
84616df3ff merge 49837 2010-01-20 14:23:57 +01:00
Bjorn Munch
87ff57cb7e merge 48888 2010-01-20 14:22:34 +01:00
Bjorn Munch
94ccc34537 Bug #49878 delimiter under false 'if' makes mysqltest test fail with 'Missing end of block'
delimiter not executed so does not recognize end of block
Always execute delimiter command, revert after false if() block.
2010-01-20 14:18:27 +01:00
Bernd Ocklin
75e9a54a53 exporting server version and other as env var (bug#50471) 2010-01-20 12:54:55 +01:00
Bjorn Munch
b554f4c52d Bug #48888 mysqltest crashes on --replace_result if 'from' is longer than ~1024 symbols
valgrind pointed to a buffer allocated by my_realloc which looked fishy
Replaced size with what was probably intended, added test case.
Now also fixed line after review comment
2010-01-20 12:52:35 +01:00
Bjorn Munch
5ae2eda776 Bug #49837 mysqltest exec cannot handle multi-line command correctly
Since the exec command line is passed on externally, it cannot take newlines
Simply replace \n with space
Now also added test case
2010-01-20 12:51:18 +01:00
Bjorn Munch
e1b42965a5 Bug #49269 mysqltest crashes on 'reap' if query executed after 'send'
Undid amendment allowing pending reap after switching connections
Moved check for pending reap earlier; failed if running with ps-protocol
2010-01-07 11:22:45 +01:00
Bjorn Munch
ed64190b23 Bug #49269 mysqltest crashes on 'reap' if query executed after 'send'
Small amendment: ignore pending reap when switching connection, add test
2010-01-06 12:56:22 +01:00
Bjorn Munch
08c8863ec4 Bug #49269 mysqltest crashes on 'reap' if query executed after 'send'
Set a flag after send to trap the case
2010-01-06 09:45:28 +01:00
Bjorn Munch
5b66dab00f Bug #48863 mysql test: enable and disable case insensitive compare mode
Implemented --lowercase_result which lower cases next result
2010-01-06 09:42:21 +01:00
Staale Smedseng
8c65b726a5 Recommit of Bug#49447. 2010-02-04 13:39:42 +01:00
Georgi Kodinov
c248859ec8 merge 2009-12-24 11:00:04 +02:00
Davi Arnaut
61ae928898 Manual merge. 2009-12-18 16:44:24 -02:00
Jim Winstead
dd1378c8ff Merge approved bug fix 2009-12-17 12:06:36 -08:00
Davi Arnaut
06a1df9181 Bug#48983: Bad strmake calls (length one too long)
The problem is a somewhat common misusage of the strmake function.
The strmake(dst, src, len) function writes at most /len/ bytes to
the string pointed to by src, not including the trailing null byte.
Hence, if /len/ is the exact length of the destination buffer, a
one byte buffer overflow can occur if the length of the source
string is equal to or greater than /len/.

client/mysqldump.c:
  Make room for the trailing null byte.
libmysql/libmysql.c:
  Add comment, there is enough room in the buffer.
  Increase buffer length, two strings are concatenated.
libmysqld/lib_sql.cc:
  Make room for the trailing null byte.
mysys/default.c:
  Make room for the trailing null bytes.
mysys/mf_pack.c:
  Make room for the trailing null byte.
server-tools/instance-manager/commands.cc:
  Copy only if overflow isn't possible in both cases.
server-tools/instance-manager/listener.cc:
  Make room for the trailing null byte.
sql/log.cc:
  Make room for the trailing null byte.
sql/sp_pcontext.h:
  Cosmetic fix.
sql/sql_acl.cc:
  MAX_HOSTNAME already specifies space for the trailing null byte.
sql/sql_parse.cc:
  Make room for the trailing null byte.
sql/sql_table.cc:
  Make room for the trailing null byte.
2009-12-17 15:58:38 -02:00
Georgi Kodinov
adc17cd41e Bug #48866: mysql.test fails under Fedora 12
strmov() is not guaranteed to work correctly on overlapping
source and destination buffers. On some OSes it may work,
but Fedora 12 has a stpcpy() that's not working correctly 
on overlapping buffers.
Fixed to use the overlap-safe version of strmov instead.
Re-vitalized the overlap-safe version of strmov.
2009-12-16 19:31:19 +02:00
Bjorn Munch
d4676c22e0 Merge from 5.1 main 2009-12-16 10:37:41 +01:00
Bjorn Munch
a88898e692 backport mysqltest send_eval from 42520 2009-12-16 10:06:37 +01:00
unknown
699a87110d This is a patch for bug#41569.
"mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table but does
not set values".
            
mysql_upgrade (ver 5.1) adds 3 fields (character_set_client, 
collation_connection and db_collation) to the mysql.proc table, but 
does not set any values. When we run stored procedures, which were 
created with mysql 5.0, a warning is logged into the error log.
            
The solution to this is for mysql_upgrade to set default best guess
values for these fields. A warning is also written during upgrade, to
make the user aware that default values are set.

client/mysql_upgrade.c:
  Result lines which start with "WARNING" are passed through to the output. 
  This way we have a way of triggering WARNING-messages during upgrade 
  directly from the .sql-script.
mysql-test/r/mysql_upgrade.result:
  Expected result of the test.
mysql-test/t/mysql_upgrade.test:
  Added a test-case for the bug.
scripts/mysql_system_tables_fix.sql:
  The new fields are populated, and warnings are written.
2009-12-03 17:15:47 +01:00
Bjorn Munch
69c540588a Bug #48250 mysqtest_embedded can lock destroyed mutex
As suggested, replaced relevant uses of my_fopen with fopen (and close)
Tested on HPUX where it was reproducable with test innodb_bug30919
2009-11-26 11:16:06 +01:00
Satya B
fab8effefe merge to mysql-5.1-bugteam 2009-11-26 13:12:16 +05:30
Satya B
82b115ec16 Fix for BUG#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
mysql client displays wrong character-set of server. When a user changes the
charset of a server, mysql client 'status' command displays wrong charset but
the command "SHOW VARIABLES LIKE "%charset%" displayed correct charset results.
The problem is only with the mysql client's 'status' command output.

In mysql client, the method mysql_store_lazy_result() returns 0 for
success and non-zero for failure. The method com_status() was using this method
wrongly. Fixed all such instances according to return value of the method 
mysql_store_lazy_result().

client/mysql.cc:
  Fix for BUG#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
  
  Fix com_status() method to use mysql_store_lazy_result() properly.
mysql-test/r/bug47671.result:
  Fix for BUG#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
  
  Testcase for BUG#47671
mysql-test/t/bug47671-master.opt:
  Fix for BUG#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
  
  Testcase for BUG#47671
mysql-test/t/bug47671.test:
  Fix for BUG#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
  
  Testcase for BUG#47671
2009-11-25 12:25:49 +05:30
Tatiana A. Nurnberg
22d0345272 auto-merge 2009-11-24 08:08:47 -08:00
Jim Winstead
84c5abbd33 Backport fix for Bug #27884. 2009-11-23 14:38:08 -08:00
Davi Arnaut
64f097dc80 Post-merge fixes: fix typo and remove unused variables. 2009-11-21 10:11:45 -02:00
Bjorn Munch
b229781c2d Bug #48671 mysqltest fails on 'perl' in file sourced inside 'while'
Actually, fails on 'perl' in any while
Fixed essentially the same way as for append_file
2009-11-11 12:46:19 +01:00
Tatiana A. Nurnberg
1b0be8c5b8 Bug#47655: Memory free error when connecting to 4.1 server from 5.1+ client
When starting the (5.1+) mysql command-line client, we try to get
"select @@version_comment" from the server to present it to the
user. Recent clients are aware that older servers do not have that
variable and fall back on other info to be able to present *something*
at least. This fallback string was allocated through the POSIX interface,
but released through the my*() suite, which rightfully complained about
the imbalance in calls when compiled with --debug. While this wasn't
as bad as it looked (no double-free, use of uninitialized or freed
buffer, etc.), it did look funky.

Using my_strdup() now for what will be my_free()d later.

client/mysql.cc:
  Use my_strdup() for server_version, as we'll my_free() it later
  and don't want to upset the mysql client's memory accounting.
2009-11-02 00:46:00 -08:00
Vladislav Vaintroub
b51777484f merge 2009-11-03 01:52:57 +01:00
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
27c2af97f7 merge 2009-10-30 16:57:16 +02:00
Georgi Kodinov
ecef6c3308 merge from 5.0-main 2009-10-30 16:34:54 +02:00