Date: Mon, 15 Feb 2021 00:20:31 +0300 From: Yuri Pankov <yuripv@yuripv.dev> To: freebsd-questions@freebsd.org Subject: Re: Upgrade to FreeBSD 12.2-RELEASE and OSTYPE environment variable Message-ID: <e757868a-f5ab-a3b3-741f-7d773b4f62da@yuripv.dev> In-Reply-To: <bffd0c77-247b-24e4-20e1-09914119f6c0@holgerdanske.com> References: <2159cb62-9845-6eca-fc5b-e796b5966536@holgerdanske.com> <7f129c5a9d23e0f99085243514306649@smokepit.net> <bffd0c77-247b-24e4-20e1-09914119f6c0@holgerdanske.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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> </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. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e757868a-f5ab-a3b3-741f-7d773b4f62da>
