From: msvensson Date: February 20 2007 3:24pm Subject: bk commit into 5.0 tree (msvensson:1.2427) BUG#20166 List-Archive: http://lists.mysql.com/commits/20185 X-Bug: 20166 Message-Id: <200702201524.l1KFOqms027043@pilot.blaudden> Below is the list of changes that have just been committed into a local 5.0 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-02-20 16:24:38+01:00, msvensson@stripped +5 -0 Bug#20166 mysql-test-run.pl does not test system privilege tables creation - Part 2, add @@hostname system variable mysql-test/r/variables.result@stripped, 2007-02-20 16:24:37+01:00, msvensson@stripped +8 -0 Add testcase for @@hostname mysql-test/t/variables.test@stripped, 2007-02-20 16:24:37+01:00, msvensson@stripped +11 -0 Add testcase for @@hostname sql/log.cc@stripped, 2007-02-20 16:24:37+01:00, msvensson@stripped +1 -1 Use pidfile_name as base when generating the default log name sql/mysqld.cc@stripped, 2007-02-20 16:24:37+01:00, msvensson@stripped +10 -4 Init "glob_hostname" to that of hostname, fallback to "localhost" if 'gethostname' should fail. Init "pidfile_name" to hostname.pid and fallback to "mysql.pid" if 'gethostname' should fail sql/set_var.cc@stripped, 2007-02-20 16:24:37+01:00, msvensson@stripped +6 -0 Add new system variable "hostname" # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: pilot.blaudden # Root: /home/msvensson/mysql/bug20166/my50-bug20166 --- 1.200/sql/log.cc 2007-01-12 12:22:48 +01:00 +++ 1.201/sql/log.cc 2007-02-20 16:24:37 +01:00 @@ -452,7 +452,7 @@ TODO: The following should be using fn_format(); We just need to first change fn_format() to cut the file name if it's too long. */ - strmake(buff,glob_hostname,FN_REFLEN-5); + strmake(buff, pidfile_name,FN_REFLEN-5); strmov(fn_ext(buff),suffix); return (const char *)buff; } --- 1.598/sql/mysqld.cc 2007-02-14 14:45:13 +01:00 +++ 1.599/sql/mysqld.cc 2007-02-20 16:24:37 +01:00 @@ -2636,9 +2636,15 @@ mysql_slow_log.init_pthread_objects(); mysql_bin_log.init_pthread_objects(); - if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) - strmov(glob_hostname,"mysql"); - strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); + if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0) + { + strmake(glob_hostname, STRING_WITH_LEN("localhost")); + sql_print_warning("gethostname failed, using '%s' as hostname", + glob_hostname); + strmake(pidfile_name, STRING_WITH_LEN("mysql")); + } + else + strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmov(fn_ext(pidfile_name),".pid"); // Add proper extension load_defaults(conf_file_name, groups, &argc, &argv); @@ -3087,7 +3093,7 @@ if (opt_error_log) { if (!log_error_file_ptr[0]) - fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", + fn_format(log_error_file, pidfile_name, mysql_data_home, ".err", MY_REPLACE_EXT); /* replace '.' by '.err', bug#4997 */ else fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", --- 1.90/mysql-test/r/variables.result 2006-12-05 10:57:26 +01:00 +++ 1.91/mysql-test/r/variables.result 2007-02-20 16:24:37 +01:00 @@ -752,6 +752,14 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1 select @@@; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1 +select @@hostname; +@@hostname +# +set @@hostname= "anothername"; +ERROR HY000: Variable 'hostname' is a read only variable +show variables like 'hostname'; +Variable_name Value +hostname # End of 5.0 tests set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; --- 1.65/mysql-test/t/variables.test 2006-12-05 10:57:26 +01:00 +++ 1.66/mysql-test/t/variables.test 2007-02-20 16:24:37 +01:00 @@ -639,6 +639,17 @@ --error ER_PARSE_ERROR select @@@; +# +# Bug#20166 mysql-test-run.pl does not test system privilege tables creation +# +# Don't actually output, since it depends on the system +--replace_column 1 # +select @@hostname; +--error 1238 +set @@hostname= "anothername"; +--replace_column 2 # +show variables like 'hostname'; + --echo End of 5.0 tests # This is at the very after the versioned tests, since it involves doing --- 1.179/sql/set_var.cc 2007-02-14 14:45:13 +01:00 +++ 1.180/sql/set_var.cc 2007-02-20 16:24:37 +01:00 @@ -590,6 +590,10 @@ /* Global read-only variable describing server license */ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE)); +/* Global read-only variable containing hostname */ +sys_var_const_str sys_hostname("hostname", glob_hostname); + + /* List of all variables for initialisation and storage in hash @@ -642,6 +646,7 @@ &sys_foreign_key_checks, &sys_group_concat_max_len, &sys_have_innodb, + &sys_hostname, &sys_identity, &sys_init_connect, &sys_init_slave, @@ -874,6 +879,7 @@ {"have_raid", (char*) &have_raid, SHOW_HAVE}, {"have_rtree_keys", (char*) &have_rtree_keys, SHOW_HAVE}, {"have_symlink", (char*) &have_symlink, SHOW_HAVE}, + {sys_hostname.name, (char*) &sys_hostname, SHOW_SYS}, {"init_connect", (char*) &sys_init_connect, SHOW_SYS}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_slave", (char*) &sys_init_slave, SHOW_SYS},