Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 452131 - net-snmp-perl is broken for 5.10, cannot set oids
Summary: net-snmp-perl is broken for 5.10, cannot set oids
Alias: None
Product: Fedora
Classification: Fedora
Component: net-snmp
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jan Safranek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-06-19 15:17 UTC by Jarrod Johnson
Modified: 2009-07-17 08:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-11-06 04:05:45 UTC

Attachments (Terms of Use)
Patch to net-snmp that worked for me. (deleted)
2008-06-23 14:15 UTC, Jarrod Johnson
no flags Details | Diff

Description Jarrod Johnson 2008-06-19 15:17:31 UTC
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 13:39:57 UTC
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 14:14:50 UTC
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/ line 617.

The path I have attached prevents that failure for me.

Comment 3 Jarrod Johnson 2008-06-23 14:15:45 UTC
Created attachment 310031 [details]
Patch to net-snmp that worked for me.

Comment 4 Thomas Anders 2008-06-24 16:43:09 UTC
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 10:46:53 UTC
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 10:51:21 UTC
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 11:32:18 UTC
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 12:48:59 UTC
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 07:57:51 UTC
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 09:34:52 UTC
net-snmp-5.4.1-19.fc9 has been submitted as an update for Fedora 9.

Comment 11 Fedora Update System 2008-11-06 04:05:40 UTC
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 21:29:31 UTC
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/ line 617.

Do you know if the patch made it all the way?

Comment 13 Jan Safranek 2009-07-17 08:23:08 UTC
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.