From 1630087a23eeb35f9749a254a93ab80a65bbef96 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Fri, 6 Dec 2024 14:22:16 -0500 Subject: [PATCH] CONC-749 plugins.multiauth fails on mac If the dylib isn't found on linux, then dlerror() returns 'no such file' but on Mac it returns a lot more information. Our tests expect the string 'no such file', so detect that error on Mac and replace the text. --- libmariadb/ma_client_plugin.c.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libmariadb/ma_client_plugin.c.in b/libmariadb/ma_client_plugin.c.in index e5bb119eb..65a014dbf 100644 --- a/libmariadb/ma_client_plugin.c.in +++ b/libmariadb/ma_client_plugin.c.in @@ -352,6 +352,22 @@ mysql_client_register_plugin(MYSQL *mysql, } +#ifdef __APPLE__ +/* + If the dylib isn't found on linux, then dlerror() returns 'no such file' + but on Mac it returns a lot more information. Our tests expect the + 'no such file', so detect that error on Mac and replace the text. +*/ +static const char *normalize_no_such_file_err(const char *errmsg) +{ + static const char *fnf= "no such file"; + if (!strstr(errmsg, fnf)) + return errmsg; + return fnf; +} +#endif + + /* see for a full description */ struct st_mysql_client_plugin * STDCALL mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, @@ -421,6 +437,9 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, errmsg= errbuf; #else errmsg= dlerror(); +#ifdef __APPLE__ + errmsg= normalize_no_such_file_err(errmsg); +#endif #endif goto err; }