diff --git a/scripts/cd2cd b/scripts/cd2cd index c297d5e0bd..182cb62c8a 100755 --- a/scripts/cd2cd +++ b/scripts/cd2cd @@ -89,7 +89,7 @@ sub single { my $salist = 0; my $copyright; my $spdx; - open(F, "<:crlf", "$f") || + open(F, "<:crlf", $f) || return 1; while() { $line++; diff --git a/scripts/cd2nroff b/scripts/cd2nroff index adc66216d7..8cf3eb775f 100755 --- a/scripts/cd2nroff +++ b/scripts/cd2nroff @@ -216,7 +216,7 @@ sub single { my $title; if(defined($f)) { - if(!open($fh, "<:crlf", "$f")) { + if(!open($fh, "<:crlf", $f)) { print STDERR "cd2nroff failed to open '$f' for reading: $!\n"; return 1; } diff --git a/scripts/cdall b/scripts/cdall index 5fd146d0b8..1ea0f42f25 100755 --- a/scripts/cdall +++ b/scripts/cdall @@ -35,7 +35,7 @@ sub convert { closedir $dh; for my $cd (@cd) { - my $nroff = "$cd"; + my $nroff = $cd; $nroff =~ s/\.md\z/.3/; print "$dir/$cd = $dir/$nroff\n"; system('./scripts/cd2nroff', ('-d', $dir, "$dir/$cd")); diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index 727a61c8bd..04b4793b41 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -412,7 +412,7 @@ readskiplist(); readlocalfile($file); do { - if("$wlist" !~ / $file /) { + if($wlist !~ / $file /) { my $fullname = $file; $fullname = "$dir/$file" if($fullname !~ '^\.?\.?/'); scanfile($fullname); diff --git a/scripts/delta b/scripts/delta index 2045f0f802..7b26092741 100755 --- a/scripts/delta +++ b/scripts/delta @@ -67,7 +67,7 @@ my $contribs = $acontribs - $bcontribs; # number of setops: sub setopts { my ($f)=@_; - open(H, "$f"); + open(H, $f); my $opts; while() { if(/^ CURLOPT(|DEPRECATED)\(/ && ($_ !~ /OBSOLETE/)) { diff --git a/scripts/mdlinkcheck b/scripts/mdlinkcheck index 835a02d497..4569b764d7 100755 --- a/scripts/mdlinkcheck +++ b/scripts/mdlinkcheck @@ -154,7 +154,7 @@ sub storelink { sub findlinks { my ($f) = @_; my $line = 1; - open(F, "<:crlf", "$f") || + open(F, "<:crlf", $f) || return; # is it a markdown extension? diff --git a/scripts/mk-ca-bundle.pl b/scripts/mk-ca-bundle.pl index 5f10d67f4b..c2baaf1195 100755 --- a/scripts/mk-ca-bundle.pl +++ b/scripts/mk-ca-bundle.pl @@ -166,7 +166,7 @@ sub HELP_MESSAGE() { print "\t-b\tbackup an existing version of ca-bundle.crt\n"; print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n"; print "\t\t Valid names are:\n"; - print "\t\t ", join(", ", map { ($_ =~ m/$opt_d/) ? "$_ (default)" : "$_" } sort keys %urls), "\n"; + print "\t\t ", join(", ", map { ($_ =~ m/$opt_d/) ? "$_ (default)" : $_ } sort keys %urls), "\n"; print "\t-f\tforce rebuild even if certdata.txt is current\n"; print "\t-i\tprint version info about used modules\n"; print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n"; @@ -478,7 +478,7 @@ my @precert; my $cka_value; my $valid = 0; -open(TXT,"$txt") or die "Could not open $txt: $!\n"; +open(TXT, $txt) or die "Could not open $txt: $!\n"; while() { if(/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) { print CRT; diff --git a/scripts/nroff2cd b/scripts/nroff2cd index b0308b6ef0..51b6974b8d 100755 --- a/scripts/nroff2cd +++ b/scripts/nroff2cd @@ -43,7 +43,7 @@ my $nroff2cd = "0.1"; # to keep check sub single { my ($f)=@_; - open(F, "<:crlf", "$f") || + open(F, "<:crlf", $f) || return 1; my $line; my $title; @@ -67,7 +67,7 @@ sub single { # remove leading directory $f =~ s/(.*?\/)//; close(F); - open(F, "<:crlf", "$f") || return 1; + open(F, "<:crlf", $f) || return 1; } if($d =~ /^\.TH ([^ ]*) (\d) \"(.*?)\" ([^ \n]*)/) { # header, this needs to be the first thing after leading comments diff --git a/tests/devtest.pl b/tests/devtest.pl index 46adb6136a..ed99589074 100755 --- a/tests/devtest.pl +++ b/tests/devtest.pl @@ -78,7 +78,7 @@ sub logmsg { # use \r\n for WSL shell $line =~ s/\r?\n$/\r\n/g; } - print "$line"; + print $line; } } diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index cfb65913d2..a3553c7983 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -789,7 +789,7 @@ sub EHLO_smtp { for my $am (@auth_mechs) { if(!$mechs) { - $mechs = "$am"; + $mechs = $am; } else { $mechs .= " $am"; @@ -940,7 +940,7 @@ sub DATA_smtp { logmsg "Store test number $testno in $filename\n"; - open(my $file, ">", "$filename") || + open(my $file, ">", $filename) || return 0; # failed to open output my $line; @@ -1290,7 +1290,7 @@ sub APPEND_imap { logmsg "Store test number $testno in $filename\n"; - open(my $file, ">", "$filename") || + open(my $file, ">", $filename) || return 0; # failed to open output my $received = 0; @@ -1709,7 +1709,7 @@ sub CAPA_pop3 { for my $am (@auth_mechs) { if(!$mechs) { - $mechs = "$am"; + $mechs = $am; } else { $mechs .= " $am"; @@ -2399,7 +2399,7 @@ sub STOR_ftp { sendcontrol "125 Gimme gimme gimme!\r\n"; - open(my $file, ">", "$filename") || + open(my $file, ">", $filename) || return 0; # failed to open output my $line; @@ -2795,7 +2795,7 @@ sub nodataconn_str { $str = 'NODATACONN425' if($nodataconn425); $str = 'NODATACONN421' if($nodataconn421); $str = 'NODATACONN150' if($nodataconn150); - return "$str"; + return $str; } #********************************************************************** @@ -3085,7 +3085,7 @@ if($proto eq 'ftp') { $srvrname = servername_str($proto, $ipvnum, $idnum); $serverlogs_lockfile = "$logdir/$LOCKDIR/${srvrname}.lock"; -$idstr = "$idnum" if($idnum > 1); +$idstr = $idnum if($idnum > 1); protocolsetup($proto); @@ -3097,7 +3097,7 @@ startsf(); # actual port if($portfile && !$port) { my $aport; - open(my $p, "<", "$portfile"); + open(my $p, "<", $portfile); $aport = <$p>; close($p); $port = 0 + $aport; @@ -3105,7 +3105,7 @@ if($portfile && !$port) { logmsg sprintf("%s server listens on port IPv${ipvnum}/${port}\n", uc($proto)); -open(my $pid, ">", "$pidfile"); +open(my $pid, ">", $pidfile); print $pid $$."\n"; close($pid); diff --git a/tests/getpart.pm b/tests/getpart.pm index 2aa5aed2e3..3329b13a34 100644 --- a/tests/getpart.pm +++ b/tests/getpart.pm @@ -230,7 +230,7 @@ sub loadtest { undef @xml; $xmlfile = ""; - if(open(my $xmlh, "<", "$file")) { + if(open(my $xmlh, "<", $file)) { if($original) { binmode $xmlh, ':crlf'; } @@ -311,7 +311,7 @@ sub checktest { sub savetest { my ($file)=@_; - if(open(my $xmlh, ">", "$file")) { + if(open(my $xmlh, ">", $file)) { binmode $xmlh; # for crapage systems, use binary for(@xml) { print $xmlh $_; @@ -407,7 +407,7 @@ sub compareparts { sub writearray { my ($filename, $arrayref)=@_; - open(my $temp, ">", "$filename") || die "Failure writing file"; + open(my $temp, ">", $filename) || die "Failure writing file"; binmode($temp,":raw"); # Cygwin fix for(@$arrayref) { print $temp $_; @@ -422,7 +422,7 @@ sub loadarray { my ($filename)=@_; my @array; - if(open(my $temp, "<", "$filename")) { + if(open(my $temp, "<", $filename)) { while(<$temp>) { push @array, $_; } diff --git a/tests/memanalyzer.pm b/tests/memanalyzer.pm index e9a847c8cf..2a395da2e0 100644 --- a/tests/memanalyzer.pm +++ b/tests/memanalyzer.pm @@ -68,7 +68,7 @@ sub memanalyze { $memsum = 0; # the total number of memory allocated over the lifetime $maxmem = 0; # the high water mark - open(my $fileh, "<", "$file") or return (); + open(my $fileh, "<", $file) or return (); if($showlimit) { while(<$fileh>) { diff --git a/tests/processhelp.pm b/tests/processhelp.pm index 299bce0d8a..ee5fc52d6d 100644 --- a/tests/processhelp.pm +++ b/tests/processhelp.pm @@ -86,7 +86,7 @@ sub pidfromfile { my $waits = 0; # wait at max 15 seconds for the file to exist and have valid content while(!$pid && ($waits <= ($timeout_sec * 10))) { - if(-f $pidfile && -s $pidfile && open(my $pidfh, "<", "$pidfile")) { + if(-f $pidfile && -s $pidfile && open(my $pidfh, "<", $pidfile)) { $pid = 0 + <$pidfh>; close($pidfh); $pid = 0 if($pid < 0); @@ -137,7 +137,7 @@ sub pidexists { my $filter = "PID eq $pid"; # https://ss64.com/nt/tasklist.html my $result = `tasklist -fi \"$filter\" 2>$dev_null`; - if(index($result, "$pid") != -1) { + if(index($result, $pid) != -1) { return -$pid; } } @@ -478,7 +478,7 @@ sub set_advisor_read_lock { my ($filename) = @_; my $fileh; - if(open($fileh, ">", "$filename") && close($fileh)) { + if(open($fileh, ">", $filename) && close($fileh)) { return; } printf "Error creating lock file $filename error: $!\n"; diff --git a/tests/runner.pm b/tests/runner.pm index 94ddc77a8f..2ecaba8ef4 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -263,7 +263,7 @@ sub event_loop { # sub checktestcmd { my ($cmd)=@_; - my @testpaths=($LIBDIR . ".libs", "$LIBDIR"); + my @testpaths=($LIBDIR . ".libs", $LIBDIR); return checkcmd($cmd, @testpaths); } @@ -647,7 +647,7 @@ sub singletest_preprocess { @entiretest = prepro($testnum, @entiretest); # save the new version - open(my $fulltesth, ">", "$otest") || die "Failure writing test file"; + open(my $fulltesth, ">", $otest) || die "Failure writing test file"; foreach my $bytes (@entiretest) { print $fulltesth pack('a*', $bytes) or die "Failed to print '$bytes': $!"; } @@ -671,7 +671,7 @@ sub singletest_setenv { if($content =~ /^=(.*)/) { # assign it $content = $1; - $ENV{$var} = "$content"; + $ENV{$var} = $content; logmsg "setenv $var = $content\n" if($verbose); } else { @@ -775,7 +775,7 @@ sub singletest_prepare { mkdir $d; # 0777 } } - if(open(my $outfile, ">", "$filename")) { + if(open(my $outfile, ">", $filename)) { binmode $outfile; # for crapage systems, use binary if($fileattr{'nonewline'}) { @@ -845,14 +845,14 @@ sub singletest_run { my $fail_due_event_based = $run_event_based; if($cmdtype eq "perl") { # run the command line prepended with "perl" - $cmdargs ="$cmd"; + $cmdargs =$cmd; $CMDLINE = "$perl "; $tool=$CMDLINE; $disablevalgrind=1; } elsif($cmdtype eq "shell") { # run the command line prepended with "/bin/sh" - $cmdargs ="$cmd"; + $cmdargs =$cmd; $CMDLINE = "/bin/sh "; $tool=$CMDLINE; $disablevalgrind=1; @@ -1048,7 +1048,7 @@ sub singletest_run { } else { # Convert the raw result code into a more useful one - ($cmdres, $dumped_core) = normalize_cmdres(runclient("$CMDLINE")); + ($cmdres, $dumped_core) = normalize_cmdres(runclient($CMDLINE)); } # restore contents @@ -1152,7 +1152,7 @@ sub singletest_postcheck { chomp $cmd; if($cmd) { logmsg "postcheck $cmd\n" if($verbose); - my $rc = runclient("$cmd"); + my $rc = runclient($cmd); # Must run the postcheck command in torture mode in order # to clean up, but the result cannot be relied upon. if($rc != 0 && !$torture) { diff --git a/tests/runtests.pl b/tests/runtests.pl index 2a180bfeb4..d5e43a6427 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -206,7 +206,7 @@ sub logmsg { # use \r\n for WSL shell $line =~ s/\r?\n$/\r\n/g; } - print "$line"; + print $line; } } @@ -359,7 +359,7 @@ sub cleardir { # Do not clear the $PIDDIR or $LOCKDIR since those need to live beyond # one test if(($file !~ /^(\.|\.\.)\z/) && - "$file" ne $PIDDIR && "$file" ne $LOCKDIR) { + $file ne $PIDDIR && $file ne $LOCKDIR) { if(-d "$dir/$file") { if(!cleardir("$dir/$file")) { $done = 0; @@ -370,7 +370,7 @@ sub cleardir { } else { # Ignore stunnel since we cannot do anything about its locks - if(!unlink("$dir/$file") && "$file" !~ /_stunnel\.log$/) { + if(!unlink("$dir/$file") && $file !~ /_stunnel\.log$/) { $done = 0; } } @@ -389,7 +389,7 @@ sub showdiff { my $file1="$logdir/check-generated"; my $file2="$logdir/check-expected"; - open(my $temp, ">", "$file1") || die "Failure writing diff file"; + open(my $temp, ">", $file1) || die "Failure writing diff file"; for(@$firstref) { my $l = $_; $l =~ s/\r/[CR]/g; @@ -400,7 +400,7 @@ sub showdiff { } close($temp) || die "Failure writing diff file"; - open($temp, ">", "$file2") || die "Failure writing diff file"; + open($temp, ">", $file2) || die "Failure writing diff file"; for(@$secondref) { my $l = $_; $l =~ s/\r/[CR]/g; @@ -530,7 +530,7 @@ sub checksystemfeatures { $ENV{'SOURCE_DATE_EPOCH'} = $current_time; $DATE = strftime "%Y-%m-%d", gmtime($current_time); - open(my $versout, "<", "$curlverout"); + open(my $versout, "<", $curlverout); @version = <$versout>; close($versout); @@ -771,9 +771,9 @@ sub checksystemfeatures { logmsg sprintf("command exited with value %d \n", $versretval >> 8); } logmsg "contents of $curlverout: \n"; - displaylogcontent("$curlverout"); + displaylogcontent($curlverout); logmsg "contents of $curlvererr: \n"; - displaylogcontent("$curlvererr"); + displaylogcontent($curlvererr); die "Could not get curl's version"; } @@ -1260,7 +1260,7 @@ sub singletest_check { my $loadfile = $hash{'loadfile'}; if($loadfile) { - open(my $tmp, "<", "$loadfile") || die "Cannot open file $loadfile: $!"; + open(my $tmp, "<", $loadfile) || die "Cannot open file $loadfile: $!"; @validstdout = <$tmp>; close($tmp); @@ -1856,7 +1856,7 @@ sub singletest_check { } if($valgrind) { if($usedvalgrind) { - if(!opendir(DIR, "$logdir")) { + if(!opendir(DIR, $logdir)) { logmsg "ERROR: unable to read $logdir\n"; # timestamp test result verification end $timevrfyend{$testnum} = Time::HiRes::time(); @@ -2674,7 +2674,7 @@ if($valgrind) { if(($? >> 8)) { $valgrind_tool=""; } - open(my $curlh, "<", "$CURL"); + open(my $curlh, "<", $CURL); my $l = <$curlh>; if($l =~ /^\#\!/) { # A shell script. This is typically when built with libtool, @@ -2700,7 +2700,7 @@ if($valgrind) { if($gdbthis) { # open the executable curl and read the first 4 bytes of it - open(my $check, "<", "$CURL"); + open(my $check, "<", $CURL); my $c; sysread $check, $c, 4; close($check); @@ -2779,7 +2779,7 @@ sub disabledtests { my ($file) = @_; my @input; - if(open(my $disabledh, "<", "$file")) { + if(open(my $disabledh, "<", $file)) { while(<$disabledh>) { if(/^ *\#/) { # allow comments @@ -2885,7 +2885,7 @@ if($scrambleorder) { # and excessively long files are elided sub displaylogcontent { my ($file)=@_; - if(open(my $single, "<", "$file")) { + if(open(my $single, "<", $file)) { my $linecount = 0; my $truncate; my @tail; @@ -2924,7 +2924,7 @@ sub displaylogcontent { sub displaylogs { my ($runnerid, $testnum)=@_; my $logdir = getrunnerlogdir($runnerid); - opendir(DIR, "$logdir") || + opendir(DIR, $logdir) || die "cannot open dir: $!"; my @logs = readdir(DIR); closedir(DIR); diff --git a/tests/secureserver.pl b/tests/secureserver.pl index 4df9ce8cbb..9cd963261f 100755 --- a/tests/secureserver.pl +++ b/tests/secureserver.pl @@ -211,7 +211,7 @@ my $host_ip = ($ipvnum == 6) ? '::1' : '127.0.0.1'; # Find out version info for the given stunnel binary # foreach my $veropt (('-version', '-V')) { - foreach my $verstr (qx("$stunnel" $veropt 2>&1)) { + foreach my $verstr (qx($stunnel $veropt 2>&1)) { if($verstr =~ /^stunnel (\d+)\.(\d+) on /) { $ver_major = $1; $ver_minor = $2; @@ -225,7 +225,7 @@ foreach my $veropt (('-version', '-V')) { last if($ver_major); } if((!$ver_major) || !defined($ver_minor)) { - if(-x "$stunnel" && ! -d "$stunnel") { + if(-x $stunnel && ! -d $stunnel) { print "$ssltext Unknown stunnel version\n"; } else { @@ -302,7 +302,7 @@ if($stunnel_version >= 400) { $SIG{INT} = \&exit_signal_handler; $SIG{TERM} = \&exit_signal_handler; # stunnel configuration file - if(open(my $stunconf, ">", "$conffile")) { + if(open(my $stunconf, ">", $conffile)) { print $stunconf "cert = $certfile\n"; print $stunconf "debug = $loglevel\n"; print $stunconf "socket = $socketopt\n"; @@ -337,7 +337,7 @@ if($stunnel_version >= 400) { print uc($proto) ." server (stunnel $ver_major.$ver_minor)\n"; print "cmd: $cmd\n"; print "stunnel config at $conffile:\n"; - open (my $writtenconf, '<', "$conffile") or die "$ssltext could not open the config file after writing\n"; + open (my $writtenconf, '<', $conffile) or die "$ssltext could not open the config file after writing\n"; print <$writtenconf>; print "\n"; close ($writtenconf); @@ -355,7 +355,7 @@ print STDERR "RUN: $cmd\n" if($verbose); # if($tstunnel_windows) { # Fake pidfile for tstunnel on Windows. - if(open(my $out, ">", "$pidfile")) { + if(open(my $out, ">", $pidfile)) { print $out $$ . "\n"; close($out); } diff --git a/tests/serverhelp.pm b/tests/serverhelp.pm index 272e0386cf..3f345ad74a 100644 --- a/tests/serverhelp.pm +++ b/tests/serverhelp.pm @@ -83,7 +83,7 @@ sub logmsg { # we see warnings on Windows run that $logfile is used uninitialized # TODO: not found yet where this comes from $logfile = "serverhelp_uninitialized.log" if(!$logfile); - if(open(my $logfilefh, ">>", "$logfile")) { + if(open(my $logfilefh, ">>", $logfile)) { print $logfilefh $now; print $logfilefh @_; close($logfilefh); @@ -165,7 +165,7 @@ sub servername_canon { sub server_pidfilename { my ($piddir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.pid'; - return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -174,7 +174,7 @@ sub server_pidfilename { sub server_portfilename { my ($piddir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.port'; - return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -184,7 +184,7 @@ sub server_logfilename { my ($logdir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.log'; $trailer = '_stunnel.log' if(lc($proto) =~ /^(ftp|http|imap|pop3|smtp)s$/); - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -193,7 +193,7 @@ sub server_logfilename { sub server_cmdfilename { my ($logdir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.cmd'; - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -202,7 +202,7 @@ sub server_cmdfilename { sub server_inputfilename { my ($logdir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.input'; - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -211,7 +211,7 @@ sub server_inputfilename { sub server_outputfilename { my ($logdir, $proto, $ipver, $idnum) = @_; my $trailer = '_server.output'; - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -248,7 +248,7 @@ sub mainsockf_pidfilename { die "unsupported protocol: '$proto'" unless($proto && (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/)); my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid' : '_sockfilt.pid'; - return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -259,7 +259,7 @@ sub mainsockf_logfilename { die "unsupported protocol: '$proto'" unless($proto && (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/)); my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log' : '_sockfilt.log'; - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -270,7 +270,7 @@ sub datasockf_pidfilename { die "unsupported protocol: '$proto'" unless($proto && (lc($proto) =~ /^ftps?$/)); my $trailer = '_sockdata.pid'; - return "${piddir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${piddir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** @@ -281,7 +281,7 @@ sub datasockf_logfilename { die "unsupported protocol: '$proto'" unless($proto && (lc($proto) =~ /^ftps?$/)); my $trailer = '_sockdata.log'; - return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) . $trailer; } #*************************************************************************** diff --git a/tests/servers.pm b/tests/servers.pm index 7fee69a536..8c183a5366 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -360,7 +360,7 @@ sub startnew { # Ugly hack but ssh client and gnutls-serv do not support pid files if($fakepidfile) { - if(open(my $out, ">", "$pidfile")) { + if(open(my $out, ">", $pidfile)) { print $out $child . "\n"; close($out) || die "Failure writing pidfile"; logmsg "startnew: $pidfile faked with pid=$child\n" if($verbose); @@ -560,7 +560,7 @@ sub verifyhttp { if($res && $verbose) { logmsg "RUN: curl command returned $res\n"; - if(open(my $file, "<", "$verifylog")) { + if(open(my $file, "<", $verifylog)) { while(my $string = <$file>) { logmsg "RUN: $string" if($string !~ /^([ \t]*)$/); } @@ -569,7 +569,7 @@ sub verifyhttp { } my $data; - if(open(my $file, "<", "$verifyout")) { + if(open(my $file, "<", $verifyout)) { while(my $string = <$file>) { $data = $string; last; # only want first line @@ -703,7 +703,7 @@ sub verifyrtsp { if($res && $verbose) { logmsg "RUN: curl command returned $res\n"; - if(open(my $file, "<", "$verifylog")) { + if(open(my $file, "<", $verifylog)) { while(my $string = <$file>) { logmsg "RUN: $string" if($string !~ /^[ \t]*$/); } @@ -712,7 +712,7 @@ sub verifyrtsp { } my $data; - if(open(my $file, "<", "$verifyout")) { + if(open(my $file, "<", $verifyout)) { while(my $string = <$file>) { $data = $string; last; # only want first line @@ -777,7 +777,7 @@ sub verifysftp { my $cmd = "\"$sftp\" -b $LOGDIR/$PIDDIR/$sftpcmds -F $LOGDIR/$PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1"; my $res = runclient($cmd); # Search for pwd command response in log file - if(open(my $sftplogfile, "<", "$sftplog")) { + if(open(my $sftplogfile, "<", $sftplog)) { while(<$sftplogfile>) { if(/^Remote working directory: /) { $verified = 1; @@ -836,7 +836,7 @@ sub verifyhttptls { if($res && $verbose) { logmsg "RUN: curl command returned $res\n"; - if(open(my $file, "<", "$verifylog")) { + if(open(my $file, "<", $verifylog)) { while(my $string = <$file>) { logmsg "RUN: $string" if($string !~ /^([ \t]*)$/); } @@ -845,7 +845,7 @@ sub verifyhttptls { } my $data; - if(open(my $file, "<", "$verifyout")) { + if(open(my $file, "<", $verifyout)) { while(my $string = <$file>) { $data .= $string; } @@ -1103,7 +1103,7 @@ sub runhttpserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1137,7 +1137,7 @@ sub runhttpserver { if($httppid <= 0 || !pidexists($httppid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1147,7 +1147,7 @@ sub runhttpserver { $port = $port_or_path = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1181,7 +1181,7 @@ sub runhttp2server { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1203,7 +1203,7 @@ sub runhttp2server { if($http2pid <= 0 || !pidexists($http2pid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $http2pid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -1242,7 +1242,7 @@ sub runhttp3server { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1264,7 +1264,7 @@ sub runhttp3server { if($http3pid <= 0 || !pidexists($http3pid)) { # it is NOT alive - stopserver($server, "$pid3"); + stopserver($server, $pid3); $doesntrun{$pidfile} = 1; $http3pid = $pid3 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -1308,7 +1308,7 @@ sub runhttpsserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1373,7 +1373,7 @@ sub runhttpsserver { sub runhttptlsserver { my ($verb, $ipv6) = @_; my $proto = "httptls"; - my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP"; + my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP; my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $idnum = 1; @@ -1392,7 +1392,7 @@ sub runhttptlsserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1413,7 +1413,7 @@ sub runhttptlsserver { if($httptlspid <= 0 || !pidexists($httptlspid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $httptlspid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -1439,7 +1439,7 @@ sub runpingpongserver { return (4, 0, 0); } - my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP"; + my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP; my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1; @@ -1455,7 +1455,7 @@ sub runpingpongserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1478,7 +1478,7 @@ sub runpingpongserver { if($ftppid <= 0 || !pidexists($ftppid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0); } @@ -1487,7 +1487,7 @@ sub runpingpongserver { my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1507,7 +1507,7 @@ sub runpingpongserver { # sub runsecureserver { my ($verb, $ipv6, $certfile, $proto, $clearport) = @_; - my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP"; + my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP; my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $idnum = 1; @@ -1526,7 +1526,7 @@ sub runsecureserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1597,7 +1597,7 @@ sub runtftpserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1621,7 +1621,7 @@ sub runtftpserver { if($tftppid <= 0 || !pidexists($tftppid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1629,7 +1629,7 @@ sub runtftpserver { my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1668,7 +1668,7 @@ sub rundnsserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1693,7 +1693,7 @@ sub rundnsserver { if($dnspid <= 0 || !pidexists($dnspid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1701,7 +1701,7 @@ sub rundnsserver { my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1741,7 +1741,7 @@ sub runrtspserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1764,7 +1764,7 @@ sub runrtspserver { if($rtsppid <= 0 || !pidexists($rtsppid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1772,7 +1772,7 @@ sub runrtspserver { my $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1816,7 +1816,7 @@ sub runsshserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1848,7 +1848,7 @@ sub runsshserver { # zero pid2 above. if($sshpid <= 0 || !pidexists($sshpid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $sshpid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server on $port\n"; @@ -1928,7 +1928,7 @@ sub runmqttserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -1949,7 +1949,7 @@ sub runmqttserver { if($sockspid <= 0 || !pidexists($sockspid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0); } @@ -1957,7 +1957,7 @@ sub runmqttserver { my $mqttport = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$mqttport) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -1990,7 +1990,7 @@ sub runsocksserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -2025,7 +2025,7 @@ sub runsocksserver { if($sockspid <= 0 || !pidexists($sockspid)) { # it is NOT alive logmsg "RUN: failed to start the $srvrname server\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -2035,7 +2035,7 @@ sub runsocksserver { $port = pidfromfile($portfile, $SERVER_TIMEOUT_SEC); if(!$port) { logmsg "RUN: timeout for $srvrname to produce port file $portfile\n"; - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; return (1, 0, 0, 0); } @@ -2073,7 +2073,7 @@ sub rundictserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -2094,7 +2094,7 @@ sub rundictserver { if($dictpid <= 0 || !pidexists($dictpid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $dictpid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -2134,7 +2134,7 @@ sub runsmbserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -2155,7 +2155,7 @@ sub runsmbserver { if($smbpid <= 0 || !pidexists($smbpid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $smbpid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -2195,7 +2195,7 @@ sub runnegtelnetserver { my $pid = processexists($pidfile); if($pid > 0) { - stopserver($server, "$pid"); + stopserver($server, $pid); } unlink($pidfile) if(-f $pidfile); @@ -2215,7 +2215,7 @@ sub runnegtelnetserver { if($ntelpid <= 0 || !pidexists($ntelpid)) { # it is NOT alive - stopserver($server, "$pid2"); + stopserver($server, $pid2); $doesntrun{$pidfile} = 1; $ntelpid = $pid2 = 0; logmsg "RUN: failed to start the $srvrname server\n"; @@ -2262,7 +2262,7 @@ sub responsive_http_server { # sub responsive_mqtt_server { my ($proto, $id, $verb, $ipv6) = @_; - my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP"; + my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP; my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1; @@ -2276,7 +2276,7 @@ sub responsive_mqtt_server { sub responsive_pingpong_server { my ($proto, $id, $verb, $ipv6) = @_; my $port; - my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP"; + my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? $HOST6IP : $HOSTIP; my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1; my $protoip = $proto . ($ipvnum == 6? '6': ''); @@ -2368,12 +2368,12 @@ sub responsive_httptls_server { my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4; my $proto = "httptls"; my $port = protoport($proto); - my $ip = "$HOSTIP"; + my $ip = $HOSTIP; my $idnum = 1; if($ipvnum == 6) { $port = protoport("httptls6"); - $ip = "$HOST6IP"; + $ip = $HOST6IP; } return &responsiveserver($proto, $ipvnum, $idnum, $ip, $port); diff --git a/tests/sshhelp.pm b/tests/sshhelp.pm index f8cac3e75a..a939670cde 100644 --- a/tests/sshhelp.pm +++ b/tests/sshhelp.pm @@ -177,9 +177,9 @@ sub dump_array { sub display_file { my $filename = $_[0]; print "=== Start of file $filename\n"; - if(open(my $displayfh, "<", "$filename")) { + if(open(my $displayfh, "<", $filename)) { while(my $line = <$displayfh>) { - print "$line"; + print $line; } close $displayfh; } @@ -192,9 +192,9 @@ sub display_file { sub display_file_top { my $filename = $_[0]; print "=== Top of file $filename\n"; - if(open(my $displayfh, "<", "$filename")) { + if(open(my $displayfh, "<", $filename)) { my $line = <$displayfh>; - print "$line"; + print $line; close $displayfh; } print "=== End of file $filename\n"; diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 84baf6a52b..770b6bd31c 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -1161,7 +1161,7 @@ logmsg "RUN: $cmd\n" if($verbose); # if($sshdid =~ /OpenSSH-Windows/) { # Fake pidfile for ssh server on Windows. - if(open(my $out, ">", "$pidfile")) { + if(open(my $out, ">", $pidfile)) { print $out $$ . "\n"; close($out); } diff --git a/tests/test1119.pl b/tests/test1119.pl index cf17167d4b..9561f701ab 100755 --- a/tests/test1119.pl +++ b/tests/test1119.pl @@ -81,7 +81,7 @@ sub scanenum { sub scanheader { my ($f)=@_; - open my $h, "<", "$f"; + open my $h, "<", $f; while(<$h>) { if(/^#define ((LIB|)CURL[A-Za-z0-9_]*)/) { push @syms, $1; @@ -105,7 +105,7 @@ sub scanallheaders { sub checkmanpage { my ($m) = @_; - open(my $mh, "<", "$m"); + open(my $mh, "<", $m); my $line = 1; while(<$mh>) { # strip off formatting diff --git a/tests/test1135.pl b/tests/test1135.pl index 15982e659d..40f18aaa22 100755 --- a/tests/test1135.pl +++ b/tests/test1135.pl @@ -51,7 +51,7 @@ if(!defined $root) { } $root = "$root/include/curl"; -opendir(D, "$root") || die "Cannot open directory $root: $!\n"; +opendir(D, $root) || die "Cannot open directory $root: $!\n"; my @dir = readdir(D); closedir(D); @@ -77,7 +77,7 @@ foreach my $f (@incs) { my $decl = $1; $decl =~ s/\r$//; $decl =~ /([a-z_]+)$/; - push(@out, "$1"); + push(@out, $1); } elsif(/^(^CURL_EXTERN .*)/) { # handle two-line declarations @@ -91,7 +91,7 @@ foreach my $f (@incs) { $decl =~ s/\r$//; $first .= $decl; $first =~ /([a-z_]+)$/; - push(@out, "$1"); + push(@out, $1); } $first = ""; } diff --git a/tests/test1139.pl b/tests/test1139.pl index c1e4651420..a11c9d03a3 100755 --- a/tests/test1139.pl +++ b/tests/test1139.pl @@ -67,7 +67,7 @@ my %alias = ( sub scanmdpage { my ($file, @words) = @_; - open(my $mh, "<", "$file") || + open(my $mh, "<", $file) || die "could not open $file"; my @m; while(<$mh>) { @@ -101,7 +101,7 @@ sub scanmdpage { my $r; # check for define aliases -open($r, "<", "$curlh") || +open($r, "<", $curlh) || die "no curl.h"; while(<$r>) { if(/^\#define (CURL(OPT|INFO|MOPT)_\w+) (.*)/) { @@ -113,7 +113,7 @@ close($r); my @curlopt; my @curlinfo; my @curlmopt; -open($r, "<", "$syms") || +open($r, "<", $syms) || die "no input file"; while(<$r>) { chomp; diff --git a/tests/test1140.pl b/tests/test1140.pl index addf047204..45da989ea6 100755 --- a/tests/test1140.pl +++ b/tests/test1140.pl @@ -58,7 +58,7 @@ sub manpresent { sub file { my ($f) = @_; - open(my $fh, "<", "$f") || + open(my $fh, "<", $f) || die "test1140.pl could not open $f"; my $line = 1; while(<$fh>) { diff --git a/tests/test1173.pl b/tests/test1173.pl index cc8ca6ecc3..6e2c9141af 100755 --- a/tests/test1173.pl +++ b/tests/test1173.pl @@ -79,7 +79,7 @@ my %deprecated = ( CURLOPT_RANDOM_FILE => 1, ); sub allsymbols { - open(my $f, "<", "$symbolsinversions") || + open(my $f, "<", $symbolsinversions) || die "$symbolsinversions: $|"; while(<$f>) { if($_ =~ /^([^ ]*) +(.*)/) { @@ -144,7 +144,7 @@ sub scanmanpage { my @separators; my @sepline; - open(my $m, "<", "$file") || + open(my $m, "<", $file) || die "test1173.pl could not open $file"; if($file =~ /[\/\\](CURL|curl_)([^\/\\]*).3/) { # This is a man page for libcurl. It requires an example unless it is diff --git a/tests/test1177.pl b/tests/test1177.pl index 83c3ee8ba5..32377986a5 100755 --- a/tests/test1177.pl +++ b/tests/test1177.pl @@ -39,7 +39,7 @@ my %manname; my %sourcename; my $error=0; -open(my $m, "<", "$manpage"); +open(my $m, "<", $manpage); while(<$m>) { if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) { $manversion{$1}++; @@ -50,7 +50,7 @@ while(<$m>) { } close($m); -open(my $h, "<", "$header"); +open(my $h, "<", $header); while(<$h>) { if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) { $headerversion{$1}++; @@ -58,7 +58,7 @@ while(<$h>) { } close($h); -open(my $s, "<", "$source"); +open(my $s, "<", $source); while(<$s>) { if($_ =~ /FEATURE\("([^"]*)"/) { $sourcename{$1}++; diff --git a/tests/test1222.pl b/tests/test1222.pl index 5a0092ee7d..96f6d60b23 100755 --- a/tests/test1222.pl +++ b/tests/test1222.pl @@ -59,7 +59,7 @@ sub scan_header { my $incomment = 0; my $inenum = 0; - open(my $h, "<", "$f"); + open(my $h, "<", $f); while(<$h>) { s/^\s*(.*?)\s*$/$1/; # Trim. # Remove multi-line comment trail. @@ -151,7 +151,7 @@ sub scan_man_for_opts { my $opt = ""; my $line = ""; - open(my $m, "<", "$f"); + open(my $m, "<", $f); while(<$m>) { if($_ =~ /^\./) { # roff directive found: end current option paragraph. @@ -187,7 +187,7 @@ sub scan_man_page { my ($path, $sym, $table)=@_; my $version = "X"; - if(open(my $fh, "<", "$path")) { + if(open(my $fh, "<", $path)) { my $section = ""; my $line = ""; diff --git a/tests/test1275.pl b/tests/test1275.pl index 4f7f520c22..11c4b98646 100755 --- a/tests/test1275.pl +++ b/tests/test1275.pl @@ -46,7 +46,7 @@ sub checkfile { if($f !~ /\.md\z/) { return; } - open(my $fh, "<", "$f"); + open(my $fh, "<", $f); my $l; my $prevl = ''; my $ignore = 0; diff --git a/tests/test1488.pl b/tests/test1488.pl index 3d67908195..4c4acb75aa 100755 --- a/tests/test1488.pl +++ b/tests/test1488.pl @@ -66,7 +66,7 @@ our %pastversion; sub checkmanpage { my ($m) = @_; - open(my $mh, "<", "$m"); + open(my $mh, "<", $m); my $line = 1; my $title; my $addedin; diff --git a/tests/test1544.pl b/tests/test1544.pl index eae1f20510..78bb9a19e3 100755 --- a/tests/test1544.pl +++ b/tests/test1544.pl @@ -42,7 +42,7 @@ sub scan_header { my $incomment = 0; my @stringopts; - open(my $h, "<", "$f"); + open(my $h, "<", $f); while(<$h>) { s/^\s*(.*?)\s*$/$1/; # Trim. # Remove multi-line comment trail. @@ -96,7 +96,7 @@ sub scan_wrapper_for_strings { my $inarmor = 0; my @stringopts; - open(my $h, "<", "$f"); + open(my $h, "<", $f); while(<$h>) { if($_ =~ /(BEGIN|END) TRANSLATABLE STRING OPTIONS/) { $inarmor = $1 eq "BEGIN"; diff --git a/tests/test971.pl b/tests/test971.pl index a0b900282b..e4ff5f860a 100755 --- a/tests/test971.pl +++ b/tests/test971.pl @@ -59,7 +59,7 @@ sub cmdfiles { sub mentions { my ($f) = @_; my @options; - open(my $fh, "<", "$f"); + open(my $fh, "<", $f); while(<$fh>) { chomp; if(/(.*) +([0-9.]+)/) { diff --git a/tests/testcurl.pl b/tests/testcurl.pl index 28614503af..198c41d8dc 100755 --- a/tests/testcurl.pl +++ b/tests/testcurl.pl @@ -226,7 +226,7 @@ sub logit_spaced($) { sub mydie($){ my $text=$_[0]; - logit "$text"; + logit $text; chdir $pwd; # cd back to the original root dir if($pwd && $build) { @@ -237,7 +237,7 @@ sub mydie($){ if(-r $buildlog) { # we have a build log output file left, remove it logit "removing the $buildlogname file"; - unlink "$buildlog"; + unlink $buildlog; } logit "ENDING HERE"; # last line logged! exit 1; @@ -247,7 +247,7 @@ sub get_host_triplet { my $triplet; my $configfile = "$pwd/$build/lib/curl_config.h"; - if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) { + if(-f $configfile && -s $configfile && open(my $libconfigh, "<", $configfile)) { while(<$libconfigh>) { if($_ =~ /^\#define\s+CURL_OS\s+"*([^"][^"]*)"*\s*/) { $triplet = $1; @@ -265,7 +265,7 @@ if($name && $email && $desc) { $infixed=4; $fixed=4; } -elsif(open(my $f, "<", "$setupfile")) { +elsif(open(my $f, "<", $setupfile)) { while(<$f>) { if(/(\w+)=(.*)/) { eval "\$$1=$2;"; @@ -310,7 +310,7 @@ if(!$confopts) { if($fixed < 4) { $fixed=4; - open(my $f, ">", "$setupfile") or die; + open(my $f, ">", $setupfile) or die; print $f "name='$name'\n"; print $f "email='$email'\n"; print $f "desc='$desc'\n"; @@ -385,7 +385,7 @@ if(-d $CURLDIR) { } # make the path absolute so we can use it everywhere -$CURLDIR = File::Spec->rel2abs("$CURLDIR"); +$CURLDIR = File::Spec->rel2abs($CURLDIR); $build="build-$$"; $buildlogname="buildlog-$$"; @@ -459,7 +459,7 @@ if($git) { logit " $_"; } - chdir "$CURLDIR"; + chdir $CURLDIR; } if($nobuildconf) { @@ -473,7 +473,7 @@ if($git) { # generate the build files logit "invoke autoreconf"; open(my $f, "-|", "autoreconf -fi 2>&1") or die; - open(my $log, ">", "$buildlog") or die; + open(my $log, ">", $buildlog) or die; while(<$f>) { my $ll = $_; print $ll; @@ -640,7 +640,7 @@ if(($have_embedded_ares) && open($f, "-|", "$make -f Makefile.$targetos 2>&1") or die; } else { - logit "$make"; + logit $make; open($f, "-|", "$make 2>&1") or die; } while(<$f>) { @@ -660,7 +660,7 @@ if(($have_embedded_ares) && } my $mkcmd = "$make -i" . ($targetos && !$configurebuild ? " $targetos" : ""); -logit "$mkcmd"; +logit $mkcmd; open($f, "-|", "$mkcmd 2>&1") or die; while(<$f>) { s/$pwd//g; @@ -704,7 +704,7 @@ if($configurebuild && !$crosscompile) { chdir "$pwd/$build/docs/examples"; logit_spaced "build examples"; open($f, "-|", "$make -i 2>&1") or die; - open(my $log, ">", "$buildlog") or die; + open(my $log, ">", $buildlog) or die; while(<$f>) { s/$pwd//g; print; @@ -721,7 +721,7 @@ if($configurebuild && !$crosscompile) { } logit "$make -k ${o}test-full"; open($f, "-|", "$make -k ${o}test-full 2>&1") or die; - open(my $log, ">", "$buildlog") or die; + open(my $log, ">", $buildlog) or die; while(<$f>) { s/$pwd//g; print; @@ -751,7 +751,7 @@ else { chdir "$pwd/$build/docs/examples"; logit_spaced "build examples"; open($f, "-|", "$make -i 2>&1") or die; - open(my $log, ">", "$buildlog") or die; + open(my $log, ">", $buildlog) or die; while(<$f>) { s/$pwd//g; print; @@ -766,7 +766,7 @@ else { chdir "$pwd/$build/tests"; logit_spaced "build test harness"; open(my $f, "-|", "$make -i 2>&1") or die; - open(my $log, ">", "$buildlog") or die; + open(my $log, ">", $buildlog) or die; while(<$f>) { s/$pwd//g; print; diff --git a/tests/valgrind.pm b/tests/valgrind.pm index 5de136b0da..1fbd8ecf64 100644 --- a/tests/valgrind.pm +++ b/tests/valgrind.pm @@ -40,7 +40,7 @@ use File::Basename; sub valgrindparse { my ($file) = @_; my @o; - open(my $val, "<", "$file") || + open(my $val, "<", $file) || return; @o = <$val>; close($val);