Re: [Nagios-devel] Strange characters in output when

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Strange characters in output when

Post by Guest »

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

Hi List,

I've played a little bit with the actual cvs code and I can say:

1. Yes - it's a bug ;)
2. No - I don't have a patch
3. Yes - I think I've found the killer
4. No - I don't know what there's going on - but perhaps others can
explain.

My testing environment:

1. Edit the /bin/p1.pl on line
after line 294:

untie *STDOUT;

add:
print "PRIVATE DEBUG p1.pl says: $plugin_output\n";

or trust me when I say: in p1.pl the output is fine!

2. change base/checks.c around line 639 so that we have:

perl_plugin_output=POPpx;
printf("PRIVATE DEBUG: Nagios says after POPpx: %s\n",perl_plugin_output);
// Trust me Output is fine

pclose_result=POPi;
printf("PRIVATE DEBUG: Nagios says after POPi: %s\n",perl_plugin_output);
PUTBACK;
printf("PRIVATE DEBUG: Nagios says after PUTBACK: %s\n",perl_plugin_output);
FREETMPS;
printf("PRIVATE DEBUG: Nagios says after FREETMPS:
%s\n",perl_plugin_output);
LEAVE;
printf("PRIVATE DEBUG: Nagios says LEAVE: %s\n",perl_plugin_output);


My Output after compile and force a ePN Plugin Check:
PRIVATE DEBUG: p1.pl says: CRITICAL - Test down
PRIVATE DEBUG: Nagios says after POPpx: CRITICAL - Test down
PRIVATE DEBUG: Nagios says after POPi: CRITICAL - Test down
PRIVATE DEBUG: Nagios says after PUTBACK: CRITICAL - Test down
PRIVATE DEBUG: Nagios says after FREETMPS:
PRIVATE DEBUG: Nagios says LEAVE:

So.. there seem to be a problem with FREETMPS...

On http://perldoc.perl.org/perlcall.html there is the info:

###
The FREETMPS /LEAVE pair will get rid of any values returned by the
Perl subroutine (see next example), plus it will also dump the mortal
SVs we have created. Having ENTER /SAVETMPS at the beginning of the
code makes sure that no other mortals are destroyed.
###

I can imagine that the FREETMPS is destroying to much of the stack where
the var plugin_output lives... but this is only a thought.

Are there any Perl / C gurus out there who can explain this behavior?

Regards
Hendrik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGlmy/lI0PwfxLQjkRAj+oAJ9YNCXFoDI9/2fpxs8bFGWsA+3v2ACfRhVy
DKqMrGX6BMrkgyOj4RBBMac=
=Uyyt
-----END PGP SIGNATURE-----





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked