mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug #11754014: 45549: udf plugin_dir path separator inconsistency
and cryptic error 1126 message The problem was that dlopen() related code was using just a subset of the path normalization routines used in other places. Fixed the expansion of the pre-dlopen() behavior for plugins and UDFs to use a platform-dependent consistent encoding of the paths. Fixed the error dlopen() error handling to take the correct error message and strip off the trailing newline character(s). Fixed tests to do a platform independent replace of directories and to account for the traling slash.
This commit is contained in:
@@ -221,10 +221,15 @@ void udf_init()
|
||||
char dlpath[FN_REFLEN];
|
||||
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl,
|
||||
NullS);
|
||||
(void) unpack_filename(dlpath, dlpath);
|
||||
if (!(dl= dlopen(dlpath, RTLD_NOW)))
|
||||
{
|
||||
const char *errmsg;
|
||||
int error_number= dlopen_errno;
|
||||
DLERROR_GENERATE(errmsg, error_number);
|
||||
|
||||
/* Print warning to log */
|
||||
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, errno, dlerror());
|
||||
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, error_number, errmsg);
|
||||
/* Keep the udf in the hash so that we can remove it later */
|
||||
continue;
|
||||
}
|
||||
@@ -469,12 +474,18 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
{
|
||||
char dlpath[FN_REFLEN];
|
||||
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", udf->dl, NullS);
|
||||
(void) unpack_filename(dlpath, dlpath);
|
||||
|
||||
if (!(dl = dlopen(dlpath, RTLD_NOW)))
|
||||
{
|
||||
const char *errmsg;
|
||||
int error_number= dlopen_errno;
|
||||
DLERROR_GENERATE(errmsg, error_number);
|
||||
|
||||
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
|
||||
udf->dl, errno, dlerror()));
|
||||
udf->dl, error_number, errmsg));
|
||||
my_error(ER_CANT_OPEN_LIBRARY, MYF(0),
|
||||
udf->dl, errno, dlerror());
|
||||
udf->dl, error_number, errmsg);
|
||||
goto err;
|
||||
}
|
||||
new_dl=1;
|
||||
|
||||
Reference in New Issue
Block a user