Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#990215: tmux: Missleading error message if socket path has wrong permissions

548 views
Skip to first unread message

Uwe Kleine-König

unread,
Jun 23, 2021, 3:10:03 AM6/23/21
to
Package: tmux
Version: 2.8-3
Severity: normal
Tags: upstream patch

Hello,

Starting with a running tmux session that is attachable as expected:

uwe@taurus:~$ chmod o+x /tmp/tmux-$(id -u)
uwe@taurus:~$ tmux a
error creating /tmp/tmux-1000 (Permission denied)

This error message is misleading, as the directory exists just fine.

unstable and experimental are also affected.

To improve this, the following patch helps:

diff --git a/tmux.c b/tmux.c
index 5b73079ee7b3..f11e5dc56136 100644
--- a/tmux.c
+++ b/tmux.c
@@ -134,12 +134,12 @@ make_label(const char *label, char **cause)
if (lstat(resolved, &sb) != 0)
goto fail;
if (!S_ISDIR(sb.st_mode)) {
- errno = ENOTDIR;
- goto fail;
+ xasprintf(cause, "%s is not a directory", resolved);
+ return NULL;
}
if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {
- errno = EACCES;
- goto fail;
+ xasprintf(cause, "unsafe permissions for %s", resolved);
+ return NULL;
}
xasprintf(&path, "%s/%s", resolved, label);
return (path);

Best regards
Uwe

Romain Francoise

unread,
Jun 24, 2021, 3:00:03 PM6/24/21
to
Hi,

On Wed, Jun 23, 2021 at 8:57 AM Uwe Kleine-König <ukle...@debian.org> wrote:
> To improve this, the following patch helps: [...]

Thanks for the bug report and the patch. Can you contribute this
directly upstream? It's always a bit awkward for me to try and get
someone else's patch merged...

Uwe Kleine-König

unread,
Jul 7, 2021, 4:40:03 AM7/7/21
to
Control: tag -1 + fixed-upstream

Hello Romain,
I reworked the patch a bit and upstream committed something similar in
commit 32f2d9d089ce ("Improve error reporting when the tmux /tmp
directory cannot be created or used, GitHub issue 2765 from Uwe
Kleine-Koenig.")

So I'm marking as fixed-upstream.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
signature.asc
0 new messages