From 91f5ecc5beb93f53a9ccef69d3160c594008807e Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 4 Nov 2023 00:10:29 +1300 Subject: [PATCH 1/5] There may be more than one warning, don't be misleading. --- lib/RT/Test/Web.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm index db7a708f7a8..cc266caae71 100644 --- a/lib/RT/Test/Web.pm +++ b/lib/RT/Test/Web.pm @@ -269,7 +269,7 @@ sub next_warning_like { if (@{ $self->{stashed_server_warnings} || [] } == 0) { my @warnings = $self->get_warnings; if (@warnings == 0) { - Test::More::fail("no warnings emitted; expected 1"); + Test::More::fail("no warnings emitted; expected at least 1"); return 0; } $self->{stashed_server_warnings} = \@warnings; From 07d98f8858a73351df9744604c9beff1eb12e012 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 4 Nov 2023 00:07:23 +1300 Subject: [PATCH 2/5] Don't use ...dbh->errstr in error message The error might not be due to a DB error, and anyhow, the DB error was already been displayed when it first occurred within $SubAttachment->Create(...). --- lib/RT/Attachment.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm index 3f7696d3705..4057b563358 100644 --- a/lib/RT/Attachment.pm +++ b/lib/RT/Attachment.pm @@ -190,7 +190,7 @@ sub Create { Attachment => $part, ); unless ($id) { - $RT::Logger->crit("Attachment insert failed: ". $RT::Handle->dbh->errstr); + $RT::Logger->crit("Attachment subpart insert failed."); return ($id); } } From 2e6e717b16a550070bf1db805c267083290f3191 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 4 Nov 2023 00:09:38 +1300 Subject: [PATCH 3/5] Add in a missing space, and terminate the sentence. Previously this was displayed: Transaction not committed. Usually indicates a software fault.Data loss may have occurred A little ugly. --- lib/RT/Interface/Web/Handler.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm index 3ccb56e791f..93fab728ecb 100644 --- a/lib/RT/Interface/Web/Handler.pm +++ b/lib/RT/Interface/Web/Handler.pm @@ -174,7 +174,7 @@ sub CleanupRequest { $RT::Handle->ForceRollback; $RT::Logger->crit( "Transaction not committed. Usually indicates a software fault." - . "Data loss may have occurred" ); + . " Data loss may have occurred." ); } # Clean out the ACL cache. the performance impact should be marginal. From fd5097e82a72b55c81d3c1d52720916fb4205732 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sun, 12 Nov 2023 01:27:59 +1300 Subject: [PATCH 4/5] Don't print an object in the debug log There is no stringify function on RT::Transaction, so this is causing log entries like: [4044261] [Sat Nov 11 11:30:40 2023] [debug]: Calling SetRecipientDigests for transaction RT::Transaction=HASH(0x563feb2b4fb0), id 44 (lib/RT/Action/SendEmail.pm:693) Let's not have the RT::Transaction=HASH(0x563feb2b4fb0) in there. --- lib/RT/Action/SendEmail.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm index 76ee7175209..53756a9d229 100644 --- a/lib/RT/Action/SendEmail.pm +++ b/lib/RT/Action/SendEmail.pm @@ -693,7 +693,7 @@ sub SetRTSpecialHeaders { sub DeferDigestRecipients { my $self = shift; - $RT::Logger->debug( "Calling SetRecipientDigests for transaction " . $self->TransactionObj . ", id " . $self->TransactionObj->id ); + $RT::Logger->debug( "Calling SetRecipientDigests for transaction id " . $self->TransactionObj->id ); # The digest attribute will be an array of notifications that need to # be sent for this transaction. The array will have the following From e4ef7b45242738da0129b33af67b3180c73265d0 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 16 Jan 2024 23:05:37 +1300 Subject: [PATCH 5/5] Fix use of loop variable I was having this test fail when malware scanning is enabled with: Use of uninitialized value $_ in concatenation (.) or string at t/web/charting.t line 14. In perlsyn under https://perldoc.perl.org/perlsyn#Foreach-Loops it says: The foreach keyword is actually a synonym for the for keyword, so you can use either. If VAR is omitted, $_ is set to each value. VAR is set (it is $n), so perhaps this usage of $_ while VAR is set is undefined. --- t/web/charting.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/web/charting.t b/t/web/charting.t index 586ddd0d448..284df70d46e 100644 --- a/t/web/charting.t +++ b/t/web/charting.t @@ -9,7 +9,7 @@ for my $n (1..7) { my $ticket = RT::Ticket->new( RT->SystemUser ); my $req = 'root' . ($n % 2) . '@localhost'; my ( $ret, $msg ) = $ticket->Create( - Subject => "base ticket $_", + Subject => "base ticket $n", Queue => "General", Owner => "root", Requestor => $req, @@ -19,8 +19,8 @@ for my $n (1..7) { MIMEObj => MIME::Entity->build( From => $req, To => 'rt@localhost', - Subject => "base ticket $_", - Data => "Content $_", + Subject => "base ticket $n", + Data => "Content $n", ), ); ok( $ret, "ticket $n created: $msg" );