On Mon, Mar 31, 2008 at 11:37 PM, Hisham <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 31, 2008 at 9:23 PM, Jonatan Liljedahl <[EMAIL PROTECTED]> wrote:
>  >  All I want is that login
>  >  shells should have the proper env vars set, regardless of whether the
>  >  shell is interactive (text prompt) or not.
>
>  It's fair. I too find it hard to imagine a shell running that didn't
>  have any (grand^n for n >= 0)-parent process that was a login shell.

Let me help your collective imagination ;-)

Say that you have login exec your x session directly instead of
starting a shell; no login shell is created.  Or you can go a step
earlier and have your getty exec an x session, or shell, instead of
calling login.  Again, no login shell.  Or you can go a step earlier
and have init start an xsession instead of gettys.  Or you could go
even earlier than that and have the kernel start an x session instead
of init (this would, um, be quite a poor idea.  But putting
"init=/bin/sh" on the kernel command line in grub will get you
straight to a (interactive, non-login) shell without anything else
happening -- very handy for machines that won't finish booting, or for
getting root if there's no bootloader password.)

And there are many ways to log in over a network without creating a login shell.

Of course, your proposed solution works fine anyway.

On Mon, Mar 31, 2008 at 8:23 PM, Jonatan Liljedahl <[EMAIL PROTECTED]> wrote:
> And how often do you use an interactive
>  non-login shell that is not started from another login shell, and need
>  the env variables? "Display manager straight into X" (without login) is
>  not something you would want, since the env variables wouldn't be there
>  and many things wouldn't work.

Well, this is only a problem if you have everything in zprofile.  If
your env variables don't depend on a login shell, then your shells
will still be properly set up.  But I've been assuming interactive zsh
here (That is, that it doesn't matter what the parent environment of
the X session is, since any shells you start within X will load
zshrc.)  I pretty much always run scripts from the shell, even in X,
so my zshrc settings are the parent of anything I do.

On the other hand, if you have a lot of scripts which are somehow run
from something other than a shell, I can see where the parent
environment would matter more to you.  In this case it would indeed be
nice to have a separate configuration file with only the
non-interactive stuff.

If you depend on having set stuff properly in some grand-nth-parent
login shell, though, there is opportunity for stuff to get clobbered
or messed with on the way down.  Lots of little programs and scripts
take it upon themselves to mess with the environment.

So if it were me, I suppose I'd
a) put the PATH and other environment stuff in zprofile, to make an
easy switch (-l) for noninteractive environment creation
b) have zshrc unconditionally clobber it anyway

Most people probably wouldn't want (b), though, so Hisham's proposal
is best for a default.

MJ Ray makes an interesting point:  Requiring PAM, and putting all
this in a pam.d/common-session sourced from pam.d/other, would really
be an ideal solution.  This could guarantee that all sessions
(interactive, noninteractive, login, nonlogin, zsh, bash, ssh,
whatever) would have the proper environment.

In fact, if it's possible to use Debian-style "configuration
directories" (where every package Foo which has some env-settings has
a file foo in, say, pamenv.d, and common-session sources pamenv.d/*)
then pam_env would work really well with the Links tree setup.

Each package would just put its environment stuff into
Settings/pamenv.d, they'd get linked in, and common-session would
include them; DisableProgram it, and it goes away.  You wouldn't even
need special Cache-handling, etc.

Nick
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to