Commit 4fa2747a authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-29582 post-review fixes

don't include my_progname in the error message, my_error starts from it
automatically, resulting in, like

/usr/bin/mysqladmin: Notice: /usr/bin/mysqladmin is deprecated and will be removed in a future release, use command 'mariadb-admin'

and remove "Notice" so that the problem description would directly
follow the executable name.

make the check to work when the executable is in the PATH
(so, invoked simply like 'mysql' and thus readlink cannot find it)

fix the check in mysql_install_db and mysql_secure_installation to not
print the warning if the intermediate path contains "mysql" substring

add this message also to
* mysql_waitpid
* mysql_convert_table_format
* mysql_find_rows
* mysql_setpermissions
* mysqlaccess
* mysqld_multi
* mysqld_safe
* mysqldumpslow
* mysqlhotcopy
* mysql_ldb

Closes #2273
parent b30b040b
......@@ -24,7 +24,6 @@
#include <errno.h>
static const char *VER= "1.1";
static char *progname;
static my_bool verbose;
void usage(void);
......@@ -50,7 +49,7 @@ get_one_option(const struct my_option *opt,
{
switch(opt->id) {
case 'V':
printf("%s version %s by Jani Tolonen\n", progname, VER);
printf("%s version %s by Jani Tolonen\n", my_progname, VER);
exit(0);
case 'I':
case '?':
......@@ -65,7 +64,7 @@ int main(int argc, char *argv[])
{
int pid= 0, t= 0, sig= 0;
progname= argv[0];
MY_INIT(argv[0]);
if (handle_options(&argc, &argv, my_long_options, get_one_option))
exit(-1);
......@@ -96,8 +95,8 @@ int main(int argc, char *argv[])
void usage(void)
{
printf("%s version %s by Jani Tolonen\n\n", progname, VER);
printf("usage: %s [options] #pid #time\n\n", progname);
printf("%s version %s by Jani Tolonen\n\n", my_progname, VER);
printf("usage: %s [options] #pid #time\n\n", my_progname);
printf("Description: Waits for a program, which program id is #pid, to\n");
printf("terminate within #time seconds. If the program terminates within\n");
printf("this time, or if the #pid no longer exists, value 0 is returned.\n");
......
......@@ -60,7 +60,7 @@ const char *globerrs[GLOBERRS]=
"Lock Pages in memory access rights required",
"Memcntl %s cmd %s error",
"Warning: Charset id '%d' csname '%s' trying to replace existing csname '%s'",
"Notice: %s is deprecated and will be removed in a future release, use command '%s'"
"Deprecated program name. It will be removed in a future release, use '%s' instead"
};
void init_glob_errs(void)
......
......@@ -43,6 +43,13 @@ static void setup_codepages();
#define _SC_PAGESIZE _SC_PAGE_SIZE
#endif
#if defined(__linux__)
#define EXE_LINKPATH "/proc/self/exe"
#elif defined(__FreeBSD__)
/* unfortunately, not mounted by default */
#define EXE_LINKPATH "/proc/curproc/file"
#endif
extern pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
#define SCALE_SEC 100
......@@ -174,12 +181,21 @@ my_bool my_init(void)
char link_name[FN_REFLEN];
my_progname_short= my_progname + dirname_length(my_progname);
/*
If its a link a different program that doesn't begin with mariadb
like mariadb-repair might link to mariadb-check.
if my_progname_short doesn't start from "mariadb", but it's
a symlink to an actual executable, that does - warn the user.
First try to find the actual name via /proc, but if it's unmounted
(which it usually is on FreeBSD) resort to my_progname
*/
if (strncmp(my_progname_short, "mariadb", 7)
&& my_readlink(link_name, my_progname, MYF(0)) == 0)
my_error(EE_NAME_DEPRECATED, MYF(MY_WME), my_progname, link_name);
if (strncmp(my_progname_short, "mariadb", 7))
{
int res= 1;
#ifdef EXE_LINKPATH
res= my_readlink(link_name, EXE_LINKPATH, MYF(0));
#endif
if ((res == 0 || my_readlink(link_name, my_progname, MYF(0)) == 0) &&
strncmp(link_name + dirname_length(link_name), "mariadb", 7) == 0)
my_error(EE_NAME_DEPRECATED, MYF(MY_WME), link_name);
}
}
/* Initialize our mutex handling */
......
......@@ -19,6 +19,9 @@
use DBI;
use Getopt::Long;
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-convert-table-format' instead\n"
if $0 =~ m/mysql_convert_table_format$/;
$opt_help=$opt_version=$opt_verbose=$opt_force=0;
$opt_user=$opt_database=$opt_password=undef;
$opt_host="localhost";
......
......@@ -18,6 +18,9 @@ $version="1.02";
use Getopt::Long;
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-find-rows' instead\n"
if $0 =~ m/mysql_find_rows$/;
$opt_help=$opt_Information=$opt_skip_use_db=0;
$opt_regexp=$opt_dbregexp=".*";
$opt_start_row=1; $opt_rows=9999999999;
......
......@@ -47,8 +47,8 @@ dirname0=`dirname $0 2>/dev/null`
dirname0=`dirname $dirname0 2>/dev/null`
case "$0" in
*mysql*)
echo "Notice: $0 is deprecated and will be removed in a future release, use command mariadb-install-db" 1>&2
*mysqld_install_db)
echo "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-install-db' instead" 1>&2
;;
esac
......
......@@ -30,8 +30,8 @@ defaults_extra_file=
no_defaults=
case "$0" in
*mysql*)
echo "Notice: $0 is deprecated and will be removed in a future release, use command mariadb-secure-installation" 1>&2
*mysql_secure_installation)
echo "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-secure-installation' instead" 1>&2
;;
esac
......
......@@ -55,6 +55,9 @@ use vars qw($dbh $sth $hostname $opt_user $opt_password $opt_help $opt_host
my $sqlhost = "";
my $user = "";
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-setpermission' instead\n"
if $0 =~ m/mysql_setpermission$/;
$dbh=$host=$opt_user= $opt_password= $opt_help= $opt_host= $opt_socket= "";
$opt_port=3306;
......
......@@ -32,6 +32,8 @@ BEGIN {
$script = 'MySQLAccess' unless $script;
$script_conf = "$script.conf";
$script_log = $ENV{'HOME'}."/$script.log";
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-access' instead\n"
if $0 =~ m/mysqlaccess$/;
# ****************************
# information on MariaDB
......
......@@ -50,6 +50,8 @@ $homedir = $ENV{HOME};
$my_progname = $0;
$my_progname =~ s/.*[\/]//;
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-multi' instead\n"
if $0 =~ m/mysqld_multi$/;
if (defined($ENV{UMASK})) {
my $UMASK = $ENV{UMASK};
......
......@@ -40,6 +40,12 @@ syslog_tag_mysqld_safe=mysqld_safe
trap '' 1 2 3 15 # we shouldn't let anyone kill us
case "$0" in
*mysqld_safe)
echo "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-safe' instead" 1>&2
;;
esac
# MySQL-specific environment variable. First off, it's not really a umask,
# it's the desired mode. Second, it follows umask(2), not umask(3) in that
# octal needs to be explicit. Our shell might be a proper sh without printf,
......
......@@ -26,6 +26,9 @@
use strict;
use Getopt::Long;
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-dumpslow' instead\n"
if $0 =~ m/mysqldumpslow$/;
# t=time, l=lock time, r=rows, a=rows affected
# at, al, ar and aa are the corresponding averages
......
......@@ -27,6 +27,9 @@ use Sys::Hostname;
use File::Copy;
use File::Temp qw(tempfile);
warn "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-hotcopy' instead\n"
if $0 =~ m/mysqlhotcopy$/;
=head1 NAME
mysqlhotcopy - fast on-line hot-backup utility for local MySQL databases and tables
......
......@@ -8,6 +8,7 @@
#include "rocksdb/ldb_tool.h"
int main(int argc, char **argv) {
MY_INIT(argv[0]);
rocksdb::Options db_options;
myrocks::Rdb_pk_comparator pk_comparator;
db_options.comparator = &pk_comparator;
......
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