From 01112e9bd39a40dd2c2965883001984e94703210 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 21:37:36 -0400 Subject: [PATCH 1/9] GitInput: deal with undefined deepClone --- src/lib/Hydra/Plugin/GitInput.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/GitInput.pm b/src/lib/Hydra/Plugin/GitInput.pm index cd8d23e2..39a5cf83 100644 --- a/src/lib/Hydra/Plugin/GitInput.pm +++ b/src/lib/Hydra/Plugin/GitInput.pm @@ -34,7 +34,7 @@ sub _parseValue { my $start_options = 3; # if deepClone has "=" then is considered an option # and not the enabling of deepClone - if (index($deepClone, "=") != -1) { + if (defined($deepClone) && index($deepClone, "=") != -1) { undef $deepClone; $start_options = 2; } From 4fd90ec7843b4e9d090f44a9390191dbb7228b2d Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 21:41:41 -0400 Subject: [PATCH 2/9] EmailNotification: address Use of uninitialized value in numeric eq (==) --- src/lib/Hydra/Plugin/EmailNotification.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/EmailNotification.pm b/src/lib/Hydra/Plugin/EmailNotification.pm index 721365e1..6546dd1c 100644 --- a/src/lib/Hydra/Plugin/EmailNotification.pm +++ b/src/lib/Hydra/Plugin/EmailNotification.pm @@ -12,7 +12,7 @@ use Hydra::Helper::Email; sub isEnabled { my ($self) = @_; - return $self->{config}->{email_notification} == 1; + return defined($self->{config}->{email_notification}) && $self->{config}->{email_notification} == 1; } my $template = < Date: Tue, 19 Oct 2021 21:42:22 -0400 Subject: [PATCH 3/9] BitBucketStatus: address Use of uninitialized value in numeric eq (==) --- src/lib/Hydra/Plugin/BitBucketStatus.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/BitBucketStatus.pm b/src/lib/Hydra/Plugin/BitBucketStatus.pm index 72ed3b6b..3dcc639a 100644 --- a/src/lib/Hydra/Plugin/BitBucketStatus.pm +++ b/src/lib/Hydra/Plugin/BitBucketStatus.pm @@ -10,7 +10,7 @@ use Hydra::Helper::CatalystUtils; sub isEnabled { my ($self) = @_; - return $self->{config}->{enable_bitbucket_status} == 1; + return defined($self->{config}->{enable_bitbucket_status}) && $self->{config}->{enable_bitbucket_status} == 1; } sub toBitBucketState { From 31cf249aed7e47a59bc1ae231fb4c31810d9912a Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 21:50:13 -0400 Subject: [PATCH 4/9] S3Backup: check for bzip2 and xz Nix Config support (Use of uninitialized value ::Config::xz in concatenation) --- src/lib/Hydra/Plugin/S3Backup.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Plugin/S3Backup.pm b/src/lib/Hydra/Plugin/S3Backup.pm index bdd23b2f..a67082ec 100644 --- a/src/lib/Hydra/Plugin/S3Backup.pm +++ b/src/lib/Hydra/Plugin/S3Backup.pm @@ -21,11 +21,18 @@ sub isEnabled { } my $client; -my %compressors = ( - xz => "| $Nix::Config::xz", - bzip2 => "| $Nix::Config::bzip2", - none => "" -); +my %compressors = (); + +$compressors{"none"} = ""; + +if (defined($Nix::Config::bzip2)) { + $compressors{"bzip2"} = "| $Nix::Config::bzip2", +} + +if (defined($Nix::Config::xz)) { + $compressors{"xz"} = "| $Nix::Config::xz", +} + my $lockfile = Hydra::Model::DB::getHydraPath . "/.hydra-s3backup.lock"; sub buildFinished { From 0f8d02894a6a1d4297dbfdcfae2216b274b39b4c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 21:51:25 -0400 Subject: [PATCH 5/9] hydra-eval-jobset: Scalar value @declInputs[0] better written as $declInputs[0] at hydra-eval-jobset line 570. --- src/script/hydra-eval-jobset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index 4a165d86..7a9af09f 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -567,7 +567,7 @@ sub checkJobsetWrapped { my $inputInfo = {}; if ($jobsetsJobset) { my @declInputs = fetchInput($plugins, $db, $project, $jobset, "decl", $project->decltype, $project->declvalue, 0); - my $declInput = @declInputs[0] or die "cannot find the input containing the declarative project specification\n"; + my $declInput = $declInputs[0] or die "cannot find the input containing the declarative project specification\n"; die "multiple alternatives for the input containing the declarative project specification are not supported\n" if scalar @declInputs != 1; my $declFile = $declInput->{storePath} . "/" . $project->declfile; From 093e235bf0abc5b75588074fee47ec6c291b6464 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 22:02:41 -0400 Subject: [PATCH 6/9] GithubRefs: fixup "my" variable $type masks earlier declaration in same scope --- src/lib/Hydra/Plugin/GithubRefs.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Plugin/GithubRefs.pm b/src/lib/Hydra/Plugin/GithubRefs.pm index 1de2672d..2038ea47 100644 --- a/src/lib/Hydra/Plugin/GithubRefs.pm +++ b/src/lib/Hydra/Plugin/GithubRefs.pm @@ -97,8 +97,8 @@ sub _iterate { } sub fetchInput { - my ($self, $type, $name, $value, $project, $jobset) = @_; - return undef if $type ne "github_refs"; + my ($self, $input_type, $name, $value, $project, $jobset) = @_; + return undef if $input_type ne "github_refs"; my ($owner, $repo, $type, $fut, $prefix) = split ' ', $value; die "type field is neither 'heads' nor 'tags', but '$type'" From 30d36da057e7345f6278a34b5a3c1799f3aa9dc2 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 19 Oct 2021 22:04:57 -0400 Subject: [PATCH 7/9] CoverityScan: fixup tarballshandle introduced in 21e1ff0da1b7abe96bf83e7d7444b476f51088fe --- src/lib/Hydra/Plugin/CoverityScan.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/CoverityScan.pm b/src/lib/Hydra/Plugin/CoverityScan.pm index c7b39d02..0a7fae0c 100644 --- a/src/lib/Hydra/Plugin/CoverityScan.pm +++ b/src/lib/Hydra/Plugin/CoverityScan.pm @@ -53,7 +53,7 @@ sub buildFinished { my $covTarball; opendir my $tarballs_handle, $tarballs or die; - while (my $file = readdir $tarballshandle) { + while (my $file = readdir $tarballs_handle) { next unless $file =~ /.*-coverity-int\.(tgz|lzma|xz|bz2|zip)$/; $covTarball = "$tarballs/$file"; last; } From a36d23c1dd6070ab8603b20e939e077b838b6ba7 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 20 Oct 2021 10:40:08 -0400 Subject: [PATCH 8/9] fixup! BitBucketStatus: address Use of uninitialized value in numeric eq (==) --- src/lib/Hydra/Plugin/BitBucketStatus.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/BitBucketStatus.pm b/src/lib/Hydra/Plugin/BitBucketStatus.pm index 3dcc639a..33e3bc03 100644 --- a/src/lib/Hydra/Plugin/BitBucketStatus.pm +++ b/src/lib/Hydra/Plugin/BitBucketStatus.pm @@ -10,7 +10,7 @@ use Hydra::Helper::CatalystUtils; sub isEnabled { my ($self) = @_; - return defined($self->{config}->{enable_bitbucket_status}) && $self->{config}->{enable_bitbucket_status} == 1; + return ($self->{config}->{enable_bitbucket_status} // 0) == 1; } sub toBitBucketState { From a887b3d3466df58b92ac3ea5cd6cc4a69ce7d095 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 20 Oct 2021 10:40:08 -0400 Subject: [PATCH 9/9] fixup! EmailNotification: address Use of uninitialized value in numeric eq (==) --- src/lib/Hydra/Plugin/EmailNotification.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Hydra/Plugin/EmailNotification.pm b/src/lib/Hydra/Plugin/EmailNotification.pm index 6546dd1c..b5f133a6 100644 --- a/src/lib/Hydra/Plugin/EmailNotification.pm +++ b/src/lib/Hydra/Plugin/EmailNotification.pm @@ -12,7 +12,7 @@ use Hydra::Helper::Email; sub isEnabled { my ($self) = @_; - return defined($self->{config}->{email_notification}) && $self->{config}->{email_notification} == 1; + return ($self->{config}->{email_notification} // 0) == 1; } my $template = <