Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 2021 12:39:58 -0800
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Upgrade to FreeBSD 12.2-RELEASE and OSTYPE environment variable
Message-ID:  <bffd0c77-247b-24e4-20e1-09914119f6c0@holgerdanske.com>
In-Reply-To: <7f129c5a9d23e0f99085243514306649@smokepit.net>
References:  <2159cb62-9845-6eca-fc5b-e796b5966536@holgerdanske.com> <7f129c5a9d23e0f99085243514306649@smokepit.net>

next in thread | previous in thread | raw e-mail | index | archive | help

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@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@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@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@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>&nbsp;</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@f2 ~
# grep OSTYPE `which bash`
Binary file /usr/local/bin/bash matches


So, the answer should be in the Bash source.


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bffd0c77-247b-24e4-20e1-09914119f6c0>