From: msvensson Date: February 20 2007 3:12pm Subject: bk commit into 5.0 tree (msvensson:1.2427) BUG#20166 List-Archive: http://lists.mysql.com/commits/20177 X-Bug: 20166 Message-Id: <200702201512.l1KFCI3a023441@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:12:14+01:00, msvensson@stripped +3 -0 Bug#20166 mysql-test-run.pl does not test system privilege tables creation - Part 2, add @@hostname system variable sql/log.cc@stripped, 2007-02-20 16:12:13+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:12:13+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:12:13+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:12:13 +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:12:13 +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.179/sql/set_var.cc 2007-02-14 14:45:13 +01:00 +++ 1.180/sql/set_var.cc 2007-02-20 16:12:13 +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},