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

From: Ian Lepore <ian_at_freebsd.org>
Date: Tue, 26 Oct 2021 15:32:08 UTC
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=fcfa64801a4fe836ff481465ea068e791aa4ce6a
> 
> 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

-- Ian