Bug 249015 - [patch] net-mgmt/p5-SNMP_Session: fix validation for backoff
Summary: [patch] net-mgmt/p5-SNMP_Session: fix validation for backoff
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Sivachenko
URL:
Keywords: easy, patch-ready
Depends on:
Blocks:
 
Reported: 2020-08-30 16:15 UTC by Eugene Grosbein
Modified: 2020-08-30 19:45 UTC (History)
1 user (show)

See Also:
demon: maintainer-feedback+
demon: maintainer-feedback+


Attachments
patch for net-mgmt/p5-SNMP_Session (2.35 KB, patch)
2020-08-30 16:15 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2020-08-30 16:15:13 UTC
Created attachment 217653 [details]
patch for net-mgmt/p5-SNMP_Session

SNMP_Session perl module allows to change default timeout backoff and validates new value with its set_backoff() function. This function contains obvious copy-paste error from previous functions set_timeout()/set_retries() that deal with integer values. So, set_backoff() erroneously check the value to be integer but it should accept fractional numbers, too.

The patch attaches corrects the check eliminating int($backoff) call. New code compares new value with 1.0 just like old one but catches possible warning on argument being non-numeric (non-floating point) and rejects non-numeric allowing fractional numbers.

This change makes it possible to use the following within mrtg configuration file:

SnmpOptions: backoff => 1.1

This code seems to have no upstream maintainer and was not updated for years. So I suggest the patch for our ports tree.
Comment 1 Dmitry Sivachenko freebsd_committer freebsd_triage 2020-08-30 18:51:57 UTC
Looks fine, please commit.

Thanks!
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-08-30 19:44:49 UTC
A commit references this bug:

Author: eugen
Date: Sun Aug 30 19:44:11 UTC 2020
New revision: 547075
URL: https://svnweb.freebsd.org/changeset/ports/547075

Log:
  net-mgmt/p5-SNMP_Session: permit fractional timeout backoff values

  This perl module allows to change default timeout backoff and
  validates new value with its set_backoff() function.
  This function contains obvious copy-paste error from previous functions
  set_timeout()/set_retries() that deal with integer values.
  So, set_backoff() erroneously check the value to be integer
  but it should accept fractional numbers, too.

  This change corrects the check eliminating int($backoff) call.
  Corrected code compares new value with 1.0 just like old one
  but catches possible warning on argument being non-numeric
  (non-floating point) and rejects non-numeric allowing fractional numbers.

  The change makes it possible to use the following within
  mrtg configuration file:

  SnmpOptions: backoff => 1.1

  PR:		249015
  Approved by:	demon (maintainer)

Changes:
  head/net-mgmt/p5-SNMP_Session/Makefile
  head/net-mgmt/p5-SNMP_Session/files/patch-SNMP_Session.pm