On 2019-11-26 14:56 -0600, Douglas R. Reno wrote:
> On 2019-11-26 14:39, Bruce Dubbs wrote:
> > On 11/26/19 1:27 PM, Xi Ruoyao wrote:
> > > On 2019-11-26 12:54 -0600, Bruce Dubbs wrote:
> > > > On 11/26/19 9:30 AM, Xi Ruoyao wrote:
> > > > 
> > > > > But on Arch (and some other distributions) non-login bash
> > > > > loads
> > > > > /etc/bash.bashrc before .bashrc.  The environments in
> > > > > bash.bashrc
> > > > > may
> > > > > pollute the LFS building environment.  For example, on Arch,
> > > > > our
> > > > > $PS1
> > > > > (set in .bash_profile, should be '\u:\w\$ ') would be
> > > > > overwritten
> > > > > (become `[\u@\h \W]\$ ').
> > > > 
> > > > With the exception of PS1, is there anything else in
> > > > /etc/bash.bashrc
> > > > that interferes with the lfs user's environment?  We could
> > > > easily
> > > > fix
> > > > the PS1 issue by adding
> > > > 
> > > > PS1='\u:\w\$ '
> > > > 
> > > > to our .bashrc.
> > > 
> > > On Arch Linux it also sets $PROMPT_COMMAND, and then sources
> > > /usr/share/bash_completion/bash_completion (!).
> > > 
> > > > We could also add a note for the user to check the contents of
> > > > /etc/bash.bashrc and, if needed, move it out of the way.
> > > > 
> > > > Also, I wonder if using
> > > > 
> > > > exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash --
> > > > rcfile
> > > > ~/.bashrc
> > > > 
> > > > would disable sourcing /etc/bash.bashrc.
> > > 
> > > No.  I tried that.
> > > 
> > > I found a solution with Google:
> > > 
> > > /home/lfs/.bash_profile:
> > > 
> > >      exec env -i ENV=$HOME/.bashrc \
> > >          HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash --posix
> > > 
> > > /home/lfs/.bashrc:
> > > 
> > >      set +o posix
> > >      set +h
> > >      umask 022
> > >      # .... (same as LFS book)
> > > 
> > > "--posix" will start POSIX mode and disable rc file
> > > loading.  Then we
> > > use "ENV=$HOME/.bashrc" to tell bash to load our .bashrc
> > > file.  At 
> > > last
> > > use "set +o posix" in .bashrc to exit POSIX mode.
> > 
> > That looks good.  I don't have a system that uses /etc/bash.bashrc
> > so
> > I can't test it.  If you say it works for you, I'll add it.

It works for me (at least on Arch).

> > --------
> > 
> > Also, I am running into an issue I haven't noticed before.  On my
> > existing system if I try to log in as user lfs with .bash_profile
> > set,
> > it automatically starts bash and then puts it into the background.
> > 
> > # su - lfs
> > [1]+  Stopped                 su - lfs
> > # jobs
> > [1]+  Stopped                 su - lfs
> > # fg
> > su - lfs
> > lfs:~$
> > 
> > The rules in the book work OK as .bash_profile is not present when
> > we
> > initially change to user lfs and then we source
> > .bash_profile.  That
> > works.
> > 
> > It could have something to do with PAM and su, but I'm not
> > sure.  Has
> > anyone else seen this?
> > 
> >   -- Bruce
> 
> Yes I have, it's happening on Debian 10 and on LFS now. I'm not sure 
> what's causing it

I've seen this on LFS.  Not sure the reason.
-- 
Xi Ruoyao <xry...@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to