Hey,

After upgrading OpenBSD 6.2 -> 6.3, a program I am building for $DAYJOB
started malfunctioning.

Basically, we use tmux to manage running sessions of this program, which
does automated work on things with console ports.

The session is started in a detached state with temp session name derived
from a date(1) stamp (date +%s) plus a few random digits:

$ tmux -S /var/someprog/default new-session -s tmp1234456789

After the program is running, a command is executed by the running
program to give it a proper session id, fetched from a database:

exec /usr/bin/tmux -S /var/someprog/default rename-session $SESSIONID

Tmux in OpenBSD 6.2 worked a-okay, tmux in 6.3 would return an error
indicating no current client.  This seems similar to here:

https://marc.info/?l=openbsd-cvs&m=152183263526828&w=2

I took a stab at fixing this in cmd-rename-session.c like was done
for cmd-rename-window.c, and the rebuilt tmux seems happy renaming
sessions from a program running within it again.

OK?  Flames? :-)

-ryan

Index: cmd-rename-session.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-rename-session.c,v
retrieving revision 1.27
diff -u -p -r1.27 cmd-rename-session.c
--- cmd-rename-session.c        1 Mar 2018 12:53:08 -0000       1.27
+++ cmd-rename-session.c        10 Apr 2018 23:21:52 -0000
@@ -47,7 +47,7 @@ static enum cmd_retval
 cmd_rename_session_exec(struct cmd *self, struct cmdq_item *item)
 {
        struct args             *args = self->args;
-       struct client           *c = cmd_find_client(item, NULL, 0);
+       struct client           *c = cmd_find_client(item, NULL, 1);
        struct session          *s = item->target.s;
        char                    *newname;

Reply via email to