Re: git: fcfa64801a4f - main - sh: Set PATH envvar after setting HOME in dotfile

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Tue, 26 Oct 2021 15:40:54 UTC
In message <57f6f877de121954935225fba9874a39b6b768c4.camel@freebsd.org>, 
Ian Le
pore writes:
> On Tue, 2021-10-26 at 14:50 +0000, Ka Ho Ng wrote:
> > The branch main has been updated by khng:
> > 
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=fcfa64801a4fe836ff481465ea068e791aa
> 4ce6a
> > 
> > commit fcfa64801a4fe836ff481465ea068e791aa4ce6a
> > Author:     Ka Ho Ng <khng@FreeBSD.org>
> > AuthorDate: 2021-10-26 14:48:57 +0000
> > Commit:     Ka Ho Ng <khng@FreeBSD.org>
> > CommitDate: 2021-10-26 14:50:09 +0000
> > 
> >     sh: Set PATH envvar after setting HOME in dotfile
> >     
> >     In single-user mode, all env vars are absent, so exptilde() would
> > not be
> >     able to expand ~ correctly.
> >     Place the lines setting PATH below HOME, so exptilde() would work
> > as
> >     expected.
> >     
> >     Sponsored by:   The FreeBSD Foundation
> >     MFC after:      3 days
> >     Reviewed by:    jilles, emaste
> >     Differential Revision:  https://reviews.freebsd.org/D27003
> > ---
> >  bin/sh/dot.profile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile
> > index fd0c43fdb927..e296a360bcc7 100644
> > --- a/bin/sh/dot.profile
> > +++ b/bin/sh/dot.profile
> > @@ -1,9 +1,9 @@
> >  # $FreeBSD$
> >  #
> > -
> > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bi
> > n
> > -export PATH
> >  HOME=/root
> >  export HOME
> > +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/
> > bin
> > +export PATH
> >  TERM=${TERM:-xterm}
> >  export TERM
> >  PAGER=less
>
> I've always been curious whether there's a reason we seem to favor
>
>   VAR=value
>   export VAR
>
> over the more compact form
>
>   export VAR=value

Older Bourne shells don't support export VAR=value. This gives the user 
greater flexibility to choose an older shell as their login shell.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

	The need of the many outweighs the greed of the few.