← Back to team overview

maria-developers team mailing list archive

Re: [Commits] ed5ec30: MDEV-7780 - Support for faking server version

 

Hi, Sergey!

On Dec 24, Sergey Vojtovich wrote:
> revision-id: ed5ec30f9ca448086db5acbfd5f484a534119810 (mariadb-10.1.8-101-ged5ec30)
> parent(s): 1f19c6aa93de730cd10c9fcbb337f9ec5c30ef9d
> committer: Sergey Vojtovich
> timestamp: 2015-12-24 15:46:18 +0400
> message:
> 
> MDEV-7780 - Support for faking server version
> 
> Embedded now supports "--version=<version>", while "--version" is still silently
> ignored. Also only run protocol check in non-embedded mode.

As I said on irc, I'd simply use not_embedded.inc, but ok, if you want
it to work in embedded, sure, do it.

One question below.

> ---
>  mysql-test/suite/sys_vars/t/version.test | 3 ++-
>  sql/mysqld.cc                            | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/mysql-test/suite/sys_vars/t/version.test b/mysql-test/suite/sys_vars/t/version.test
> index 7955bf8..daa9538 100644
> --- a/mysql-test/suite/sys_vars/t/version.test
> +++ b/mysql-test/suite/sys_vars/t/version.test
> @@ -1,5 +1,6 @@
>  SELECT @@version;
>  perl;
> -  $cnt= grep /my_favorite_version/, `$ENV{MYSQL} -e status`;
> +  $cnt= $ENV{MYSQL_TEST} =~ /mysqltest_embedded / ? 1 :
> +        grep /my_favorite_version/, `$ENV{MYSQL} -e status`;

Why wouldn't you use mysql_embedded in this case?
Like

  $mysql= $ENV{MYSQL_TEST} =~ /mysqltest_embedded / ? 'MYSQL_EMBEDDED' : 'MYSQL';
  $cnt= grep /my_favorite_version/, `$ENV{$mysql} -e status`;

>    print "$cnt\n";
>  EOF
> diff --git a/sql/mysqld.cc b/sql/mysqld.cc
> index 7360204..fa3a70f 100644
> --- a/sql/mysqld.cc
> +++ b/sql/mysqld.cc
> @@ -8972,20 +8972,20 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
>      binlog_format_used= true;
>      break;
>  #include <sslopt-case.h>
> -#ifndef EMBEDDED_LIBRARY
>    case 'V':
>      if (argument)
>      {
>        strmake(server_version, argument, sizeof(server_version) - 1);
>        set_sys_var_value_origin(&server_version_ptr, sys_var::CONFIG);
>      }
> +#ifndef EMBEDDED_LIBRARY
>      else
>      {
>        print_version();
>        opt_abort= 1;                    // Abort after parsing all options
>      }
> -    break;
>  #endif /*EMBEDDED_LIBRARY*/
> +    break;
>    case 'W':
>      if (!argument)
>        global_system_variables.log_warnings++;

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx
-- 
Vote for my Percona Live 2016 talks:
https://www.percona.com/live/data-performance-conference-2016/sessions/mariadb-connectors-fast-and-smart-new-protocol-optimizations#community-voting
https://www.percona.com/live/data-performance-conference-2016/sessions/mariadb-101-security-validation-authentication-encryption#community-voting


Follow ups