Hide Forgot
+++ This bug was initially created as a clone of Bug #678157 +++ Created attachment 479227 [details] use not operator to test for uninitialized or non empty value pkicreate, pkiremove and pkicommon.pm can sometimes emit a warning from Perl concerning an uninitialized variable. Previous patches (e.g. from the tomcat6 porting work) changed variable initialization from the empty string (e.g. "") to the special undef value (i.e. undefined) to catch errors and make the code more robust. We really want to know the difference between a variable which has never been assigned a value vs. a variable currently set to a string which happens to be empty. A number of places in the code were modified to use the defined() function to ascertain if a value had been assigned to the variable. Formerly many of the tests were of the form if $var eq "" But if $var was uninitialized this will produce a warning because you're comparing an uninitialized variable with a string constant. We do want the warning because using an uninitialized variable probably indicates a coding or logic error. In some cases we simply want to test if a variable has a non-empty value, i.e. its not undef and it's not the empty string. The simple and clean way to test this condition is with the ! (i.e. not) operator, e.g.: if !$var This evaluates to True if the variable is either uninitialized or if it's the empty string without emitting a warning about accessing an uninitialized variable. In many cases this is the logic we want. Attached is a patch which cleans up testing against the empty string and eliminates Perl warnings about such behaviour.
Created attachment 480019 [details] use not operator to test for uninitialized or non empty value
IPA_v2_RHEL_6_1_ERRATA_BRANCH: # cd pki # svn status | grep -v ^$ | grep -v ^P | grep -v ^X | grep -v ^? M base/setup/pkiremove M base/setup/pkicommon.pm M base/setup/pkicreate # svn commit Sending base/setup/pkicommon.pm Sending base/setup/pkicreate Sending base/setup/pkiremove Transmitting file data ... Committed revision 1860. Resolves #679173 - uninitialized variable warnings from Perl
Can you please add steps to verify this issue? thanks
Verified with: ipa-server-2.0.0-23.el6.x86_64 Ran the ipa-server-install test suite which installs with all options, and then uninstalls also. Marking this Verified.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2011-0627.html