URGENT: #326 [NEW]: Optional service with --defaults-file=conf_file_path doesn"t works

URGENT: #326 [NEW]: Optional service with --defaults-file=conf_file_path doesn"t works

am 28.04.2003 05:16:59 von miguel solorzano

At 20:38 27/04/2003 +0300, Michael Widenius wrote:
Hi,



>Bug> doesn't start adequately due to use 3 parameters in argc.
>
>I tested this with MySQL 4.0 and didn't have any problems with the above.

Yes, sorry you are right, this problem only happens for 3.23.XX and
I explain it below.



>Bug> use_opt_args=3D1;
>Bug> ! opt_argc=3D2; /* for to exclude the service name */
>Bug> opt_argv=3Dargv;
>Bug> start_mode=3D 1;
>Bug> Service.Init(argv[2], mysql_service);
>
>Can you please explain in detail what the above patch does.

When this type of optional service is installed the service image
path is something like this:

c:\mysql\bin\mysqld --defaults-file=3Dc:\mysql\my.ini mysqldopt

the argument mysqldopt is used for to verify it is actually a valid
service and for to run the Service.Init(..) function.

using a my.ini file with:
[mysqld]
basedir=3Dc:/mysql
datadir=3Dc:/mysql/data
port=3D3307
skip-innodb
skip-bdb

Before to call:
load_defaults(MYSQL_CONFIG_NAME,load_default_groups,&argc,&a rgv);
we have:
argc == 3
optind == 1

and after:
argc == 7 // my.ini keys + argc - 1 of program_path
optind == 1

then get_options(argc,argv); is called with argc==7

when the below piece of code into get_options(..) is reached:

// Skipp empty arguments (from shell)
while (argc !=3D optind && !argv[optind][0])
optind++;
if (argc !=3D optind)
{
fprintf(stderr,"%s: Too many parameters\n",my_progname);
use_help();
exit(1);
}

argc == 7 and optind == 6, so exit(1) is performed and the
service exists with the message error:

The MyFoo service could not be started.
The MyFoo service is starting.

A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.

In another words mysqld has verified that the service name isn't
a valid option and aborted. Why 4.0.XX works ?, testing at the
command shell:

with 3.23.56:

c:\mysql\bin>mysqld-nt --defaults-file=3Dc:\mysql\my.ini myusied --console
mysqld-nt: Too many parameters
mysqld-nt Ver 3.23.56-nt for NT on i32
Use '--help' or '--no-defaults --help' for a list of available options

with 4.0.12:

c:\mysql\bin>mysqld-nt --defaults-file=3Dc:\mysql\my.ini myusied --console
mysqld-nt: ready for connections.
Version: '4.0.12-nt' socket: '' port: 3307

you see above that the invalid argument myusied was ignored. why ?
intentionally or a bug ?

How I am sure that when argv[2] is a service and all the options is
handled using only argc, so with argc=3D2 the service name is ignored.

>- When is the above code used ?
> (It's not used for
> mysqld --install-manual mysqldopt --defaults-file=3Dc:\path\my.ini
> as this is 4 arguments)

4 arguments is for install and is used 3 for the service start.

>- Why do you change argc but not argv ?
> (If you want to exclude the service name, you need to change argv too)

Because all the stuff is handled with argc and the service name is
just ignored :(.

>- When is opt_argc and opt_argv used and what are they supposed to
> contain ?

Please see above.

--=20
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Miguel Angel Sol=F3rzano
/ /|_/ / // /\ \/ /_/ / /__ S=E3o Paulo - Brazil
/_/ /_/\_, /___/\___\_\___/
<___/ www.mysql.com=20


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs@m.gmane.org

URGENT: #326 [NEW]: Optional service with --defaults-file=conf_file_path doesn"t works

am 26.05.2003 19:08:30 von Michael Widenius

Hi!

>>>>> "miguel" == miguel solorzano writes:

miguel> At 20:38 27/04/2003 +0300, Michael Widenius wrote:
miguel> Hi,

miguel>

Bug> doesn't start adequately due to use 3 parameters in argc.
>>
>> I tested this with MySQL 4.0 and didn't have any problems with the above.

miguel> Yes, sorry you are right, this problem only happens for 3.23.XX and
miguel> I explain it below.

It can now also happen in 4.0 after I added my last patch to
check for non option arguments to mysqld.

miguel>

Bug> use_opt_args=1;
Bug> ! opt_argc=2; /* for to exclude the service name */
Bug> opt_argv=argv;
Bug> start_mode= 1;
Bug> Service.Init(argv[2], mysql_service);

>> Can you please explain in detail what the above patch does.

Thanks for the clear explanation. I have now added the patch to 3.23

miguel> with 4.0.12:

miguel> c:\mysql\bin>mysqld-nt --defaults-file=c:\mysql\my.ini myusied --console
miguel> mysqld-nt: ready for connections.
miguel> Version: '4.0.12-nt' socket: '' port: 3307

miguel> you see above that the invalid argument myusied was ignored. why ?
miguel> intentionally or a bug ?

Bug, now fixed.

Thanks.

Regards,
Monty

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org