1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

Revert "core: check "weechat" binary with command /upgrade"

This reverts commit d665e2d489.

The fix is not working when WeeChat is not executed with an absolute path.
This commit is contained in:
Sébastien Helleu
2025-01-07 17:36:39 +01:00
parent d302294723
commit 80ca209e70
2 changed files with 28 additions and 25 deletions
-1
View File
@@ -9,7 +9,6 @@
### Fixed
- core: always check that "weechat" binary exists and is executable with command `/upgrade`, even when the path to binary is not given
- relay: fix crash after `/upgrade` when relay clients are connected
- api: fix creation of empty buffer in function infolist_new_var_buffer
- core: fix detection of dl library ([#2218](https://github.com/weechat/weechat/issues/2218))
+28 -24
View File
@@ -7516,9 +7516,36 @@ COMMAND_CALLBACK(upgrade)
if (string_strcmp (argv[index_args], "-quit") == 0)
quit = 1;
else
{
ptr_binary = string_expand_home (argv_eol[index_args]);
if (ptr_binary)
{
/* check if weechat binary is here and executable by user */
rc = stat (ptr_binary, &stat_buf);
if ((rc != 0) || (!S_ISREG(stat_buf.st_mode)))
{
gui_chat_printf (NULL,
_("%sCan't upgrade: WeeChat binary \"%s\" "
"does not exist"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_binary);
free (ptr_binary);
return WEECHAT_RC_ERROR;
}
if ((!(stat_buf.st_mode & S_IXUSR)) && (!(stat_buf.st_mode & S_IXGRP))
&& (!(stat_buf.st_mode & S_IXOTH)))
{
gui_chat_printf (NULL,
_("%sCan't upgrade: WeeChat binary \"%s\" "
"does not have execute permissions"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_binary);
free (ptr_binary);
return WEECHAT_RC_ERROR;
}
}
}
}
if (!ptr_binary && !quit)
{
ptr_binary = (weechat_argv0) ? strdup (weechat_argv0) : NULL;
@@ -7542,29 +7569,6 @@ COMMAND_CALLBACK(upgrade)
if (ptr_binary)
{
/* check if weechat binary is here and executable by user */
rc = stat (ptr_binary, &stat_buf);
if ((rc != 0) || (!S_ISREG(stat_buf.st_mode)))
{
gui_chat_printf (NULL,
_("%sCan't upgrade: WeeChat binary \"%s\" "
"does not exist"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_binary);
free (ptr_binary);
return WEECHAT_RC_ERROR;
}
if ((!(stat_buf.st_mode & S_IXUSR)) && (!(stat_buf.st_mode & S_IXGRP))
&& (!(stat_buf.st_mode & S_IXOTH)))
{
gui_chat_printf (NULL,
_("%sCan't upgrade: WeeChat binary \"%s\" "
"does not have execute permissions"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_binary);
free (ptr_binary);
return WEECHAT_RC_ERROR;
}
gui_chat_printf (NULL,
_("Upgrading WeeChat with binary file: \"%s\"..."),
ptr_binary);