Pro Tip: OSTYPE is set at compile time

A friend of mine keeps an OpenBSD box up so that we can use it for a shell if we need one (it’s come in handy on more than one occasion, let me tell you!). I was logged in the other day and wanted to add a package. My zsh startup files make it a rather simple process most of the time, partly because of the fact that I set the PKG_PATH variable dynamically. Part of that dynamic value is taken from the OSTYPE variable.

To make a long story short(er) I couldn’t add a package via pkg_add -i, and the reason was that OSTYPE was returning openbsd4.1 even though uname reported “OpenBSD isis.beyondnormal.net 4.2 GENERIC#375 i386”. The local mirror I use doesn’t keep packages around from old releases, so that was part of why this failed. So why was OSTYPE returning 4.1 even though it was OpenBSD 4.2? The answer is that OSTYPE is set at compile time.

Apparently, after upgrading the OS, the packages from OpenBSD 4.1 will work ok with OpenBSD 4.2 (at least in the case of zsh-4.2.6). All I needed to do to get OSTYPE to be correct was to uninstall the zsh package and install the package that was released with OpenBSD 4.2. Now let’s see if we remember when OpenBSD 4.3 is released…

Leave a comment

Your email address will not be published. Required fields are marked *