Comment

Comment by lloeki

The one thing I hate about tmux is that it leaks env vars across instances:

    # terminal 1, start a fresh first tmux session, which magically spawns a daemon with the same env
    $ env FOO=bar tmux
    
    # terminal 2, start another tmux session, which reuses the daemon's env
    $ tmux
    $ echo $FOO
    bar
Try the same with `screen` and you're safe.

This is especially annoying when you're using, say, direnv, and project-specific env vars appear magically on an unrelated subsequent session because your first `tmux` turned out to be from a direnv-enabled directory, which polluted the global environment, which in turn pollutes every subsequent session environment as long as a session (not necessarily the original one) is alive.

Replace FOO with SOME_SECRET/ACCESS_KEY/TOKEN and you can actually accidentally expose/leak stuff or point to the wrong thing.

The unattended workaround is to have the tmux daemon spawn at login via `start-server` + enable some tmux settings like `exit-empty` plus some I can't recall regarding environment handling, but nobody does that.

parent lloeki 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton