[Nagiosplug-devel] N::P bug in handling >2 repeated arguments from .ini config

Thomas Guyot-Sionnest dermoth at aei.ca
Fri Nov 16 17:39:43 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16/11/07 08:21 AM, Ton Voon wrote:
> On 16 Nov 2007, at 12:42, Thomas Guyot-Sionnest wrote:
> 
>>> I just added duplicate arguments support for a N::P plugin (=s@).  
>>> From
>>> command-line it works like a charm, but when using more than two
>>> repeated arguments in nagios-plugins.ini I get something like this:
>>>
>>> $VAR1 = [
>>>           'ARRAY(0x8545ee8)',
>>>           'string_from_last_argument'
>>>         ];
>>>
>>> I'm not sure if there is a reason for the particular syntax in
>>> lib/Nagios/Plugin/Config.pm but changing it to a simple push fixed  
>>> the
>>> problem. Since it's not much tested I'd like that someone review it
>>> before it goes in...
>> Ok, no comments yet and this is definitely broken. I'll commit this  
>> soon
>> is no one objects.
> 
> Does look like a bug. Have you got a testcase that fails?

It applies on 3 and more repeated arguments from the ini file:

$ ./check_stuff -D foo,bar,baz
CHECK_STUFF OK - Arguments: foo,bar,baz

$ ./check_stuff -D foo -D bar -D baz
CHECK_STUFF OK - Arguments: foo,bar,baz

$ ./check_stuff --extra-opts=check_stuff_test1
CHECK_STUFF OK - Arguments: foo,bar,baz

$ ./check_stuff --extra-opts=check_stuff_test2
CHECK_STUFF OK - Arguments: ARRAY(0x9fd210),baz

Just put the ini file in /etc and run the commands above. I attached the
patch as well.


Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHPcfO6dZ+Kt5BchYRAl3TAKCQegXJlxKC3FNi9GVHYSFLBIxNfwCeKd64
XTM39obQCq8nFry8Rl+JaLg=
=+82f
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check_stuff
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20071116/a2fcad16/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nagios-plugins.ini
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20071116/a2fcad16/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: N__P_read_string.patch
Type: text/x-diff
Size: 575 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20071116/a2fcad16/attachment.patch>


More information about the Devel mailing list