Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Geir Hauge
On Sun, Dec 10, 2017 at 07:22:36PM -0800, Yuri wrote:
> It only calls ~/.profile when it is named 'sh'.

In posix mode, bash only looks for ~/.profile, but when you run it in
non-posix mode, it will look for ~/.bash_profile and ~/.bash_login
first. You probably have a ~/.bash_profile in addition to ~/.profile.

Assuming this is the case, I suggest you merge whatever it contains into
~/.profile, and remove the ~/.bash_profile file.

-- 
Geir Hauge



Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Yuri

On 12/10/17 13:51, Chet Ramey wrote:

You have not described a bug, since you have not demonstrated that bash is
behaving other than how it is documented, nor have you provided answers to
any of the questions you've been asked. You haven't even determined whether
or not bash is being invoked as a login shell at some unspecified point in
the mystery login sequence you're using.



bash never calls ~/.profile when invoked as a login shell:


cp ~/.profile ~/.profile.bak
echo 'echo "==> executing ~/.profile"' > ~/.profile
ln -s /usr/local/bin/bash /usr/local/bin/sh
/usr/local/bin/sh --login
==> executing ~/.profile
/usr/local/bin/bash --login


It only calls ~/.profile when it is named 'sh'.


Same happens when this executable is set to be user's login shell.

You should stop depending on sh being linked to bash. It should never examine 
its name, and act as a login shell with any name.


Yuri




Re: some problems with scope of fds in process substitution

2017-12-10 Thread Chet Ramey
On 12/4/17 10:19 AM, Stephane Chazelas wrote:

> One major differnce with ksh93 though is that it won't work with
> 
> cmd | tee >(cmd2)
> 
> unless you enable lastpipe.

Of course not: that's the whole point of lastpipe, and the major
difference there is broader than $! and process substitutions.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Chet Ramey
On 12/10/17 3:18 PM, Yuri wrote:
> On 12/09/17 14:14, Yuri wrote:
>> None of these files are executed when bash is a user's default shell on
>> FreeBSD.
>> No special options were selected. Despite shell.c saying that they should
>> be executed they just aren't.
> 
> 
> The bug is that bash doesn't handle login situation when it isn't linked to
> sh.
> 
> When I have bash as a user shell (/usr/local/bin/bash) and it isn't
> redirected to sh, it fails to read ~/.profile.
> 
> 
> Pleas fix this.

You have not described a bug, since you have not demonstrated that bash is
behaving other than how it is documented, nor have you provided answers to
any of the questions you've been asked. You haven't even determined whether
or not bash is being invoked as a login shell at some unspecified point in
the mystery login sequence you're using.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Yuri

On 12/09/17 14:14, Yuri wrote:
None of these files are executed when bash is a user's default shell 
on FreeBSD.
No special options were selected. Despite shell.c saying that they 
should be executed they just aren't.



The bug is that bash doesn't handle login situation when it isn't linked 
to sh.


When I have bash as a user shell (/usr/local/bin/bash) and it isn't 
redirected to sh, it fails to read ~/.profile.



Pleas fix this.


Yuri




Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Bob Proulx
Yuri wrote:
> Bob Proulx wrote:
> > How is the user logging in?  Are they logging in with 'ssh' over the
> > network?  Or are they logging in through an "xdm" X Display Manager
> > login from a graphical login display?
> 
> User logs in locally through the display manager.

Which graphical display manager?  There are many.  You not saying
means that we are not knowing.

Bob



Re: ~/.profile and ~/.bash_profile aren't executed on login

2017-12-10 Thread Chet Ramey
On 12/9/17 6:41 PM, Yuri wrote:
> On 12/09/17 15:24, Chet Ramey wrote:
>> Of course not: that's not a login shell.  As the documentation says,
>>
>> "A login shell is one whose first character of argument zero is a -,  or
>> one started with the --login option."
>>
>> The INVOCATION section of the manual page explains it in exhaustive detail.
> 
> 
> Ok, but that's not what my situation is. I am just logging in, using the
> display manager, when user has /usr/local/bin/bash as the shell in passwd.

Of course it's what your situation is. You're logging in, and you want
some shell in the sequence (you haven't said exactly which one) to be
started as a login shell and run the login shell startup files.

So if you think about it logically, here's how the startup sequence
probably goes: display manager authenticates the user, starts the user's
window manager, window manager starts up whatever apps its startup
config files specify, one of which is probably a terminal window.  It's
that shell (the one running in the terminal emulator) that determines
whether it's a login shell -- based on the criteria listed in the man
page -- and sources the appropriate startup files.

> Why doesn't it execute ~/.profile?

That's what you have to figure out.  You have to determine why the shell
that is started by the terminal emulator is not started as a login shell,
if that's what you want to have happen.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/