Hi Daogang,
Please also add a test case for this.
Dao-Gang.Qu@stripped write:
> #At file:///home/daogangqu/mysql/bzrwork/bug34739/mysql-5.1-bugteam/ based on
> revid:dao-gang.qu@stripped
>
> 3165 Dao-Gang.Qu@stripped 2009-10-29
> Bug #34739 unexpected binlog file name when --log-bin is set to a directory
> name
>
> If --log-bin is set to a directory name with the trailing 'FN_LIBCHAR',
> which will be '/' on Unix like systems, and '\\' on Windows like systems.
> the basename of the binlog is empty so that the created files named
> '.000001' and '.index'. It is not expected.
>
> To resolve the problem, the program should report an error and abort.
> @ sql/mysqld.cc
> Added a check for the value of the --log-bin argument, if it's
> a directory, reports an error and aborts.
>
> modified:
> sql/mysqld.cc
> === modified file 'sql/mysqld.cc'
> --- a/sql/mysqld.cc 2009-10-27 13:20:34 +0000
> +++ b/sql/mysqld.cc 2009-10-29 09:09:32 +0000
> @@ -3888,6 +3888,15 @@ server.");
>
> if (opt_bin_log)
> {
> + /* Reports an error and aborts, if the --log-bin's path
> + is a directory.*/
> + if (opt_bin_logname[strlen(opt_bin_logname) - 1] == FN_LIBCHAR)
> + {
> + sql_print_error("Path '%s' is a directory name, please specify \
> +a file name for --log-bin option", opt_bin_logname);
> + unireg_abort(1);
> + }
> +
> char buf[FN_REFLEN];
> const char *ln;
> ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);
>