diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-12-19 22:49:12 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-02-10 10:45:25 +0100 |
commit | 4fa2747a63047dbd84cb6d1633024acf9c4313b5 (patch) | |
tree | 9d75d4b0993690be502f1120b11c4cb8daba002a /mysys | |
parent | b30b040b733ff2045ffcd7bdd44f608c7f4912b5 (diff) | |
download | mariadb-git-4fa2747a63047dbd84cb6d1633024acf9c4313b5.tar.gz |
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
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/errors.c | 2 | ||||
-rw-r--r-- | mysys/my_init.c | 26 |
2 files changed, 22 insertions, 6 deletions
diff --git a/mysys/errors.c b/mysys/errors.c index a7b2f1ae603..b522590ae7b 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -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) diff --git a/mysys/my_init.c b/mysys/my_init.c index 9ca68e80c1d..138b4697f97 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -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 */ |