1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

Add API version string: do not load plugins with wrong API version (fix crash when loading old/obsolete plugins)

This commit is contained in:
Sebastien Helleu
2009-05-02 22:56:14 +02:00
parent 9cb6b4d158
commit 747b78aff3
10 changed files with 103 additions and 14 deletions
+8 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4889,6 +4889,13 @@ msgid "%sError: symbol \"%s\" not found in plugin \"%s\", failed to load"
msgstr ""
"%s symbol \"plugin_name\" nebyl v pluginu \"%s\" nalezen, načtení selhalo\n"
#, fuzzy, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%s symbol \"plugin_name\" nebyl v pluginu \"%s\" nalezen, načtení selhalo\n"
#, fuzzy, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+9 -1
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4841,6 +4841,14 @@ msgstr ""
"%s Symbol \"plugin_name\" in Plugin \"%s\" nicht gefunden, Laden "
"gescheitert\n"
#, fuzzy, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%s Symbol \"plugin_name\" in Plugin \"%s\" nicht gefunden, Laden "
"gescheitert\n"
#, fuzzy, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+9 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4829,6 +4829,14 @@ msgstr ""
"%s símbolo \"plugin_name\" no encontrado en el plugin \"%s\", falló al "
"cargar\n"
#, fuzzy, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%s símbolo \"plugin_name\" no encontrado en el plugin \"%s\", falló al "
"cargar\n"
#, fuzzy, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+10 -2
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"PO-Revision-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-05-02 22:44+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -5009,6 +5009,14 @@ msgstr ""
"%sErreur: le symbole \"%s\" n'existe pas dans l'extension \"%s\", échec de "
"chargement"
#, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%sErreur: API non concordante pour l'extension \"%s\" (API courante: \"%s\", "
"API extension: \"%s\"), échec de chargement"
#, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+9 -1
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4899,6 +4899,14 @@ msgstr ""
"%s a \"plugin_name\" szimbólum nem található a \"%s\" modulban, betöltés "
"sikertelen\n"
#, fuzzy, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%s a \"plugin_name\" szimbólum nem található a \"%s\" modulban, betöltés "
"sikertelen\n"
#, fuzzy, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+7 -1
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-04-29 08:07+0200\n"
"Last-Translator: <soltys@szluug.org>\n"
"Language-Team: Polish\n"
@@ -4222,6 +4222,12 @@ msgstr ""
msgid "%sError: symbol \"%s\" not found in plugin \"%s\", failed to load"
msgstr ""
#, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
#, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+8 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4874,6 +4874,13 @@ msgid "%sError: symbol \"%s\" not found in plugin \"%s\", failed to load"
msgstr ""
"%s символ \"plugin_name\" не найден в plugin'е \"%s\", загрузка не удалась\n"
#, fuzzy, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
"%s символ \"plugin_name\" не найден в plugin'е \"%s\", загрузка не удалась\n"
#, fuzzy, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+7 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-04-29 14:30+0200\n"
"POT-Creation-Date: 2009-05-02 22:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -4185,6 +4185,12 @@ msgstr ""
msgid "%sError: symbol \"%s\" not found in plugin \"%s\", failed to load"
msgstr ""
#, c-format
msgid ""
"%sError: API mismatch for plugin \"%s\" (current API: \"%s\", plugin API: \"%"
"s\"), failed to load"
msgstr ""
#, c-format
msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
+30 -3
View File
@@ -155,8 +155,8 @@ plugin_load (const char *filename)
{
char *ptr_home, *full_name, *full_name2;
void *handle;
char *name, *author, *description, *version, *weechat_version, *license;
char *charset;
char *name, *api_version, *author, *description, *version;
char *weechat_version, *license, *charset;
t_weechat_init_func *init_func;
int rc, i, argc;
char **argv;
@@ -206,6 +206,34 @@ plugin_load (const char *filename)
return NULL;
}
/* look for API version */
api_version = dlsym (handle, "weechat_plugin_api_version");
if (!api_version)
{
gui_chat_printf (NULL,
_("%sError: symbol \"%s\" not found in "
"plugin \"%s\", failed to load"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"weechat_plugin_api_version",
full_name);
dlclose (handle);
free (full_name);
return NULL;
}
if (strcmp (api_version, WEECHAT_PLUGIN_API_VERSION) != 0)
{
gui_chat_printf (NULL,
_("%sError: API mismatch for plugin \"%s\" (current "
"API: \"%s\", plugin API: \"%s\"), failed to load"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
full_name,
WEECHAT_PLUGIN_API_VERSION,
api_version);
dlclose (handle);
free (full_name);
return NULL;
}
/* check for plugin with same name */
if (plugin_search (name))
{
@@ -278,7 +306,6 @@ plugin_load (const char *filename)
free (full_name);
return NULL;
}
if (util_weechat_version_cmp (PACKAGE_VERSION, weechat_version) != 0)
{
gui_chat_printf (NULL,
+6 -2
View File
@@ -32,9 +32,13 @@ struct t_gui_completion;
struct t_infolist;
struct t_weelist;
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20090502-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
char weechat_plugin_name[] = __name;
#define WEECHAT_PLUGIN_NAME(__name) \
char weechat_plugin_name[] = __name; \
char weechat_plugin_api_version[] = WEECHAT_PLUGIN_API_VERSION;
#define WEECHAT_PLUGIN_AUTHOR(__author) \
char weechat_plugin_author[] = __author;
#define WEECHAT_PLUGIN_DESCRIPTION(__desc) \