SublimeText 3 and FreeBSD, a tale of confusion!

I’ve recently been introduced to the world of linters, now that I’m on the road to becoming a programmer, and not just a pissed off sysadmin who courts voluntary alcoholism at every turn. Snazzy stuff, linters. Even snazzier that my default GUI editor, SublimeText (yes yes give me shit, get it all out), supports integration with various linters like shellcheck and puppet-lint!

Enter the problem: shellcheck works. puppet-lint doesn’t. The fuck?

So, if you run Sublime on FreeBSD, you know that since they haven’t released the source, it’s binary only and they only build for Windows, Linux, and OS X. Lucky for us BSD lovers, FreeBSD has a Linux ABI compatibility layer that allows for the running of a very large number of Linux binary applications. SublimeText is one of them. Now, this essentially means that the app sees a Linux environment, and in the case of Sublime, it’s the linux-c6 (CentOS 6) libs and dir structure. Still with me? Great. Now, when an application can’t find something it needs in /usr/compat/linux/, it calls out to the FreeBSD system at large to try and make ends meet. This is especially true for devices in /usr/compat/linux/dev/ which should normally be empty.

Guess what? it wasn’t. For some reason, SublimeLinter (or maybe it’s the plugin SublimeLinter uses to talk to puppet-lint) kept trying to dump data into /dev/null. Guess what? For some reason, there was an empty non-device file at /usr/compat/linux/dev/null. Removing it fixed the problem entirely.

TL;DR if you’re having a problem with SublimeLinter on FreeBSD and it’s screaming about how it can’t access /dev/null, check your Linux env.

Written on July 28, 2017