This turns out to be something pretty simple - we should not be
executing commands in a client context before that client has finished
identifying (that is, before we have the received the environment):

diff --git a/server.c b/server.c
index e9c2298..1fbaf37 100644
--- a/server.c
+++ b/server.c
@@ -196,8 +196,10 @@ server_loop(void)
 
        do {
                items = cmdq_next(NULL);
-               TAILQ_FOREACH(c, &clients, entry)
-                   items += cmdq_next(c);
+               TAILQ_FOREACH(c, &clients, entry) {
+                       if (c->flags & CLIENT_IDENTIFIED)
+                               items += cmdq_next(c);
+               }
        } while (items != 0);
 
        server_client_loop();




On Wed, Nov 09, 2016 at 12:36:47AM +0100, Frank Terbeck wrote:
> Hey list,
> 
> I recently upgraded tmux to its latest git master tip. I am starting my
> tmux server by using "tmux start-server" with my configuration file
> starting the server's initial session (a couple of shells, mostly).
> 
> After attaching, none of the shells have a DISPLAY environment variable
> set. "tmux show-environment -g" and "tmux show-environment" both have
> this variable set, and indeed, it *is* set in the process that spawns
> the start-server call.
> 
> So, I've taken a look at tmux's revision history. Bisecting isn't quite
> as easy as one might think, since you can only build commits on the
> master branch of the portable version of the program. But I still think
> I could narrow it down to a single change set:
> 
>     *   commit c67b7025882ee6bc2b3d5112dbc630c191f1fa2a
>     |\  Merge: 3d8efdf ddc4512
>     | | Author: Thomas Adam <[email protected]>
>     | | Date:   Sun Oct 16 20:01:10 2016 +0100
>     | |
>     | |     Merge branch 'obsd-master'
>     | |
>     | * commit ddc4512d2e0eda6c705e002cb5dbf80719d709e1
>     | | Author: nicm <nicm>
>     | | Date:   Sun Oct 16 17:55:14 2016 +0000
>     | |
>     | |     Rewrite command queue handling. [...]
>     | |
>     * |   commit 3d8efdf310f475a6b9ed83814182c966de2bdab3
>     |\    Merge: a15939b bfe14b5
>     | |   Author: Thomas Adam <[email protected]>
>     | |   Date:   Sun Oct 16 02:01:11 2016 +0100
>     | |
>     | |     Merge branch 'obsd-master'
> 
> Building c67b7025 shows the faulty behavior, while 3d8efdf31 is fine,
> which suggests that ddc4512d2e0 is the change set that introduces the
> breakage.
> 
> Here is my recipe for reproducing the issue: With a file "foobar"
> containing this: "new-session -d -s misc", I am doing this with each
> build:
> 
>   % echo $DISPLAY
>   :0
>   % git checkout c67b7025
>   % ./autogen.sh && ./configure && make
>   % ./tmux -f ~/foobar -L test start-server
>   % ./tmux -L test attach-session
>   [..in that session..]
>   % echo $DISPLAY
>   % exit
>   [..this closes the server, back to the parent shell..]
>   % git checkout 3d8efdf31
>   [..repeat recipe with this state..]
> 
> In the c67b7025 build's session, $DISPLAY is unset, while in the
> 3d8efdf31 build, it is set to ":0".
> 
> Unfortunately, ddc4512 is a rather substantial change set, which I've
> skimmed through, but I can't quite tell what in it might cause this. I
> am sure Nicholas or Thomas will have an easier time. :)
> 
> 
> Regards, Frank
> -- 
> In protocol design, perfection has been reached not when there is
> nothing left to add, but when there is nothing left to take away.
>                                                   -- RFC 1925
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send an email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to