Upgrade to FreeBSD 12.2-RELEASE and OSTYPE environment variable
Yuri Pankov
yuripv at yuripv.dev
Sun Feb 14 21:25:57 UTC 2021
David Christensen wrote:
> On 2021-02-14 07:08, Daniel Lysfjord wrote:
>> "David Christensen" skrev 14. februar 2021 kl. 04:59:
>>
>>> freebsd-questions:
>>>
>>> I am upgrading my FreeBSD 12.1-RELEASE machines to 12.2-RELEASE. The
>>> upgrade process seemed to go
>>> smoothly, but afterwards I noted that the OSTYPE environment variable
>>> still has the old value:
>>>
>>> 2021-02-13 19:56:02 toor at f1 ~
>>> # freebsd-version ; uname -a
>>> 12.2-RELEASE-p3
>>> FreeBSD f1.tracy.holgerdanske.com 12.2-RELEASE-p3 FreeBSD
>>> 12.2-RELEASE-p3 GENERIC amd64
>>>
>>> 2021-02-13 19:56:11 toor at f1 ~
>>> # env | grep -i freebsd
>>> OSTYPE=freebsd12.1
>>>
>>> Please advise.
>>>
>>> David
>
>> On one of my machines, the OSTYPE env is nowhere to be found, on
>> another machine it's just "FreeBSD". I've never set it to anything.
>> Both are running 12.2-P3
>
> I use FreeBSD via packages; I do not have source installed. My shell is
> bash(1).
>
> 2021-02-14 12:08:45 toor at f2 ~
> # bash --version | head -n 1
> GNU bash, version 5.1.4(0)-release (amd64-portbld-freebsd12.1)
>
>
> RTFM bash(1):
>
> OSTYPE Automatically set to a string that describes the operating
> system on which bash is executing. The default is system-
> dependent.
>
> /usr/local/share/doc/bash/CHANGES has more details:
>
> ...
> x. Bash no longer auto-exports HOSTNAME, HOSTTYPE, MACHTYPE, or OSTYPE,
> even if it assigns them default values.
> ...
> s. HOSTTYPE, OSTYPE, and MACHTYPE are set only if they do not have values
> when the shell is started.
>
>
> Searching my system, I do not see an assignment to OSTYPE:
>
> 2021-02-14 12:03:33 toor at f2 ~
> # find -x / -type f | xargs grep 'OSTYPE' | grep '=' | egrep -v
> '(!=|==|=>|=~)'
> /usr/local/share/doc/bash/bashref.html:<span id="index-OSTYPE"></span>
> /usr/local/share/doc/bash/bashref.html:<tr><td></td><td valign="top"><a
> href="#index-OSTYPE"><code>OSTYPE</code></a>:</td><td> </td><td
> valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
> /usr/local/lib/perl5/5.32/Perl/OSType.pm:my %OSTYPES = qw(
>
>
> But I do see:
>
> 2021-02-14 12:04:30 toor at f2 ~
> # grep OSTYPE `which bash`
> Binary file /usr/local/bin/bash matches
>
>
> So, the answer should be in the Bash source.
zsh has that too, however it's not visible in env output:
$ env | grep OSTYPE
$
However:
$ echo $OSTYPE
freebsd14.0
Also, in zsh case, it's set by configure in config.h, so it's showing
the system version it was built on:
$ grep OSTYPE work/zsh-5.8/config.h
#define OSTYPE "freebsd14.0"
Changing that to something else and reinstalling zsh:
$ echo $OSTYPE
freebsd20.0
More information about the freebsd-questions
mailing list