maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #02495
bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2828)
#At lp:maria
2828 knielsen@xxxxxxxxxxxxxxx 2010-03-10
Fix some compiler warnings seen in Buildbot.
Add some extra error output and code cleanup in an attempt to fix/debug
a rare random testsuite problem in check_warnings, where the exit code
from mysqltest is somehow corrupted inside mysql-test-run.pl.
modified:
include/my_global.h
mysql-test/lib/My/SafeProcess.pm
mysql-test/mysql-test-run.pl
sql/sql_lex.cc
sql/table.cc
storage/federatedx/ha_federatedx.cc
storage/maria/ma_delete.c
storage/maria/ma_loghandler.c
storage/myisam/ft_stopwords.c
storage/myisam/mi_write.c
storage/xtradb/btr/btr0cur.c
support-files/compiler_warnings.supp
vio/viossl.c
per-file messages:
include/my_global.h
Fix compiler warnings on some platforms.
mysql-test/lib/My/SafeProcess.pm
Move dereference of $? subprocess exit code closer to where it is generated,
to make the code more robust and on the chance that this will fix the
occasional problems in check_warnings we see in Buildbot.
mysql-test/mysql-test-run.pl
When check_warnings failed, also log the mysqld server for which it failed.
sql/sql_lex.cc
Fix compiler warning about possibly uninitialised value, by rewriting a for()
loop that is always executed at least once into a do .. while() loop with an
assert.
sql/table.cc
Fix compiler warning about uninitialised value.
storage/federatedx/ha_federatedx.cc
Fix uninitialised variable.
storage/maria/ma_delete.c
Fix compiler warning about uninitialised value.
storage/maria/ma_loghandler.c
Fix compiler warning about uninitialised value.
storage/myisam/ft_stopwords.c
Fix compiler warning.
storage/myisam/mi_write.c
Fix compiler warning about possibly uninitialised value, by rewriting a while()
loop that is always executed at least once into a do .. while() loop with an
assert.
storage/xtradb/btr/btr0cur.c
Fix compiler warning about possibly uninitialised value.
support-files/compiler_warnings.supp
Fix warning suppression to cover all cases in yassl.
vio/viossl.c
Fix compiler warning.
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2010-03-04 08:03:07 +0000
+++ b/include/my_global.h 2010-03-10 10:32:14 +0000
@@ -1260,9 +1260,9 @@ do { doubleget_union _tmp; \
} while (0)
#define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((uchar*) V,(const uchar*) (&M),sizeof(float))
-#define floatstore(T,V) memcpy((uchar*)(T), (const uchar*)(&V),sizeof(float))
-#define floatget(V,M) memcpy((uchar*) &V,(const uchar*) (M),sizeof(float))
+#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
+#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
+#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#else
=== modified file 'mysql-test/lib/My/SafeProcess.pm'
--- a/mysql-test/lib/My/SafeProcess.pm 2009-04-29 14:13:38 +0000
+++ b/mysql-test/lib/My/SafeProcess.pm 2010-03-10 10:32:14 +0000
@@ -384,9 +384,9 @@ sub kill {
sub _collect {
- my ($self)= @_;
+ my ($self, $exit_code)= @_;
- $self->{EXIT_STATUS}= $?;
+ $self->{EXIT_STATUS}= $exit_code;
_verbose("_collect: $self");
# Take the process out of running list
@@ -453,6 +453,7 @@ sub wait_one {
#_verbose("blocking: $blocking, use_alarm: $use_alarm");
my $retpid;
+ my $exit_code;
eval
{
# alarm should break the wait
@@ -461,6 +462,7 @@ sub wait_one {
alarm($timeout) if $use_alarm;
$retpid= waitpid($pid, $blocking ? 0 : &WNOHANG);
+ $exit_code= $?;
alarm(0) if $use_alarm;
};
@@ -492,7 +494,7 @@ sub wait_one {
#warn "wait_one: expected pid $pid but got $retpid"
# unless( $retpid == $pid );
- $self->_collect();
+ $self->_collect($exit_code);
return 0;
}
@@ -505,6 +507,8 @@ sub wait_one {
#
sub wait_any {
my $ret_pid;
+ my $exit_code;
+
if (IS_WIN32PERL) {
# Can't wait for -1 => use a polling loop
do {
@@ -514,6 +518,7 @@ sub wait_any {
last if $pid == $ret_pid;
}
} while ($ret_pid == 0);
+ $exit_code= $?;
}
else
{
@@ -523,6 +528,7 @@ sub wait_any {
print STDERR "wait_any, got invalid pid: $ret_pid\n";
return undef;
}
+ $exit_code= $?;
}
# Look it up in "running" table
@@ -532,7 +538,7 @@ sub wait_any {
print STDERR "running: ". join(", ", keys(%running)). "\n";
return undef;
}
- $proc->_collect;
+ $proc->_collect($exit_code);
return $proc;
}
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2010-03-04 08:03:07 +0000
+++ b/mysql-test/mysql-test-run.pl 2010-03-10 10:32:14 +0000
@@ -4102,7 +4102,7 @@ sub start_check_warnings ($$) {
error => $errfile,
output => $errfile,
args => \$args,
- user_data => $errfile,
+ user_data => [$errfile, $mysqld],
verbose => $opt_verbose,
);
mtr_verbose("Started $proc");
@@ -4148,7 +4148,7 @@ sub check_warnings ($) {
if ( delete $started{$proc->pid()} ) {
# One check warning process returned
my $res= $proc->exit_status();
- my $err_file= $proc->user_data();
+ my ($err_file, $mysqld)= @{$proc->user_data()};
if ( $res == 0 or $res == 62 ){
@@ -4184,7 +4184,8 @@ sub check_warnings ($) {
my $report= mtr_grab_file($err_file);
$tinfo->{comment}.=
"Could not execute 'check-warnings' for ".
- "testcase '$tname' (res: $res):\n";
+ "testcase '$tname' (res: $res) server: '".
+ $mysqld->name() .":\n";
$tinfo->{comment}.= $report;
$result= 2;
=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc 2009-12-03 11:19:05 +0000
+++ b/sql/sql_lex.cc 2010-03-10 10:32:14 +0000
@@ -1842,13 +1842,15 @@ void st_select_lex_unit::exclude_tree()
void st_select_lex::mark_as_dependent(st_select_lex *last, Item *dependency)
{
SELECT_LEX *next_to_last;
+
+ DBUG_ASSERT(this != last);
+
/*
Mark all selects from resolved to 1 before select where was
found table as depended (of select where was found table)
*/
- for (SELECT_LEX *s= this;
- s && s != last;
- s= s->outer_select())
+ SELECT_LEX *s= this;
+ do
{
if (!(s->uncacheable & UNCACHEABLE_DEPENDENT))
{
@@ -1866,7 +1868,8 @@ void st_select_lex::mark_as_dependent(st
}
}
next_to_last= s;
- }
+ } while ((s= s->outer_select()) != last && s != 0);
+
is_correlated= TRUE;
this->master_unit()->item->is_correlated= TRUE;
if (dependency)
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2010-03-09 19:23:30 +0000
+++ b/sql/table.cc 2010-03-10 10:32:14 +0000
@@ -2053,6 +2053,8 @@ ulong get_form_pos(File file, uchar *hea
ulong ret_value=0;
DBUG_ENTER("get_form_pos");
+ LINT_INIT(buf);
+
names=uint2korr(head+8);
a_length=(names+2)*sizeof(char *); /* Room for two extra */
=== modified file 'storage/federatedx/ha_federatedx.cc'
--- a/storage/federatedx/ha_federatedx.cc 2009-12-03 11:34:11 +0000
+++ b/storage/federatedx/ha_federatedx.cc 2010-03-10 10:32:14 +0000
@@ -1783,7 +1783,7 @@ int ha_federatedx::open(const char *name
int ha_federatedx::close(void)
{
- int retval, error;
+ int retval= 0, error;
THD *thd= current_thd;
DBUG_ENTER("ha_federatedx::close");
=== modified file 'storage/maria/ma_delete.c'
--- a/storage/maria/ma_delete.c 2009-01-12 11:12:00 +0000
+++ b/storage/maria/ma_delete.c 2010-03-10 10:32:14 +0000
@@ -169,6 +169,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MA
MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_delete");
+ LINT_INIT_STRUCT(org_key);
+
save_key_data= key->data;
if (share->now_transactional)
{
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c 2010-01-06 21:27:53 +0000
+++ b/storage/maria/ma_loghandler.c 2010-03-10 10:32:14 +0000
@@ -1394,6 +1394,7 @@ LSN translog_get_file_max_lsn_stored(uin
{
LOGHANDLER_FILE_INFO info;
+ LINT_INIT_STRUCT(info);
File fd= open_logfile_by_number_no_cache(file);
if ((fd < 0) ||
(translog_read_file_header(&info, fd) | my_close(fd, MYF(MY_WME))))
=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c 2010-01-28 14:49:14 +0000
+++ b/storage/myisam/ft_stopwords.c 2010-03-10 10:32:14 +0000
@@ -45,7 +45,7 @@ static int ft_add_stopword(const char *w
{
FT_STOPWORD sw;
return !w ||
- (((sw.len= (uint) strlen(sw.pos=w)) >= ft_min_word_len) &&
+ (((sw.len= (uint) strlen(sw.pos=(const uchar *)w)) >= ft_min_word_len) &&
(tree_insert(stopwords3, &sw, 0, stopwords3->custom_arg)==NULL));
}
=== modified file 'storage/myisam/mi_write.c'
--- a/storage/myisam/mi_write.c 2009-12-03 11:19:05 +0000
+++ b/storage/myisam/mi_write.c 2010-03-10 10:32:14 +0000
@@ -735,10 +735,12 @@ static uchar *_mi_find_last_pos(MI_KEYDE
}
end=page+length-key_ref_length;
+ DBUG_ASSERT(page < end);
*key='\0';
length=0;
lastpos=page;
- while (page < end)
+
+ do
{
prevpos=lastpos; lastpos=page;
last_length=length;
@@ -749,7 +751,8 @@ static uchar *_mi_find_last_pos(MI_KEYDE
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0);
}
- }
+ } while (page < end);
+
*return_key_length=last_length;
*after_key=lastpos;
DBUG_PRINT("exit",("returns: 0x%lx page: 0x%lx end: 0x%lx",
=== modified file 'storage/xtradb/btr/btr0cur.c'
--- a/storage/xtradb/btr/btr0cur.c 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/btr/btr0cur.c 2010-03-10 10:32:14 +0000
@@ -3233,7 +3233,7 @@ btr_estimate_number_of_different_key_val
ulint matched_bytes;
ib_int64_t n_recs = 0;
ib_int64_t* n_diff;
- ib_int64_t* n_not_nulls;
+ ib_int64_t* n_not_nulls= 0;
ullint n_sample_pages; /* number of pages to sample */
ulint not_empty_flag = 0;
ulint total_external_size = 0;
=== modified file 'support-files/compiler_warnings.supp'
--- a/support-files/compiler_warnings.supp 2010-01-28 14:49:14 +0000
+++ b/support-files/compiler_warnings.supp 2010-03-10 10:32:14 +0000
@@ -108,7 +108,7 @@ ha_pbxt\.cc : variable.*might be clobber
#
# Yassl
include/runtime.hpp: .*pure_error.*
-.*/extra/yassl/taocrypt/.*: comparison with string literal
+.*/extra/yassl/.*taocrypt/.*: comparison with string literal
.*/extra/yassl/taocrypt/src/blowfish\.cpp: array subscript is above array bounds
.*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value
.*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function
=== modified file 'vio/viossl.c'
--- a/vio/viossl.c 2010-01-29 10:42:31 +0000
+++ b/vio/viossl.c 2010-03-10 10:32:14 +0000
@@ -75,9 +75,11 @@ report_errors(SSL* ssl)
if (ssl)
{
+#ifndef DBUG_OFF
int error= SSL_get_error(ssl, l);
DBUG_PRINT("error", ("error: %s (%d)",
ERR_error_string(error, buf), error));
+#endif
}
DBUG_PRINT("info", ("socket_errno: %d", socket_errno));