Skip to content

Commit ad807ea

Browse files
author
Tatiana Azundris Nuernberg
committed
Merge branch 'mysql-8.0-bug26576922' into mysql-trunk-bug26576922
2 parents 59c5fa1 + e233710 commit ad807ea

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

mysql-test/r/log_options_cmdline.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ DROP TABLE t1;
2121
# restart: --log-error=LOG_FILE8 --lc-messages-dir=MSG_DIR --log-error-verbosity=3
2222
connect(localhost,unknown_user,,,MASTER_PORT,MASTER_SOCKET);
2323
ERROR 28000: Access denied for user 'unknown_user'@'localhost' (using password: NO)
24+
# restart: --log-error=LOG_FILE8B --lc-messages=invalid_arg1 --lc-time-names=invalid_arg2
25+
connect(localhost,unknown_user,,,MASTER_PORT,MASTER_SOCKET);
26+
ERROR 28000: Access denied for user 'unknown_user'@'localhost' (using password: NO)
2427
# restart: --log-error=LOG_FILE9 --log-error-services=abcd
2528
SELECT @@GLOBAL.LOG_ERROR_SERVICES;
2629
@@GLOBAL.LOG_ERROR_SERVICES

mysql-test/t/log_options_cmdline.test

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ DROP TABLE t1;
103103

104104
# 3.1. Test giving an empty lc-messages-dir and verify that the
105105
# server makes use of builtin english messages when the
106-
# language files(errmsg.sys) are not found
106+
# language files (errmsg.sys) are not found
107107
#--------------------------------------------------------------
108108
--let LOG_FILE8 = $MYSQLTEST_VARDIR/tmp/wl9344.err
109109
--let $MSG_DIR = $MYSQLTEST_VARDIR/tmp/empty_lcmsgsdir
@@ -117,6 +117,25 @@ connect(con4,localhost,unknown_user,,*NO-ONE*);
117117
--rmdir $MSG_DIR
118118

119119

120+
# Related:
121+
#
122+
# Bug#26576922: SERVER DOESN'T ALWAYS FALL BACK TO DEFAULT ERROR MESSAGES
123+
#
124+
# Test giving an empty lc-messages and verify that the
125+
# server makes use of builtin english messages when the
126+
# language files (errmsg.sys) are not found
127+
#--------------------------------------------------------------
128+
--let LOG_FILE8B = $MYSQLTEST_VARDIR/tmp/bug26576922.err
129+
--mkdir $MSG_DIR
130+
--let restart_parameters="restart: --log-error=$LOG_FILE8B --lc-messages=invalid_arg1 --lc-time-names=invalid_arg2"
131+
--replace_result $LOG_FILE8B LOG_FILE8B $MSG_DIR MSG_DIR
132+
--source include/restart_mysqld.inc
133+
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
134+
--error ER_ACCESS_DENIED_ERROR
135+
connect(con4,localhost,unknown_user,,*NO-ONE*);
136+
--rmdir $MSG_DIR
137+
138+
120139
##================================================================##
121140
# 4 - WL#9323: Logging services: Improved Error logging in 8.0 #
122141
##================================================================##
@@ -437,6 +456,7 @@ EOF
437456
--remove_file $LOG_FILE5
438457
--remove_file $LOG_FILE7
439458
--remove_file $LOG_FILE8
459+
--remove_file $LOG_FILE8B
440460
--remove_file $LOG_FILE9
441461
--remove_file $LOG_FILE10
442462
--remove_file $LOG_FILE11

sql/mysqld.cc

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ using std::min;
595595
using std::max;
596596
using std::vector;
597597

598-
#define mysqld_charset &my_charset_latin1
598+
#define mysqld_charset &my_charset_latin1
599+
#define mysqld_default_locale_name "en_US"
599600

600601
#if defined(HAVE_SOLARIS_LARGE_PAGES) && defined(__GNUC__)
601602
extern "C" int getpagesizes(size_t *, int);
@@ -3596,12 +3597,15 @@ int init_common_variables()
35963597
if (back_log == 0 && (back_log= max_connections) > 65535)
35973598
back_log= 65535;
35983599

3599-
unireg_init(opt_specialflag); /* Set up extern variabels */
3600-
if (!(my_default_lc_messages=
3601-
my_locale_by_name(NULL, lc_messages)))
3600+
unireg_init(opt_specialflag); /* Set up extern variables */
3601+
while (!(my_default_lc_messages=
3602+
my_locale_by_name(NULL, lc_messages)))
36023603
{
36033604
LogErr(ERROR_LEVEL, ER_UNKNOWN_LOCALE, lc_messages);
3604-
return 1;
3605+
if (!my_strcasecmp(&my_charset_latin1,
3606+
lc_messages, mysqld_default_locale_name))
3607+
return 1;
3608+
lc_messages= (char*) mysqld_default_locale_name;
36053609
}
36063610
global_system_variables.lc_messages= my_default_lc_messages;
36073611
if (init_errmessage()) /* Read error messages from file */
@@ -3688,11 +3692,14 @@ int init_common_variables()
36883692
return 1;
36893693
}
36903694

3691-
if (!(my_default_lc_time_names=
3692-
my_locale_by_name(NULL, lc_time_names_name)))
3695+
while (!(my_default_lc_time_names=
3696+
my_locale_by_name(NULL, lc_time_names_name)))
36933697
{
36943698
LogErr(ERROR_LEVEL, ER_UNKNOWN_LOCALE, lc_time_names_name);
3695-
return 1;
3699+
if (!my_strcasecmp(&my_charset_latin1,
3700+
lc_time_names_name, mysqld_default_locale_name))
3701+
return 1;
3702+
lc_time_names_name= (char*) mysqld_default_locale_name;
36963703
}
36973704
global_system_variables.lc_time_names= my_default_lc_time_names;
36983705

@@ -8113,14 +8120,14 @@ static int mysql_init_variables()
81138120
log_bin_index= NULL;
81148121

81158122
/* Handler variables */
8116-
total_ha_2pc= 0;
8123+
total_ha_2pc= 0;
81178124
/* Variables in libraries */
8118-
charsets_dir= 0;
8119-
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
8120-
default_collation_name= compiled_default_collation_name;
8125+
charsets_dir= 0;
8126+
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
8127+
default_collation_name= compiled_default_collation_name;
81218128
character_set_filesystem_name= (char*) "binary";
8122-
lc_messages= (char*) "en_US";
8123-
lc_time_names_name= (char*) "en_US";
8129+
lc_messages= (char*) mysqld_default_locale_name;
8130+
lc_time_names_name= (char*) mysqld_default_locale_name;
81248131

81258132
/* Variables that depends on compile options */
81268133
#ifndef DBUG_OFF

0 commit comments

Comments
 (0)