gnu.bash.bug
[Top] [All Lists]

Re: I can't get bash-3.2.17 to process startup/login scripts to save me,

Subject: Re: I can't get bash-3.2.17 to process startup/login scripts to save me, please help!
From: SciFi
Date: Thu, 9 Aug 2007 07:49:37 +0000 UTC
Newsgroups: gnu.bash.bug


Hi and thank you for taking time.

On Wed, 08 Aug 2007 21:33:44 -0600, Bob Proulx wrote:
> 
> SciFi wrote:
>> Got bash-3.2 patchlevel 17 running on MacOSX in place of Apple's:
> 
> Is this a self-compiled binary?

Yes, I do not use pkg-mgrs such as fink or macports, maybe only for
clues when a regular build bombs (straight from the tarballs).

I mentioned the ./configure options I used earlier in this thread,
wondering if there's a clue.


>> I'm unable to get it to run the (login) startup files at all in any
>> way-shape-form.  If the startup file was being executed, the PS1 prompt
>> should change as a very visible clue (among other things). ...
>>     0 12422   348   0  31  0    27576    668 -      Ss    p1    0:00.01
>>     login -pf scifi
>>   501 12423 12422   0  31  0    30932   1324 -      S     p1    0:00.01
>>   -bash
> 
> Seeing "-bash" there looks promising that bash is being started as a
> login shell.

Yes that's what I meant by Apple's /usr/bin/login seems to be doing
the right thing.  ;)

>> The /etc/bashrc has many things to do, all of which do work (no
>> noticable errors when actually sourced manually).  Plus /etc/bashrc
>> does set PS1 to another string so we'd instantly know if it'd been
>> executed.  I copied /etc/bashrc to /etc/bash.bashrc as an extra
>> precaution:
>> 
>> -bash-3.2$ ls -al /etc/*bash*
>> -rwxrwxrwx   1 root  wheel  1739 Aug  4 17:18 /etc/bash.bashrc
>> -rwxrwxrwx   1 root  wheel  1739 Aug  4 17:18 /etc/bashrc -rw-r--r--  
>> 1 root  wheel   329 Jul  3 11:40 /etc/bashrc_orig
> 
> But the login files sourced by bash are /etc/profile if that file
> exists.  After reading that file it looks for ~/.bash_profile,
> ~/.bash_login, and ~/.profile in that order and reads and executes the
> first one that is readable.  The above files that you show are not read
> by bash when it is a login shell.
> 
>> Any help would be appreciated.  I really need to use bash-3.2 while
>> working on the vast other open projects I'm keeping track of. Having to
>> manually source /etc/bashrc each & every time is becoming a massive
>> chore, enough that I go back to using Apple's bash-2.05b.
> 
> I think there is simply confusion over which files are read by login
> shells.  I think if you check you will find that bash invoked as a login
> shell will read /etc/profile and ~/.bash_profile okay.  Normally the
> ~/.bash_profile will 'source ~/.bashrc' so that it can be shared between
> both login shells and non-login shells.

When I say I've checked everything, that's what I mean.  ;)
I already have /etc/profile set up this way:

-bash-3.2$ ls -al /etc/profile
-rwxrwxrwx   1 root  wheel  162 Aug  4 16:46 /etc/profile
-bash-3.2$ cat /etc/profile
# System-wide .profile for sh(1)

#PATH="/bin:/sbin:/usr/bin:/usr/sbin"
#export PATH

if [ "x${BASH-no}" != "xno" ]; then
        [ -r /etc/bashrc ] && . /etc/bashrc
fi


-bash-3.2$ echo "x${BASH-no}"
x/bin/bash
-bash-3.2$ ls -al /etc/bashrc
-rwxrwxrwx   1 root  wheel  1739 Aug  4 17:18 /etc/bashrc

... so the /etc/bashrc _should_ end up being sourced,
every which-way I can think of to cover my @$$ all told,
but it is not being sourced ...

> Bob

btw when I say I replaced Apple's bash with this one, I simply do
mv /bin/bash /bin/bash_orig
and put symlinks
ln -s /usr/bin/bash /bin/bash
and do the same for /bin/sh (Apple originally uses a hardlink for sh).
So I can go back to Apple's bash-2.05b rather easily.
(yeah I know doing this on a 'running' Terminal is asking for
trouble, so ya gotta do the mv & ln quickly then exit and start a
new Terminal window)

I'll need to check the later bash-3.2 patches, as my G4 & G5 systems
were not running with the newest patches, and they _were_ working in
this regard (they are physically inaccessible ATM, long story...).

I need to use bash-3.2 for the usual reasons: fixes & features that
help other open projects build & work properly.  I really hope Apple
gets all such components caught-up with Leopard (I can't afford a
$pay-for$ ADC account to get & test Leopard officially, and I don't
trust the bittorrents floating around, was hoping some rich person
would 'mentor' an account for me, so I'm doing the next-best thing
by catching Tiger up to the latest versions of everything possible).

In meantime I am manually able to
. /etc/bashrc
every time I start a Terminal or xterm window, but doing this is
a real pain y'know...

Thanks again for any clues, this really has me stumped.





<Prev in Thread] Current Thread [Next in Thread>