libsmi-based tools such as smilint failing to locate MIB modules

While working on my python-netsnmpagent project, I regularly smilint the MIBs used for conformance with the SMI spec to ensure they are proper MIBs.So far that never caused trouble but when I wanted to add the import of FLOAT from NET-SNMP-TC, I got a strange error message:

# smilint -l3 tests/TEST-MIB.txt
tests/TEST-MIB.txt:16: failed to locate MIB module `NET-SNMP-TC'

Strange because that MIB file cleary existed:

# ls -la /usr/share/snmp/mibs/NET-SNMP-TC.txt
-rw-r--r-- 1 root root 4814 Oct 23 14:18 /usr/share/snmp/mibs/NET-SNMP-TC.txt

Running strace on smilint revealed interesting news: it was looking for the MIB in directories below /usr/share/mibs instead of /usr/share/snmp/mibs! As it turns out, this is the default path for all libsmi-based tools and smilint is part of that package. They ship their own copy of a number of standard MIBs such as SNMPv2-TC in that directory, apparently these are bugfixed versions. This also explains why smilint didn’t complain so far — NET-SNMP-TC is simply the first MIB I encountered not to be included there.

Now two questions arise: first, why do we have to deal with two different sets of MIBs on our system? The answer is: no idea. There has been no libsmi release since 2008, so eventually package maintainers would have to step up and maybe agree to use the newer NET-SNMP versions.

Which leads to the second question: how do we get libsmi and thus smilint to also look at /usr/share/snmp/mibs? They have unfortunately no command line option for that, you need to create a configuration file, either ~/.smi.conf or /etc/smi.conf with the following contents:

path :/usr/share/snmp/mibs

Not sure if I should open a ticket with common distros to remedy this issue…