Commit 30088b9d authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
parents dc9c3b5a f25590d8
......@@ -31,10 +31,12 @@
const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe";
const char *mysqld_name= "mysqld.exe";
#define EXTRA_CLIENT_PATHS "client/release", "client/debug"
#else
const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql";
const char *mysqld_name= "mysqld";
#define EXTRA_CLIENT_PATHS "client"
#endif /*__WIN__*/
extern TYPELIB sql_protocol_typelib;
......@@ -497,8 +499,9 @@ int main(int argc, char **argv)
"mysql", NullS))
{
ret= 1;
puts("Can't find data directory. Please restart with"
" --datadir=path-to-writable-data-dir");
fprintf(stderr,
"Can't find data directory. Please restart with"
" --datadir=path-to-writable-data-dir");
goto error;
}
......@@ -541,11 +544,13 @@ int main(int argc, char **argv)
}
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
"bin", "client", NullS))
"bin", EXTRA_CLIENT_PATHS, NullS))
{
ret= 1;
printf("Can't find program '%s'\n", mysqlcheck_name);
puts("Please restart with --basedir=mysql-install-directory");
fprintf(stderr,
"Can't find program '%s'\n"
"Please restart with --basedir=mysql-install-directory",
mysqlcheck_name);
goto error;
}
else
......@@ -567,7 +572,7 @@ int main(int argc, char **argv)
ret= system(cmdline.str);
if (ret)
{
printf("Error executing '%s'\n", cmdline.str);
fprintf(stderr, "Error executing '%s'\n", cmdline.str);
goto error;
}
......@@ -578,12 +583,13 @@ int main(int argc, char **argv)
fix_priv_tables:
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
"bin", "client", NullS))
"bin", EXTRA_CLIENT_PATHS, NullS))
{
ret= 1;
puts("Could not find MySQL command-line client (mysql).\n"
"Please use --basedir to specify the directory"
" where MySQL is installed.");
fprintf(stderr,
"Could not find MySQL command-line client (mysql).\n"
"Please use --basedir to specify the directory"
" where MySQL is installed.");
goto error;
}
else
......@@ -598,9 +604,10 @@ fix_priv_tables:
"share/mysql", NullS))
{
ret= 1;
puts("Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
"Please use --basedir to specify the directory"
" where MySQL is installed");
fprintf(stderr,
"Could not find file " MYSQL_FIX_PRIV_TABLES_NAME "\n"
"Please use --basedir to specify the directory"
" where MySQL is installed");
goto error;
}
else
......@@ -621,7 +628,7 @@ fix_priv_tables:
ret= system(cmdline.str);
if (ret)
printf("Error executing '%s'\n", cmdline.str);
fprintf(stderr, "Error executing '%s'\n", cmdline.str);
error:
dynstr_free(&cmdline);
......
......@@ -4138,8 +4138,9 @@ void init_win_path_patterns()
/* List of string patterns to match in order to find paths */
const char* paths[] = { "$MYSQL_TEST_DIR",
"$MYSQL_TMP_DIR",
"./test/", 0 };
int num_paths= 3;
"$MYSQLTEST_VARDIR",
"./test/" };
int num_paths= sizeof(paths)/sizeof(char*);
int i;
char* p;
......@@ -4159,6 +4160,13 @@ void init_win_path_patterns()
else
p= my_strdup(paths[i], MYF(MY_FAE));
/* Don't insert zero length strings in patterns array */
if (strlen(p) == 0)
{
my_free(p, MYF(0));
continue;
}
if (insert_dynamic(&patterns, (gptr) &p))
die(NullS);
......@@ -4208,7 +4216,7 @@ void fix_win_paths(const char *val, int len)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
DBUG_PRINT("info", ("pattern: %s", *pattern));
if (strlen(*pattern) == 0) continue;
/* Search for the path in string */
while ((p= strstr(val, *pattern)))
{
......@@ -6448,7 +6456,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
{
my_regex_t r;
my_regmatch_t *subs;
char *buf_end, *replace_end;
char *replace_end;
char *buf= *buf_p;
int len;
int buf_len, need_buf_len;
......@@ -6468,8 +6476,6 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
SECURE_REG_BUF
buf_end= buf + buf_len;
if (icase)
cflags|= REG_ICASE;
......
......@@ -34,7 +34,12 @@ sub mtr_verbose (@);
# We can't use diff -u or diff -a as these are not portable
sub mtr_show_failed_diff ($) {
my $tname= shift;
my $result_file_name= shift;
# The reject and log files have been dumped to
# to filenames based on the result_file's name
my $tname= basename($result_file_name);
$tname=~ s/\..*$//;
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
......
......@@ -151,6 +151,7 @@ our $exe_mysqlslap;
our $exe_mysqlimport;
our $exe_mysqlshow;
our $exe_mysql_fix_system_tables;
our $file_mysql_fix_privilege_tables;
our $exe_mysqltest;
our $exe_ndbd;
our $exe_ndb_mgmd;
......@@ -1414,6 +1415,9 @@ sub executable_setup () {
"$path_client_bindir/mysql_fix_privilege_tables");
}
# Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql");
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
{
......@@ -1836,6 +1840,7 @@ sub environment_setup () {
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
}
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
......@@ -3259,7 +3264,7 @@ sub report_failure_and_restart ($) {
my $tinfo= shift;
mtr_report_test_failed($tinfo);
mtr_show_failed_diff($tinfo->{'name'});
mtr_show_failed_diff($tinfo->{'result_file'});
print "\n";
if ( $opt_force )
{
......
......@@ -10,9 +10,11 @@
#
# This is the test for mysql_fix_privilege_tables
# It checks that a system tables from mysql 3.20
# can be upgraded to current system table format
#
# Note: If this test fails, don't be confused about the errors reported
# by mysql-test-run; This shows warnings from generated by
# by mysql-test-run This shows warnings generated by
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
......@@ -85,7 +87,7 @@ INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1
-- enable_query_log
-- enable_result_log
......
This diff is collapsed.
......@@ -186,6 +186,7 @@ ALTER TABLE user
MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
ALTER TABLE db
MODIFY Host char(60) NOT NULL default '',
MODIFY Db char(64) NOT NULL default '',
......@@ -204,6 +205,7 @@ ALTER TABLE db
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE host
MODIFY Host char(60) NOT NULL default '',
MODIFY Db char(64) NOT NULL default '',
......@@ -221,6 +223,7 @@ ALTER TABLE host
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE func
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE func
......@@ -255,15 +258,25 @@ SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%';
# Create VIEWs privileges (v5.0)
#
ALTER TABLE db ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
ALTER TABLE db MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
ALTER TABLE host ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
ALTER TABLE host MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
ALTER TABLE user ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
ALTER TABLE user MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
#
# Show VIEWs privileges (v5.0)
#
ALTER TABLE db ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
ALTER TABLE db MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
ALTER TABLE host ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
ALTER TABLE host MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
ALTER TABLE user MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
#
# Show/Create views table privileges (v5.0)
......@@ -285,18 +298,31 @@ SELECT @hadCreateRoutinePriv:=1 FROM user WHERE Create_routine_priv LIKE '%';
# Create PROCEDUREs privileges (v5.0)
#
ALTER TABLE db ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
ALTER TABLE db MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
ALTER TABLE host ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
ALTER TABLE host MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
ALTER TABLE user ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
ALTER TABLE user MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
#
# Alter PROCEDUREs privileges (v5.0)
#
ALTER TABLE db ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE db MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE host ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE host MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE user ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE user MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
ALTER TABLE db ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
ALTER TABLE db MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
ALTER TABLE host ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
ALTER TABLE host MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
#
# Assign create/alter routine privileges to people who have create privileges
......@@ -318,6 +344,7 @@ SET @hadCreateUserPriv:=0;
SELECT @hadCreateUserPriv:=1 FROM user WHERE Create_user_priv LIKE '%';
ALTER TABLE user ADD Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
ALTER TABLE user MODIFY Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
UPDATE user LEFT JOIN db USING (Host,User) SET Create_user_priv='Y'
WHERE @hadCreateUserPriv = 0 AND
(user.Grant_priv = 'Y' OR db.Grant_priv = 'Y');
......
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