Commit 6559e927 authored by Olav Sandstaa's avatar Olav Sandstaa

Fix for Bug#50221 Server refuses to start from non-default installdir on Solaris 32-bit

When starting mysqld it did not recognize most of the options given on
the command line when it was compiled for 32-bit Solaris using Sun
Studio compiler. The cause for this was that most of the entries in
the my_long_options array contained "garbage" data. The garbage data
was caused by a compiler bug. When initilizing the def_value member
for the "default-storage-engine" entry it was initialized like this:

  (longlong)"MyISAM"

i.e. casting a 32 bit pointer to a 64 bit integer value. Due to the
compiler bug only 4 bytes was allocated (instead of 8 bytes). This
caused everything following this entry to be stored at a location that
was 4 byte wrong.

The fix/work-around for this problem is initialize the def_value
for default-storage-engine in my_long_options to 0 and instead
initialize the default_storage_engine variable to "MyISAM" in
init_common_variables().
parent 7401bc28
......@@ -3336,6 +3336,16 @@ static int init_common_variables()
strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
/*
The default-storage-engine entry in my_long_options should have a
non-null default value. It was earlier intialized as
(longlong)"MyISAM" in my_long_options but this triggered a
compiler error in the Sun Studio 12 compiler. As a work-around we
set the def_value member to 0 in my_long_options and initialize it
to the correct value here.
*/
default_storage_engine="MyISAM";
/*
Add server status variables to the dynamic list of
status variables that is shown by SHOW STATUS.
......@@ -5953,9 +5963,12 @@ struct my_option my_long_options[]=
{"default-collation", 0, "Set the default collation (deprecated option, use --collation-server instead).",
(uchar**) &default_collation_name, (uchar**) &default_collation_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
/* default-storage-engine should have "MyISAM" as def_value. Instead
of initializing it here it is done in init_common_variables() due
to a compiler bug in Sun Studio compiler. */
{"default-storage-engine", 0, "The default storage engine for new tables",
(uchar**) &default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
(longlong)"MyISAM", 0, 0, 0, 0, 0 },
0, 0, 0, 0, 0, 0 },
{"default-time-zone", 0, "Set the default time zone.",
(uchar**) &default_tz_name, (uchar**) &default_tz_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 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