From: Jacob Bachmeyer Date: Thu, 6 Oct 2022 04:49:46 +0000 (-0500) Subject: Normalize argument unpacking in gatekeeper script X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0a7c2a6f8b6cc4230439ae7cb7431c7dee3906f8;p=gatekeeper.git Normalize argument unpacking in gatekeeper script This shifts arguments out of @_ one at a time in each sub and also removes a few cases of setting lists containing only one variable. --- diff --git a/gatekeeper.pl b/gatekeeper.pl index fb07c71..d7983ca 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -107,7 +107,8 @@ # sub ftp_syslog { - my ($priority,$message) = @_; + my $priority = shift; + my $message = shift; # Remove a trailing newline $message =~ s/[\r\n]+$//; @@ -391,7 +392,9 @@ for my $dir ($package_config_base, $incoming_dir, $incoming_tmp, # Return array of public key files for PACKAGE_NAME. # sub keyring_file { - my ($package_name,$directory) = (shift,shift); + my $package_name = shift; + my $directory = shift; + my @directory = split(/\//,$directory); my @pubrings = (); @@ -415,7 +418,7 @@ sub keyring_file { } sub email_addresses { - my ($package_name) = @_; + my $package_name = shift; my @ret; open (EMAIL_FILE, "<", "$package_config_base/$package_name/email") @@ -476,9 +479,9 @@ sub exclude_mail_blacklist { # Used for both success and failure. # sub mail { - my ($msg) = shift; - my ($send_to_user) = shift; - my ($subject) = shift; + my $msg = shift; + my $send_to_user = shift; + my $subject = shift; $subject ||= ''; my @email_list = ($email_always); @@ -602,11 +605,11 @@ sub debug { # The bad . files will eventually get cleaned up via a separate script. # sub fatal { - my ($tainted_msg) = shift; - my ($send_to_user) = shift; + my $tainted_msg = shift; + my $send_to_user = shift; # If we fail before we have sent a copy of the directive file contents to the maintainer # (when running in DEBUG mode), that copy is passed along, and we can send it from here. - my ($directive_file_contents) = shift; + my $directive_file_contents = shift; my $exit_code = shift; $directive_file_contents ||= ''; @@ -859,7 +862,9 @@ sub guess_uploader_email { # sub-most directory, until we find one that matches (or not!) # sub verify_keyring { - my ($directive_file, $directive_file_contents, @keyrings) = @_; + my $directive_file = shift; + my $directive_file_contents = shift; + my @keyrings = @_; my $directive_file_size = -s $directive_file; ftp_syslog('debug', "($log_style) DEBUG: $directive_file size is $directive_file_size") if DEBUG; @@ -913,9 +918,9 @@ sub verify_keyring { # other things, this lets us use gpgv everywhere, for paranoia's sake. # sub read_directive_file { - my ($directive_file) = shift; - my ($uploaded_file) = shift; - my ($directive_only) = shift; + my $directive_file = shift; + my $uploaded_file = shift; + my $directive_only = shift; # We default to v1.1 $info{'v1_compat_mode'} = 0; @@ -1207,7 +1212,9 @@ sub read_directive_file { } sub automake_tests { - my ($upload_file,$log_style,$debug) = @_; + my $upload_file = shift; + my $log_style = shift; + my $debug = shift; my $error_string = ''; my @debug_log; @@ -1270,7 +1277,9 @@ sub automake_tests { } sub check_vulnerabilities { - my ($upload_file,$log_style,$debug) = @_; + my $upload_file = shift; + my $log_style = shift; + my $debug = shift; my ($error_string, $error_log_ref) = automake_tests($upload_file,$log_style,$debug); @@ -1335,7 +1344,9 @@ sub check_files { # sub archive { - my ($dir, $subdir, $file) = @_; + my $dir = shift; + my $subdir = shift; + my $file = shift; # Abort if file to archive doesn't exist fatal("$subdir/$file does not exist - can not archive",1) if (!-e "$destfinal/$subdir/$file"); @@ -1489,7 +1500,9 @@ sub execute_commands { # Report success and unlink the directive file. # sub success_upload { - my ($sig_file,$upload_file,$directive_file) = @_; + my $sig_file = shift; + my $upload_file = shift; + my $directive_file = shift; mail ("upload of $upload_file and $sig_file complete",1); @@ -1497,7 +1510,7 @@ sub success_upload { } sub success_directive { - my ($directive_file) = shift; + my $directive_file = shift; mail ("processing of $directive_file complete",1); unlink ($directive_file) || ftp_warn("unlink($directive_file) failed: $!"); }