Commit b3e3c388 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0-maint

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint


Makefile.am:
  Auto merged
client/mysql_upgrade.c:
  Auto merged
sql/mysql_priv.h:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
parents b873193a 6a05f2af
......@@ -1085,6 +1085,7 @@ repl-tests/test-repl/sum-wlen-slave.master.re
repl-tests/test-repl/sum-wlen-slave.master.reje
replace/*.ds?
replace/*.vcproj
scripts/comp_sql
scripts/fill_func_tables
scripts/fill_func_tables.sql
scripts/fill_help_tables
......@@ -1102,6 +1103,7 @@ scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_fix_privilege_tables_sql.c
scripts/mysql_install_db
scripts/mysql_secure_installation
scripts/mysql_setpermission
......
......@@ -133,10 +133,11 @@ ADD_SUBDIRECTORY(dbug)
ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(scripts)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(zlib)
ADD_SUBDIRECTORY(heap)
ADD_SUBDIRECTORY(myisam)
ADD_SUBDIRECTORY(myisammrg)
......
......@@ -21,9 +21,9 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
@readline_topdir@ sql-common \
@readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \
@sql_union_dirs@ scripts @man_dirs@ tests \
@sql_union_dirs@ @man_dirs@ tests \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @tools_dirs@
......
......@@ -83,6 +83,7 @@ TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug yassl taocrypt zlib wso
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug yassl taocrypt zlib wsock32)
......
This diff is collapsed.
......@@ -1329,23 +1329,31 @@ void var_set(const char *var_name, const char *var_name_end,
DBUG_VOID_RETURN;
}
void var_set_string(const char* name, const char* value)
{
var_set(name, name + strlen(name), value, value + strlen(value));
}
void var_set_int(const char* name, int value)
{
char buf[21];
my_snprintf(buf, sizeof(buf), "%d", value);
var_set_string(name, buf);
}
/*
Store an integer (typically the returncode of the last SQL)
statement in the mysqltest builtin variable $mysql_errno, by
simulating of a user statement "let $mysql_errno= <integer>"
statement in the mysqltest builtin variable $mysql_errno
*/
void var_set_errno(int sql_errno)
{
/* TODO MASV make easier */
const char *var_name= "$mysql_errno";
char var_val[21];
uint length= my_sprintf(var_val, (var_val, "%d", sql_errno));
var_set(var_name, var_name + 12, var_val, var_val + length);
return;
var_set_int("$mysql_errno", sql_errno);
}
/*
Set variable from the result of a query
......@@ -6011,6 +6019,8 @@ int main(int argc, char **argv)
1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed");
var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION);
memset(&master_pos, 0, sizeof(master_pos));
parser.current_line= parser.read_lines= 0;
......
......@@ -86,6 +86,14 @@
#endif
#endif /* _WIN32... */
/* Make it easier to add conditionl code for windows */
#ifdef __WIN__
#define IF_WIN(A,B) (A)
#else
#define IF_WIN(A,B) (B)
#endif
/* Some defines to avoid ifdefs in the code */
#ifndef NETWARE_YIELD
#define NETWARE_YIELD
......
......@@ -354,6 +354,13 @@ sub collect_one_test_case($$$$$$$) {
next;
}
$value= mtr_match_prefix($opt, "--slave-num=");
if ( defined $value )
{
$tinfo->{'slave_num'}= $value;
next;
}
$value= mtr_match_prefix($opt, "--result-file=");
if ( defined $value )
{
......
......@@ -1099,6 +1099,13 @@ sub mtr_kill_processes ($) {
foreach my $pid (@$pids)
{
if ($pid <= 0)
{
mtr_warning("Trying to kill illegal pid: $pid");
next;
}
foreach my $sig (15, 9)
{
last if mtr_im_kill_process([ $pid ], $sig, 10, 1);
......
......@@ -16,48 +16,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
@hadGrantPriv:=1
1
1
1
@hadShowDbPriv:=1
1
1
1
@hadCreateViewPriv:=1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
@hadCreateUserPriv:=1
1
1
1
Run it again - should say already completed
@hadGrantPriv:=1
1
1
1
@hadShowDbPriv:=1
1
1
1
@hadCreateViewPriv:=1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
@hadCreateUserPriv:=1
1
1
1
Force should run it regardless of wheter it's been run before
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
mysql.columns_priv OK
mysql.db OK
mysql.func OK
......@@ -75,23 +36,27 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
@hadGrantPriv:=1
1
1
1
@hadShowDbPriv:=1
1
1
1
@hadCreateViewPriv:=1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
@hadCreateUserPriv:=1
1
1
1
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.proc OK
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
DROP USER mysqltest1@'%';
Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
......@@ -7,17 +7,55 @@
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log
# Get version of the server so it can be masked out in the
# error messages from mysql_upgrade
let $VERSION=`select LEFT(version(), 6)`;
#
# Basic test thta we can run mysql_upgrde and that it finds the
# Basic test that we can run mysql_upgrde and that it finds the
# expected binaries it uses.
#
--echo Run mysql_upgrade once
--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
# It should have created a file in the MySQL Servers datadir
file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
--echo Run it again - should say already completed
--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
--replace_result $VERSION VERSION
--error 1
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
# It should have created a file in the MySQL Servers datadir
file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
--echo Force should run it regardless of wether it's been run before
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
# It should have created a file in the MySQL Servers datadir
file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
#
# Bug #25452 mysql_upgrade access denied.
#
# Password protect a root account and run mysql_upgrade
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
--echo Run mysql_upgrade with password protected account
--exec $MYSQL_UPGRADE --skip-verbose --force --user=mysqltest1 --password=sakila 2>&1
--echo Force should run it regardless of wheter it's been run before
--exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
DROP USER mysqltest1@'%';
#
# Bug #26639 mysql_upgrade exits successfully even if external command failed
#
--echo Run mysql_upgrade with a non existing server socket
--replace_result $MYSQLTEST_VARDIR var
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host 2>&1
# Copyright (C) 2006 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ADD_EXECUTABLE(comp_sql comp_sql.c)
TARGET_LINK_LIBRARIES(comp_sql dbug mysys strings)
# Build comp_sql - used for embedding SQL in C or C++ programs
GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c
COMMAND ${COMP_SQL_EXE}
mysql_fix_privilege_tables.sql
mysql_fix_privilege_tables_sql.c
DEPENDS comp_sql ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql)
ADD_CUSTOM_TARGET(GenFixPrivs
ALL
DEPENDS ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
......@@ -65,7 +65,8 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \
mysqlbug \
make_win_bin_dist \
mysql_system_tables_fix.sql
mysql_system_tables_fix.sql \
CMakeLists.txt
dist_pkgdata_DATA = fill_help_tables.sql \
mysql_fix_privilege_tables.sql \
......@@ -165,5 +166,19 @@ SUFFIXES = .sh
@CHMOD@ +x $@-t
@MV@ $@-t $@
BUILT_SOURCES = mysql_fix_privilege_tables_sql.c
noinst_PROGRAMS = comp_sql
#
# Build mysql_fix_privilege_tables_sql.c from
# mysql_fix_privileges_tables.sql using comp_sql
#
mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql
$(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT)
$(top_builddir)/scripts/comp_sql$(EXEEXT) \
mysql_fix_privilege_tables.sql $@
# Don't update the files from bitkeeper
%::SCCS/s.%
/* Copyright (C) 2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Written by Magnus Svensson
*/
/*
Converts a SQL file into a C file that can be compiled and linked
into other programs
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
FILE *in, *out;
static void die(const char *fmt, ...)
{
va_list args;
/* Print the error message */
fprintf(stderr, "FATAL ERROR: ");
if (fmt)
{
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
else
fprintf(stderr, "unknown error");
fprintf(stderr, "\n");
fflush(stderr);
/* Close any open files */
if (in)
fclose(in);
if (out)
fclose(out);
exit(1);
}
int main(int argc, char *argv[])
{
char buff[512];
char* infile_name= argv[1];
char* outfile_name= argv[2];
char* end= infile_name;
if (argc != 3)
die("Usage: comp_sql <sql_filename> <c_filename>");
/* Open input and output file */
if (!(in= fopen(infile_name, "r")))
die("Failed to open SQL file '%s'", infile_name);
if (!(out= fopen(outfile_name, "w")))
die("Failed to open output file '%s'", outfile_name);
while(*end && *end != '.')
end++;
*end= 0;
fprintf(out, "const char* %s={\n\"", infile_name);
while (fgets(buff, sizeof(buff), in))
{
char *curr= buff;
while (*curr)
{
if (*curr == '\n')
{
/*
Reached end of line, add escaped newline, escaped
backslash and a newline to outfile
*/
fprintf(out, "\\n \"\n\"");
curr++;
}
else if (*curr == '\r')
{
curr++; /* Skip */
}
else
{
if (*curr == '"')
{
/* Needs escape */
fputc('\\', out);
}
fputc(*curr, out);
curr++;
}
}
if (*(curr-1) != '\n')
{
/*
Some compilers have a max string length,
insert a newline at every 512th char in long
strings
*/
fprintf(out, "\"\n\"");
}
}
fprintf(out, "\\\n\"};\n");
fclose(in);
fclose(out);
exit(0);
}
......@@ -268,7 +268,6 @@ MY_LOCALE *my_locale_by_number(uint number);
#endif
#if defined(__WIN__) || defined(OS2)
#define IF_WIN(A,B) (A)
#undef FLUSH_TIME
#define FLUSH_TIME 1800 /* Flush every half hour */
......@@ -277,7 +276,6 @@ MY_LOCALE *my_locale_by_number(uint number);
#define WAIT_PRIOR 0
#define QUERY_PRIOR 2
#else
#define IF_WIN(A,B) (B)
#define INTERRUPT_PRIOR 10
#define CONNECT_PRIOR 9
#define WAIT_PRIOR 8
......
......@@ -85,7 +85,7 @@ struct my_tests_st
if (opt_silent < 2) \
{ \
fprintf(stdout, "\n\n#####################################\n"); \
fprintf(stdout, "%d of (%d/%d): %s", test_count++, iter_count, \
fprintf(stdout, "%u of (%u/%u): %s", test_count++, iter_count, \
opt_count, str); \
fprintf(stdout, " \n#####################################\n"); \
}
......@@ -99,7 +99,7 @@ if (!opt_silent) \
static void print_error(const char *msg);
static void print_st_error(MYSQL_STMT *stmt, const char *msg);
static void client_disconnect();
static void client_disconnect(void);
/*
......@@ -118,7 +118,7 @@ static void client_disconnect();
#define DIE(expr) \
die(__FILE__, __LINE__, #expr)
void die(const char *file, int line, const char *expr)
static void die(const char *file, int line, const char *expr)
{
fflush(stdout);
fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
......@@ -252,7 +252,7 @@ static my_bool check_have_innodb(MYSQL *conn)
mysql_simple_prepare(): a variant without the 'length' parameter.
*/
MYSQL_STMT *STDCALL
static MYSQL_STMT *STDCALL
mysql_simple_prepare(MYSQL *mysql_arg, const char *query)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg);
......@@ -467,7 +467,7 @@ static void my_print_result_metadata(MYSQL_RES *result)
/* Process the result set */
int my_process_result_set(MYSQL_RES *result)
static int my_process_result_set(MYSQL_RES *result)
{
MYSQL_ROW row;
MYSQL_FIELD *field;
......@@ -523,7 +523,7 @@ int my_process_result_set(MYSQL_RES *result)
}
int my_process_result(MYSQL *mysql_arg)
static int my_process_result(MYSQL *mysql_arg)
{
MYSQL_RES *result;
int row_count;
......@@ -543,7 +543,7 @@ int my_process_result(MYSQL *mysql_arg)
#define MAX_RES_FIELDS 50
#define MAX_FIELD_DATA_SIZE 255
int my_process_stmt_result(MYSQL_STMT *stmt)
static int my_process_stmt_result(MYSQL_STMT *stmt)
{
int field_count;
int row_count= 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