Nicholas Marriott <nicholas.marri...@gmail.com> writes:

> I think it is correct and better to spawn login shells by default, these
> are not child shells of some shell process, they are entirely new
> shells.

I think we disagree here, they *are* children of some shell process,
(unless tmux is directly spawned as the user's login shell, of course).
When a user logs in, a login shell is spawned, which reads (for
bourne-like shells as ksh) /etc/profile and ~/.profile, if present.

Those files traditionally contain commands that only need to be launched
once, such as exporting environment variables, automatically launching
applications such as ssh-agent, expensive actions, etc.

Interactive shells, then, can benefit from the environment that has been
set up.  If an interactive shell needs more automatic configuration,
e.g. terminal-specific stuff, another dotfile can be used.  ksh has ENV,
bash uses ~/.bashrc.  This, imho, is much more flexible.

And it has been the way to do it since a long time.  I believe that the
behaviour of GNU screen matches that.

> There is already an option to change it, default-command. I don't see a
> problem spawning two shells,

The result being:

ksh -c 'ksh'

or

ksh -c 'exec ksh'

showing in ps(1) output.

In the first case, you have useless processes entries, which sucks.
There is a soft limit of 128 processes per user, in the OpenBSD default
login class, and this one is pretty easy to reach, especially with
current desktop environments.

In the second case, the first ksh instance is replaced, but you still
have exec'ed twice ksh.  Which imho is a hint that there is something
wrong.

> shells are running, started, exited all the
> time and fork is not expensive anymore. What exactly is the issue with
> this? Do you have any boxes where this is noticeably slower than one
> shell? How much?

The fewer commands you run when spawning a new tmux window, the faster
you get to the promt, especially is your box is loaded.  Yes, I only
have (ok, not so) slow machines, and I see a difference in use.  No,
I don't have *precise* numbers to show right now.

> If you can convince me it isn't a good idea and we need an option, I
> would suggest making some new prefix to default-shell like "+", so
> "+/bin/sh" doesn't run a login shell.

I don't want to convince you that we need an option to *disable*
spawning login shells, but that not spawning login shells should be the
default. Users that *want* tmux to spawn login shells can already use
the -l switch or set tmux as their login shell, my diff does take care
of not clobbering this feature, I think.

Regards.
--
Jérémie Courrèges-Anglas
GPG fingerprint: 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494

Reply via email to