diff options
| author | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-11-19 20:38:02 +0000 |
|---|---|---|
| committer | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-11-19 20:38:02 +0000 |
| commit | 9fb39ced3de25669ae724d2dff61212d12d24976 (patch) | |
| tree | 7cb6cde2cd052b5afe59aba8ce4bf3548cb07fc8 | |
| parent | 6f05385c5d658a107cc5ff787436bffd9727f865 (diff) | |
| download | pki-9fb39ced3de25669ae724d2dff61212d12d24976.tar.gz pki-9fb39ced3de25669ae724d2dff61212d12d24976.tar.xz pki-9fb39ced3de25669ae724d2dff61212d12d24976.zip | |
Clean up Perl interpreter warnings
true is not keyword, use 1 instead
use defined() when testing for hash membership
add some variables to the $suppress which are defined
in pkicommon, but only used once in pkicreate/pkiremove
remove duplicate definition of $webapps_subsystem_instance_path
remove @pki_static_directories, it's never referenced.
$result = GetOptions() needs lexical scope for $result
fix misspelling of $PKI_FLAVOR, should be $PKI_FLAVOR_SLOT
fix misspelling of $SELINUX_PORT_WONGLY_DEFINED, should be $SELINUX_PORT_WRONGLY_DEFINED
change print (...) to print(...), space between function name and list
changes interpretation of list context vs. function call.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1543 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
| -rwxr-xr-x | pki/base/setup/pkicommon | 26 | ||||
| -rwxr-xr-x | pki/base/setup/pkicreate | 63 | ||||
| -rwxr-xr-x | pki/base/setup/pkiremove | 9 |
3 files changed, 44 insertions, 54 deletions
diff --git a/pki/base/setup/pkicommon b/pki/base/setup/pkicommon index bdff5e25..6b6512ab 100755 --- a/pki/base/setup/pkicommon +++ b/pki/base/setup/pkicommon @@ -63,7 +63,7 @@ if (($^O ne 'Windows_NT') && ($^O ne 'MSWin32')) { $> = $<; # set effective user ID to real UID $) = $(; # set effective group ID to real GID $ENV{'PATH'} = '/bin:/usr/bin'; - $ENV{'ENV'} = '' if $ENV{'ENV'} ne ''; + $ENV{'ENV'} = '' if !defined($ENV{'ENV'}); } @@ -301,18 +301,18 @@ $cleanup_basename = ".cleanup.dat"; %installation_info = (); # Table to validate an installation type -%valid_install_types = ('file' => true, - 'symlink' => true, - 'dir' => true); +%valid_install_types = ('file' => 1, + 'symlink' => 1, + 'dir' => 1); # Table to validate a install action -%valid_install_action = ('create' => true, - 'move' => true, - 'remove' => true); +%valid_install_action = ('create' => 1, + 'move' => 1, + 'remove' => 1); # Table to validate an uninstall action -%valid_uninstall_action = ('remove' => true, - 'preserve' => true); +%valid_uninstall_action = ('remove' => 1, + 'preserve' => 1); # Capture information about items modified during installation # @@ -663,7 +663,11 @@ sub uninstall # Primary sort by number of path components, longest first. # When the number of path components is the same the secondary sort # is lexical string comparision. - @dirs = sort {my $r = split("/", $b) <=> split("/", $a); $r == 0 ? $a cmp $b : $r} @filtered_paths; + @dirs = sort {my ($r, @a, @b); + @a = split("/", $a); + @b = split("/", $b); + $r = @b <=> @a; + $r == 0 ? $a cmp $b : $r} @filtered_paths; foreach $path (@dirs) { $result = 0 if !remove_directory($path, 1); @@ -2922,7 +2926,7 @@ sub remove_directory my($error, $path, $errstr); $result = 0; for $error (@$errors) { - $path, $errstr = %$error; + ($path, $errstr) = %$error; if ($path eq '') { emit("remove_directory(): tree=\"$dir\" ($errstr)\n", "error"); } diff --git a/pki/base/setup/pkicreate b/pki/base/setup/pkicreate index dbd7a2f6..9cd2270c 100755 --- a/pki/base/setup/pkicreate +++ b/pki/base/setup/pkicreate @@ -103,7 +103,7 @@ if (($^O ne 'Windows_NT') && ($^O ne 'MSWin32')) { $> = $<; # set effective user ID to real UID $) = $(; # set effective group ID to real GID $ENV{'PATH'} = '/bin:/usr/bin'; - $ENV{'ENV'} = '' if $ENV{'ENV'} ne ''; + $ENV{'ENV'} = '' if !defined($ENV{'ENV'}); } @@ -166,8 +166,9 @@ $suppress = $tmp_dir; $suppress = $default_security_libraries; $suppress = $default_system_libraries; $suppress = $lib_prefix; -$suppress = $default_system_user_binaries; - +$suppress = $PKI_USER; +$suppress = $PKI_GROUP; +$suppress = $install_info_basename; ############################################################## # Local Constants @@ -558,7 +559,6 @@ my $web_xml_instance_file_path = ""; # CA, KRA, OCSP, TKS my $web_xml_subsystem_file_path = ""; # CA, KRA, OCSP, TKS my $webapps_root_instance_path = ""; # CA, KRA, OCSP, TKS my $webapps_root_subsystem_path = ""; # CA, KRA, OCSP, TKS -my $webapps_subsystem_instance_path = ""; # CA, KRA, OCSP, TKS my $webinf_instance_path = ""; # CA, KRA, OCSP, TKS my $webinf_lib_instance_path = ""; # CA, KRA, OCSP, TKS my $webinf_subsystem_path = ""; # CA, KRA, OCSP, TKS @@ -611,27 +611,10 @@ if ($^O eq "linux") { # Linux registry $default_registry_path = "/etc/sysconfig"; - # Platform-specific directories - @pki_static_directories = ("temp", - "shared", - "shared/lib", - "shared/common", - "shared/lib", - "work", - "setup"); - # Superuser and group to give to PKI installed files $root_user = "root"; $root_group = "root"; } elsif ($^O eq "solaris") { - # Platform-specific directories - @pki_static_directories = ("temp", - "shared", - "shared/lib", - "shared/common", - "shared/lib", - "work"); - # Solaris init scripts $default_init_scripts_path = "/etc/init.d"; @@ -1057,23 +1040,23 @@ sub parse_arguments() my $l_admin_secure_port = -1; my $show_help = 0; - $result = GetOptions("help" => \$show_help, - "pki_instance_root=s" => \$pki_instance_root, - "pki_instance_name=s" => \$pki_instance_name, - "subsystem_type=s" => \$subsystem_type, - "secure_port:i" => \$l_secure_port, - "non_clientauth_secure_port:i" => \$l_non_clientauth_secure_port, - "unsecure_port:i" => \$l_unsecure_port, - "agent_secure_port:i" => \$l_agent_secure_port, - "ee_secure_port:i" => \$l_ee_secure_port, - "ee_secure_client_auth_port:i" => \$l_ee_secure_client_auth_port, - "admin_secure_port:i" => \$l_admin_secure_port, - "tomcat_server_port:i" => \$l_tomcat_server_port, - "user=s" => \$username, - "group=s" => \$groupname, - "verbose+" => \$verbose, - "dry_run" => \$dry_run, - "redirect=s" => \%redirects); + my $result = GetOptions("help" => \$show_help, + "pki_instance_root=s" => \$pki_instance_root, + "pki_instance_name=s" => \$pki_instance_name, + "subsystem_type=s" => \$subsystem_type, + "secure_port:i" => \$l_secure_port, + "non_clientauth_secure_port:i" => \$l_non_clientauth_secure_port, + "unsecure_port:i" => \$l_unsecure_port, + "agent_secure_port:i" => \$l_agent_secure_port, + "ee_secure_port:i" => \$l_ee_secure_port, + "ee_secure_client_auth_port:i" => \$l_ee_secure_client_auth_port, + "admin_secure_port:i" => \$l_admin_secure_port, + "tomcat_server_port:i" => \$l_tomcat_server_port, + "user=s" => \$username, + "group=s" => \$groupname, + "verbose+" => \$verbose, + "dry_run" => \$dry_run, + "redirect=s" => \%redirects); ## Optional "-help" option - no "mandatory" options are required @@ -2450,7 +2433,7 @@ sub process_pki_templates() $slot_hash{$TMP_DIR} = $tmp_dir; $slot_hash{$TPS_DIR} = $pki_subsystem_path; $slot_hash{$USERID} = $pki_user; - $slot_hash{$PKI_FLAVOR} = $pki_flavor; + $slot_hash{$PKI_FLAVOR_SLOT} = $pki_flavor; $slot_hash{$PKI_RANDOM_NUMBER_SLOT} = $random; $slot_hash{$REQUIRE_CFG_PL} = "require \"" . $cgi_sow_instance_cfg_pl_path @@ -3714,7 +3697,7 @@ sub check_selinux_port() if ($selinux_ports{$seport} eq $setype) { return $SELINUX_PORT_DEFINED; } else { - return $SELINUX_PORT_WONGLY_DEFINED; + return $SELINUX_PORT_WRONGLY_DEFINED; } } else { return $SELINUX_PORT_UNDEFINED; diff --git a/pki/base/setup/pkiremove b/pki/base/setup/pkiremove index 88873ff2..8857995d 100755 --- a/pki/base/setup/pkiremove +++ b/pki/base/setup/pkiremove @@ -74,7 +74,7 @@ if (($^O ne 'Windows_NT') && ($^O ne 'MSWin32')) { $> = $<; # set effective user ID to real UID $) = $(; # set effective group ID to real GID $ENV{'PATH'} = '/bin:/usr/bin'; - $ENV{'ENV'} = '' if $ENV{'ENV'} ne ''; + $ENV{'ENV'} = '' if !defined($ENV{'ENV'}); } @@ -128,6 +128,9 @@ if (! -e "$common_path/pkicommon") { eval("use lib '" . $common_path . "'"); require('pkicommon'); +# make -w happy by suppressing warnings of Global variables used only once +my $suppress = ""; +$suppress = $default_file_permissions; ############################################################## # Local Constants @@ -263,14 +266,14 @@ sub update_domain() (!defined($seceeport)) || (!defined($secagentport)) || (!defined($secadminport))) { - print (STDOUT "No security domain defined.\nIf this is an unconfigured instance, then that is OK.\n" . + print(STDOUT "No security domain defined.\nIf this is an unconfigured instance, then that is OK.\n" . "Otherwise, manually delete the entry from the security domain master.\n"); return; } if ($secselect ne "new") { # This is not a domain master, so we need to update the master - print (STDOUT "Contacting the security domain master to update the security domain\n"); + print(STDOUT "Contacting the security domain master to update the security domain\n"); my $listval = $typeval . "List"; my $urlheader = "https://" . $sechost . ":" . $seceeport; my $urlagentheader = "https://" . $sechost . ":" . $secagentport; |
