snmpc fails to compile BITS with "holes"

Per Hedeland <>
Mon Apr 19 16:12:04 CEST 2010


E.g. DOCS-CABLE-DEVICE-MIB:

docsDevEvReporting OBJECT-TYPE
        SYNTAX BITS {
            local(0),
            traps(1),
            syslog(2),
            -- The following are extensions to the original set of
            -- labels.  The extensions start at an octet boundary.
            -- So for bits 3 - 7, one MUST set them to zero on send
            -- and one MUST ignore them on receipt.
            localVolatile(8),
            stdInterface(9)
        }

results in

DOCS-CABLE-DEVICE-MIB.mib: 1192: Error: Expected kibble no 3 but got 8.

Trivial fix below (sorry, still no git).

--Per Hedeland

--- otp_src_R13B04/lib/snmp/src/compile/snmpc_lib.erl.orig      2009-11-20 09:48:28.000000000 +0100
+++ otp_src_R13B04/lib/snmp/src/compile/snmpc_lib.erl   2010-04-19 16:07:07.000000000 +0200
@@ -125,7 +125,8 @@
 
 test_kibbles2([],_,_) ->
     ok;
-test_kibbles2([{_KibbleName,BitNo}|Ks],BitNo,Line) ->
+test_kibbles2([{_KibbleName,BitNo}|Ks],ExpectBitNo,Line)
+  when BitNo >= ExpectBitNo ->
     test_kibbles2(Ks,BitNo+1,Line);
 test_kibbles2([{_KibbleName,BitNo}|_Ks],ExpectBitNo,Line) ->
     print_error("Expected kibble no ~p but got ~p.",[ExpectBitNo,BitNo],Line).


More information about the erlang-patches mailing list