List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:November 24 2010 5:37pm
Subject:Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)
Bug#58455
View as plain text  
On 11/24/2010 05:18 PM, Magnus Blåudd wrote:
> We have a my_print_defaults program which might be useful for this test.
>
>
> mtr.pl>
>   # ----------------------------------------------------
>   # my_print_defaults
>   # ----------------------------------------------------
>   my $exe_my_print_defaults=
>     mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
>                    "$path_client_bindir/my_print_defaults",
>                    "$basedir/extra/my_print_defaults");
>   $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= native_path($exe_my_print_defaults);

Well... the goal is not to print the defaults, the server should just
return with an error, but it is necessary to *not* pass any other
options to the program since at least --bootstrap prevents the bug from
being triggered. The --print-defaults is just used to avoid starting the
server if there for some mysterious reason should find a file there.

/Matz

>
>
> / Magnus
>
> On 11/24/2010 03:20 PM, Mats Kindahl wrote:
>> #At file:///home/bzr/mkindahl/testing-trunk-bugfixing/ based on
>> revid:sergey.glukhov@stripped
>>
>>   3388 Mats Kindahl    2010-11-24
>>        Bug #58455
>>        Starting mysqld with defaults file without
>>        extension cause segmentation fault
>>
>>        Bug occurs because fn_expand calls fn_format
>>        with NULL as ext.
>>
>>        Patch solve this problem by using an empty
>>        string as extension, and adding assertions
>>        to fn_format that correct arguments are passed.
>>
>>        It also adds MYSQLD as enviroment variable to
>>        tests to be able to create a test that does not
>>        pass bootstrapping parameters, which seems to
>>        prevent the crash somehow.
>>
>>      added:
>>        mysql-test/r/mysqld--defaults-file.result
>>        mysql-test/t/mysqld--defaults-file.test
>>      modified:
>>        mysql-test/mysql-test-run.pl
>>        mysys/default.c
>>        mysys/mf_format.c
>> === modified file 'mysql-test/mysql-test-run.pl'
>> --- a/mysql-test/mysql-test-run.pl    2010-11-19 10:38:08 +0000
>> +++ b/mysql-test/mysql-test-run.pl    2010-11-24 14:20:25 +0000
>> @@ -3037,13 +3037,14 @@ sub mysql_install_db {
>>       }
>>     }
>>
>> +  $ENV{'MYSQLD'} = find_mysqld($install_basedir);
>> +
>>     # If DISABLE_GRANT_OPTIONS is defined when the server is compiled
>> (e.g.,
>>     # configure --disable-grant-options), mysqld will not recognize the
>>     # --bootstrap or --skip-grant-tables options.  The user can set
>>     # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
>>     # --bootstrap, to accommodate this.
>> -  my $exe_mysqld_bootstrap =
>> -    $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir);
>> +  my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} ||
>> $ENV{'MYSQLD'};
>>
>>     #
>> ----------------------------------------------------------------------
>>     # export MYSQLD_BOOTSTRAP_CMD variable
> containing<path>/mysqld<args>
>>
>> === added file 'mysql-test/r/mysqld--defaults-file.result'
>> --- a/mysql-test/r/mysqld--defaults-file.result    1970-01-01
>> 00:00:00 +0000
>> +++ b/mysql-test/r/mysqld--defaults-file.result    2010-11-24
>> 14:20:25 +0000
>> @@ -0,0 +1,12 @@
>> +Could not open required defaults file: /path/with/no/extension
>> +Fatal error in defaults handling. Program aborted
>> +Could not open required defaults file: /path/with.ext
>> +Fatal error in defaults handling. Program aborted
>> +Could not open required defaults file:
>> MYSQL_TEST_DIR/relative/path/with.ext
>> +Fatal error in defaults handling. Program aborted
>> +Could not open required defaults file:
>> MYSQL_TEST_DIR/relative/path/without/extension
>> +Fatal error in defaults handling. Program aborted
>> +Could not open required defaults file: MYSQL_TEST_DIR/with.ext
>> +Fatal error in defaults handling. Program aborted
>> +Could not open required defaults file: MYSQL_TEST_DIR/no_extension
>> +Fatal error in defaults handling. Program aborted
>>
>> === added file 'mysql-test/t/mysqld--defaults-file.test'
>> --- a/mysql-test/t/mysqld--defaults-file.test    1970-01-01 00:00:00
>> +0000
>> +++ b/mysql-test/t/mysqld--defaults-file.test    2010-11-24 14:20:25
>> +0000
>> @@ -0,0 +1,31 @@
>> +#
>> +# mysqld --defaults-file
>> +#
>> +
>> +--source include/not_embedded.inc
>> +
>> +# All these tests refer to configuration files that do not exist
>> +
>> +--error 1
>> +--exec $MYSQLD --defaults-file=/path/with/no/extension
>> --print-defaults 2>&1
>> +
>> +--error 1
>> +--exec $MYSQLD --defaults-file=/path/with.ext --print-defaults 2>&1
>> +
>> +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
>> +--error 1
>> +--exec $MYSQLD --defaults-file=relative/path/with.ext
>> --print-defaults 2>&1
>> +
>> +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
>> +--error 1
>> +--exec $MYSQLD --defaults-file=relative/path/without/extension
>> --print-defaults 2>&1
>> +
>> +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
>> +--error 1
>> +--exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1
>> +
>> +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
>> +--error 1
>> +--exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1
>> +
>> +
>>
>> === modified file 'mysys/default.c'
>> --- a/mysys/default.c    2010-11-16 11:07:17 +0000
>> +++ b/mysys/default.c    2010-11-24 14:20:25 +0000
>> @@ -165,7 +165,7 @@ fn_expand(const char *filename, char *re
>>     if (my_getwd(dir, sizeof(dir), MYF(0)))
>>       DBUG_RETURN(3);
>>     DBUG_PRINT("debug", ("dir: %s", dir));
>> -  if (fn_format(result_buf, filename, dir, NULL, flags) == NULL)
>> +  if (fn_format(result_buf, filename, dir, "", flags) == NULL)
>>       DBUG_RETURN(2);
>>     DBUG_PRINT("return", ("result: %s", result_buf));
>>     DBUG_RETURN(0);
>>
>> === modified file 'mysys/mf_format.c'
>> --- a/mysys/mf_format.c    2009-04-19 01:21:33 +0000
>> +++ b/mysys/mf_format.c    2010-11-24 14:20:25 +0000
>> @@ -31,9 +31,12 @@ char * fn_format(char * to, const char *
>>     reg1 size_t length;
>>     size_t dev_length;
>>     DBUG_ENTER("fn_format");
>> +  DBUG_ASSERT(name != NULL);
>> +  DBUG_ASSERT(extension != NULL);
>>     DBUG_PRINT("enter",("name: %s  dir: %s  extension: %s  flag: %d",
>>                  name,dir,extension,flag));
>>
>> +
>>     /* Copy and skip directory */
>>     name+=(length=dirname_part(dev, (startpos=(char *)
>> name),&dev_length));
>>     if (length == 0 || (flag&  MY_REPLACE_DIR))
>>
>>
>>
>>
>>
>

Thread
bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388) Bug#58455Mats Kindahl24 Nov
Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Magnus BlĂ„udd24 Nov
  • Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Mats Kindahl24 Nov
Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Guilhem Bichot25 Nov
  • Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Guilhem Bichot25 Nov
  • Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Mats Kindahl26 Nov
  • Re: bzr commit into mysql-trunk-bugfixing branch (mats.kindahl:3388)Bug#58455Mats Kindahl26 Nov
Re: bzr commit into mysql-trunk-bugfixing branch(mats.kindahl:3388) Bug#58455Bjorn Munch25 Nov