Commit 7fab5c0b authored by Sergey Glukhov's avatar Sergey Glukhov

Bug#52884 mysql-test-run does not work with --debug option

Server crashes on 64bit linux with 'double free or corruption'
message, on 32bit mysql-test-run silently fails on bootstrap
stage. The problem is that FreeState() is called twice
for init_settings struct in _db_end_ function.
The fix is to remove superfluous FreeState() call.
Additional fix:
fixed discrepancy of result file when
debug & valgrind options are enabled
for MTR.

dbug/dbug.c:
  The problem is that FreeState() is called twice
  for init_settings struct in _db_end_ function.
  The fix is to remove superfluous FreeState() call.
mysql-test/r/variables_debug.result:
  fixed discrepancy of result file when
  debug & valgrind options are enabled
  for MTR.
mysql-test/t/variables_debug.test:
  fixed discrepancy of result file when
  debug & valgrind options are enabled
  for MTR.
sql/set_var.cc:
  fixed discrepancy of result file when
  debug & valgrind options are enabled
  for MTR.
parent e647cf20
......@@ -1517,10 +1517,7 @@ void _db_end_()
while ((discard= cs->stack))
{
if (discard == &init_settings)
{
FreeState (cs, discard, 0);
break;
}
cs->stack= discard->next;
FreeState(cs, discard, 1);
}
......
SET @old_debug = @@GLOBAL.debug;
set debug= 'T';
select @@debug;
@@debug
......@@ -22,4 +23,5 @@ SET GLOBAL debug='';
SELECT @@global.debug;
@@global.debug
SET GLOBAL debug=@old_debug;
End of 5.1 tests
--source include/have_debug.inc
SET @old_debug = @@GLOBAL.debug;
#
# Bug#34678 @@debug variable's incremental mode
#
......@@ -21,5 +23,6 @@ SELECT @@global.debug;
SET GLOBAL debug='';
SELECT @@global.debug;
SET GLOBAL debug=@old_debug;
--echo End of 5.1 tests
......@@ -4239,10 +4239,15 @@ bool sys_var_thd_dbug::check(THD *thd, set_var *var)
bool sys_var_thd_dbug::update(THD *thd, set_var *var)
{
char buf[256];
String str(buf, sizeof(buf), system_charset_info), *res;
res= var->value->val_str(&str);
if (var->type == OPT_GLOBAL)
DBUG_SET_INITIAL(var ? var->value->str_value.c_ptr() : "");
DBUG_SET_INITIAL(res ? res->c_ptr() : "");
else
DBUG_SET(var ? var->value->str_value.c_ptr() : "");
DBUG_SET(res ? res->c_ptr() : "");
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment