[TxMt] Making sub-shells login shells causes problems in the current beta

Chris Brierley thebrier at gmail.com
Tue Nov 2 18:20:05 UTC 2004


Allan, I know you made the change to call bash sub-shells with
'--login' in response to people's problems getting their PATHs set
straight, but I'd like to make an argument towards putting it back the
way it was.

Philosophically, it's just not how things are supposed to work with
bash.  The reason .bash_profile is only called on a login shell,
.bashrc is only called on an interactive non-login shell, and BASH_ENV
is consulted for non-interactive shells is so that you can separate
initialization code for these very different conditions.

Practically, since, by default, .bash_profile is only called on a
login shell, people use it to put initialization code that should only
be run when they log in ... knowing that that's the only time it will
run.  For example, people output stuff to the screen, they mess with
their stty settings to get their keyboard working correctly, etc. 
People don't typically protect any of that stuff in if statements so
that it only runs if there is a tty because ... there should always be
one in a login shell.

By changing TextMate to use a login shell, it now executes all that
cruft in the subshell.  Every time I run a command it now inserts into
the TextMate buffer all this extra stuff from my .bash_profile that
I've sent to the screen, and errors from my trying to run stty without
a tty.  To combat that, I'm going to have to go through my
.bash_profile and surround any of that kind of code with if statements
that test if there is a tty or not.

So, in trying to make things easier for people (not having to set
BASH_ENV in their enviroment) I think this is going to wind up making
it harder for people (having to escape code with if statements all
through their .bash_profile).  I would bet that you'll start to see a
lot of problems come in related to this.

What are your thoughts?  Any chance I can convince you to change your
mind on this?

Thanks much.



More information about the textmate mailing list