Bug 452131 - net-snmp-perl is broken for 5.10, cannot set oids
net-snmp-perl is broken for 5.10, cannot set oids
Product: Fedora
Classification: Fedora
Component: net-snmp (Show other bugs)
All Linux
low Severity urgent
: ---
: ---
Assigned To: Jan Safranek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-06-19 11:17 EDT by Jarrod Johnson
Modified: 2009-07-17 04:23 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-11-05 23:05:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to net-snmp that worked for me. (2.05 KB, patch)
2008-06-23 10:15 EDT, Jarrod Johnson
no flags Details | Diff

  None (edit)
Description Jarrod Johnson 2008-06-19 11:17:31 EDT
Description of problem:
Attempts to use the net-snmp-perl from perl to set oids leads to an assertion
being broken because the 'xs' cass svOK instead of svPOK as a check before
svCUR.  Will attach patch with fix example.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:
assertion fail causes it to kill the perl process.

Expected results:
It would work.

Additional info:
Comment 1 Jan Safranek 2008-06-23 09:39:57 EDT
From the description I cannot guess what's wrong. Could you please provide
detailed steps, how to reproduce the bug? I think simple perl code, resulting in
the assertion failure, will tell more than the description above. Thanks in advance.
Comment 2 Jarrod Johnson 2008-06-23 10:14:50 EDT
Sorry, hadn't attached fix, but to reproduce:

-You must have some equipment where you can attempt to set some OID.  Without
knowing about your test environment, I can't suggest a reasonable OID, but it
would be something like:
 $session = new SNMP::Session(
                    DestHost => $dst,
                    Version => '3',
                    SecName => $username,
                    AuthProto => 'SHA',
                    AuthPass => $password,
                    PrivProto => 'DES',
                    SecLevel => 'authPriv',
                    UseNumeric => 1,
                    Retries => 2, 
                    PrivPass => $password);

my $varbind = new SNMP::Varbind([$numericoidhere,0,1,'INTEGER']);
$data = $session->set($varbind);

The output of that is:
Assertion ((svtype)((_svi)->sv_flags & 0xff)) >= SVt_PV failed: file "SNMP.xs",
line 3070 at
/usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi/SNMP.pm line 617.

The path I have attached prevents that failure for me.
Comment 3 Jarrod Johnson 2008-06-23 10:15:45 EDT
Created attachment 310031 [details]
Patch to net-snmp that worked for me.
Comment 4 Thomas Anders 2008-06-24 12:43:09 EDT
At least in a different setup (Net-SNMP 5.4.2.pre2 with Perl 5.8.8 on i686) I
couldn't reproduce the failure. Do you also see this problem on x86 (32-bit)?
Comment 5 Jan Safranek 2008-06-25 06:46:53 EDT
F9 (perl 5.10.0) asserts with today's net-snmp SVN trunk (rev. 17096) both on
x86_64 and i386. It does not assert on F8 (perl 5.8.8) i386.
Comment 6 Jan Safranek 2008-06-25 06:51:21 EDT
The old & working perl 5.8.8 defines SvOK as
#define SvOK(sv)                (SvFLAGS(sv) & SVf_OK)

The new perl 5.10 defines it as 
#define SvOK(sv)                ((SvTYPE(sv) == SVt_BIND)               \
                                 ? (SvFLAGS(SvRV(sv)) & SVf_OK)         \
                                 : (SvFLAGS(sv) & SVf_OK))

Question is, why does it influence net-snmp.
Comment 7 Jan Safranek 2008-06-25 07:32:18 EDT
Anyway, the reporter complains that SvOK does not work while SvPOK works. IMHO
these two macros should behave consistently.
Comment 8 Marcela Mašláňová 2008-06-25 08:48:59 EDT
No, they don't behave the same way. First one returns 1, when there isn't undef
value, the second is checking pointer value. Also as was mentioned in perl bugzilla:

"SvCUR() is supposed to return the 'length of the string in the SV',
but when SvPOK() is not set, then there is no string in the SV, ..."

So the patch is correct fix and net-snmp should be fixed.
Comment 9 Jan Safranek 2008-07-22 03:57:51 EDT
Fixed in rawhide, ver. net-snmp-5.4.1-20. I'll release F9 update when more
bugfixes come.
Comment 10 Fedora Update System 2008-11-03 04:34:52 EST
net-snmp-5.4.1-19.fc9 has been submitted as an update for Fedora 9.
Comment 11 Fedora Update System 2008-11-05 23:05:40 EST
net-snmp-5.4.1-19.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Guillermo 2009-07-15 17:29:31 EDT
I am using F9 with net-snmp-5.4.1-19.fc9.i386 and perl-5.10.0-68.fc9.i386 and I am still getting the same error reported above on SNMP set:

Assertion ((svtype)((_svi)->sv_flags & 0xff)) >= SVt_PV failed: file "SNMP.xs", line 3070 at /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/SNMP.pm line 617.

Do you know if the patch made it all the way?
Comment 13 Jan Safranek 2009-07-17 04:23:08 EDT
Yes, the patch from comment #3 is in net-snmp-5.4.1-19. Maybe you see different error. Anyway, F9 is not supported anymore, try to reproduce it with newer Fedora.

Note You need to log in before you can comment on or make changes to this bug.