On 21 July 2012 20:39, Dylan Alex Simon <dylan-t...@dylex.net> wrote:
> I noticed (accidentally) that the check to prevent nesting tmux in the same
> server wasn't working.  I tracked this down to the fact that $TMUX is
> "/tmp//tmux-499/default,917,0" in my first session.  Note the double-slash,
> because _PATH_TMP is "/tmp/".
>
> The first time tmux is run, before the socket is created, the realpath call
> fails (ENOENT) and doesn't remove the //, but on subsequent invocations it
> works, removing it.  Thus, the nesting check doesn't realize it's the same
> server.  This would also be a problem if /tmp were a symlink.
>
> Here's a possible patch for this, which calls realpath on TMPDIR before adding
> the socket and removes trailing slashes, too.
>
> https://github.com/dylex/xtmux/commit/ebe8de387245b71fb745969d894d37fa5adb1b4b

Hmm -- trailing slashes aren't the problem here.  The problem is that
strcmp() is used to compare socket_path and environ_path and if one
has a double-slash in it, that'll skew the results.  I think instead,
it might be worthwhile not doing the strcmp() check, providing TMUX is
in the environment; most people unset TMUX anyway without caring about
its value.

-- Thomas Adam

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to