[net-snmp] properly fix failing tests on ppc/s390 Resolves: #655731

Jan Šafránek jsafrane at fedoraproject.org
Tue Nov 23 08:37:11 UTC 2010


commit 1111c4c79fec323d383913145f8b13c3ab3f19bb
Author: Jan Safranek <jsafrane at redhat.com>
Date:   Tue Nov 23 09:37:11 2010 +0100

    properly fix failing tests on ppc/s390
    Resolves: #655731

 net-snmp-5.6-big-end-oid.patch |   89 ++++++++++++++++++++++++++++++++++++++++
 net-snmp.spec                  |   12 +++---
 2 files changed, 95 insertions(+), 6 deletions(-)
---
diff --git a/net-snmp-5.6-big-end-oid.patch b/net-snmp-5.6-big-end-oid.patch
new file mode 100644
index 0000000..f192a37
--- /dev/null
+++ b/net-snmp-5.6-big-end-oid.patch
@@ -0,0 +1,89 @@
+Bug 655731 - T065agentextend_simple fails on s390x and ppc64
+
+commit c908aedcd9b05c031acc4807af03a42ded0f1af2
+Author: bvassche <bvassche at 06827809-a52a-0410-b366-d66718629ded>
+Date:   Sun Oct 17 16:57:38 2010 +0000
+
+    CHANGES: agent: table_helper_handler(), 64-bit architectures: avoid passing a pointer to a 32-bit value to a function that expects a pointer to a 64-bit value (parse_one_oid_index()). Not sure what the implications of this bug were. It might have caused very strange table behavior on 64-bit big endian systems.
+    Found this via Valgrind.
+    
+    
+    git-svn-id: https://net-snmp.svn.sourceforge.net/svnroot/net-snmp/trunk@19485 06827809-a52a-0410-b366-d66718629ded
+
+diff --git a/net-snmp/agent/helpers/table.c b/net-snmp/agent/helpers/table.c
+index c20c673..e82f872 100644
+--- a/net-snmp/agent/helpers/table.c
++++ b/net-snmp/agent/helpers/table.c
+@@ -172,7 +172,7 @@ table_helper_handler(netsnmp_mib_handler *handler,
+     int             oid_index_pos;
+     unsigned int    oid_column_pos;
+     unsigned int    tmp_idx;
+-    int 	    tmp_len;
++    ssize_t 	    tmp_len;
+     int             incomplete, out_of_range;
+     int             status = SNMP_ERR_NOERROR, need_processing = 0;
+     oid            *tmp_name;
+@@ -314,11 +314,11 @@ table_helper_handler(netsnmp_mib_handler *handler,
+          * length) 
+          */
+         if (reginfo->rootoid_len > var->name_length)
+-            tmp_len = (int)var->name_length;
++            tmp_len = var->name_length;
+         else
+-            tmp_len = (int)reginfo->rootoid_len;
++            tmp_len = reginfo->rootoid_len;
+         if (snmp_oid_compare(reginfo->rootoid, reginfo->rootoid_len,
+-                             var->name, (size_t)tmp_len) > 0) {
++                             var->name, tmp_len) > 0) {
+             if (reqinfo->mode == MODE_GETNEXT) {
+                 if (var->name != var->name_loc)
+                     SNMP_FREE(var->name);
+@@ -519,7 +519,7 @@ table_helper_handler(netsnmp_mib_handler *handler,
+             incomplete = 1;
+             tmp_len = -1;
+         } else
+-            tmp_len = (int)tbl_req_info->index_oid_len;
++            tmp_len = tbl_req_info->index_oid_len;
+ 
+ 
+         /*
+@@ -530,6 +530,8 @@ table_helper_handler(netsnmp_mib_handler *handler,
+         for (tmp_idx = 0, vb = tbl_req_info->indexes;
+              tmp_idx < tbl_info->number_indexes;
+              ++tmp_idx, vb = vb->next_variable) {
++            size_t parsed_oid_len;
++
+             if (incomplete && tmp_len) {
+                 /*
+                  * incomplete/illegal OID, set up dummy 0 to parse 
+@@ -545,23 +547,26 @@ table_helper_handler(netsnmp_mib_handler *handler,
+                  * Reject requests of the form 'myObject'   (no instance)
+                  */
+                 tmp_len = 0;
+-                tmp_name = (oid *) & tmp_len;
++                tmp_name = NULL;
+                 break;
+             }
+             /*
+              * try and parse current index 
+              */
+-            if (parse_one_oid_index(&tmp_name, (size_t*)&tmp_len,
++            netsnmp_assert(tmp_len >= 0);
++            parsed_oid_len = tmp_len;
++            if (parse_one_oid_index(&tmp_name, &parsed_oid_len,
+                                     vb, 1) != SNMPERR_SUCCESS) {
+                 incomplete = 1;
+                 tmp_len = -1;   /* is this necessary? Better safe than
+                                  * sorry */
+             } else {
++                tmp_len = parsed_oid_len;
++                DEBUGMSGTL(("helper:table", "  got 1 (incomplete=%d)\n",
++                            incomplete));
+                 /*
+                  * do not count incomplete indexes 
+                  */
+-                DEBUGMSGTL(("helper:table", "  got 1 (incomplete=%d)\n",
+-                            incomplete));
+                 if (incomplete)
+                     continue;
+                 ++tbl_req_info->number_indexes; /** got one ok */
diff --git a/net-snmp.spec b/net-snmp.spec
index 1b83ab1..1c4e981 100644
--- a/net-snmp.spec
+++ b/net-snmp.spec
@@ -11,7 +11,7 @@
 Summary: A collection of SNMP protocol tools and libraries
 Name: net-snmp
 Version: 5.6
-Release: 3%{?dist}
+Release: 4%{?dist}
 Epoch: 1
 
 License: BSD
@@ -34,6 +34,7 @@ Patch5: net-snmp-5.5-apsl-copying.patch
 Patch6: net-snmp-5.5-perl-linking.patch
 Patch7: net-snmp-5.6-test-debug.patch
 Patch8: net-snmp-5.6-cpp-includes.patch
+Patch9: net-snmp-5.6-big-end-oid.patch
 
 Requires(post): chkconfig
 Requires(preun): chkconfig
@@ -165,11 +166,7 @@ Net-SNMP toolkit library.
 %patch6 -p1 -b .perl-linking
 %patch7 -p1
 %patch8 -p2 -b .cpp-includes
-
-%ifarch ppc ppc64 s390 s390x
-# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=655731
-rm testing/fulltests/default/T065*
-%endif
+%patch9 -p1 -b .big-end-oid
 
 %build
 MIBS="host agentx smux \
@@ -427,6 +424,9 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_datadir}/snmp/mibs/*
 
 %changelog
+* Tue Nov 23 2010 Jan Safranek <jsafrane at redhat.com> - 1:5.6-4
+- properly fix failing tests on ppc/s390 (#655731)
+
 * Mon Nov 22 2010 Dan Horák <dan[at]danny.cz> - 1:5.6-3
 - temporarily disable a test failing on ppc/s390 arches
 


More information about the scm-commits mailing list