#915401 perl_bulk_gets patch breaks some scripts

#915401#5
Date:
2018-12-03 14:44:44 UTC
From:
To:
I upgraded from Ubuntu 16.04 to 18.04, and suddenly one of my perl snmp
scripts
(https://github.com/alaskacommunications/nagios_check_keepalived/blob/master/check_keepalived_vrrp.pl)
started failing.
When switching back to SNMP v1 (which uses getnext instead of getbulk),
it gives the following errors:
Use of uninitialized value $stopcond in quotemeta at
/usr/lib/x86_64-linux-gnu/perl5/5.26/SNMP.pm line 884.
Use of uninitialized value $stopcond in quotemeta at
/usr/lib/x86_64-linux-gnu/perl5/5.26/SNMP.pm line 884.
Use of uninitialized value $stopcond in quotemeta at
/usr/lib/x86_64-linux-gnu/perl5/5.26/SNMP.pm line 884.
Use of uninitialized value $stopcond in quotemeta at
/usr/lib/x86_64-linux-gnu/perl5/5.26/SNMP.pm line 884.
Use of uninitialized value $stopcond in quotemeta at
/usr/lib/x86_64-linux-gnu/perl5/5.26/SNMP.pm line 884.

After digging in the changes between net-snmp in ubuntu 16.04 and 18.04,
I found out the following patch is the cause of this:
     * fix_perl_bulk_gets.diff: Fix handling of truncated bulk get responses
       in the Perl module. (Patch 1278 in upstream patch tracker.)

When I reverted this, everything started to work fine again :)

I tried fixing the patch, and the following makes everything start
working again, but still some undef warnings:
--- SNMP.pm.bak    2018-10-15 16:16:15.000000000 +0200
+++ SNMP.pm    2018-12-03 15:26:22.419130670 +0100
@@ -907,7 +907,7 @@
      my @newstopconds = ();
      my @newvarbinds = ();
      for (my $i = 0; $i < $num_stopconds; ++$i) {
-        unless ($found_eof[$i]) {
+        unless ($found_eof[$i] || !defined($state->{'stopconds'}[$i])) {
          push @newstopconds, $state->{'stopconds'}[$i];
          push @newvarbinds, $state->{'varbinds'}[$i];
          }


So it seems like somebody with some more knowledge will need to have a
look at this.

Thanks
Jean-Louis

#915401#10
Date:
2022-06-11 04:39:09 UTC
From:
To:
Hi,
  I've not seen anyone else hit this bug. I don't have any VRRP responders
here to check even when I use the same script. In addition, you are using
an Ubuntu system not Debian, so the bug report probably should go to them
anyhow.

Given all that, I'm closing this bug. Sorry its probably not the answer you
were looking for.

 - Craig