[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-693-gd885f6b
Jesse Vincent
jesse at bestpractical.com
Fri Sep 3 16:06:34 EDT 2010
The branch, 3.9-trunk has been updated
via d885f6b4bf1565f78c519b144ec368032430b9c2 (commit)
via 5395569ae18e4739d30bba7a8e6f3f1204522b7b (commit)
via 5be9cc45bb5f33bb87e06107746b7b44a41dd100 (commit)
via 65c369192790efbe7488d78cd365af16b753ff74 (commit)
from 5dfcc41fee46f1418ed243c0642e89dc12cbae10 (commit)
Summary of changes:
lib/RT/Ticket_Overlay.pm | 12 ++++++++++++
lib/RT/Transaction_Overlay.pm | 2 +-
sbin/rt-test-dependencies.in | 1 +
t/mail/sendmail.t | 14 ++++++++++++--
t/mail/wrong_mime_charset.t | 8 ++++++--
5 files changed, 32 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 65c369192790efbe7488d78cd365af16b753ff74
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 24 02:54:08 2010 -0400
Whine about transaction batches running during global destruction
Trying to run SQL queries as the interpreter (nondeterministically)
rids itself of global variables (like, say, those in RT::Config) can
end badly. This happens a lot during tests which spews lots of stack
trace after the tests are done running. This only adds a new warning
(which can't use RT::Logger since that might have been GCed!) but
still tries to go ahead and run the transaction scrips since they
may still actually work.
This adds a new dependency on Devel::GlobalDestruction which does
include XS. I think it's worth it. If any of our upstream uses Moose
then we already have D:GD anyway.
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index d7f30cc..ed91256 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -82,6 +82,7 @@ use RT::Reminders;
use RT::URI::fsck_com_rt;
use RT::URI;
use MIME::Entity;
+use Devel::GlobalDestruction;
# {{{ LINKTYPEMAP
@@ -3356,6 +3357,10 @@ sub DESTROY {
# when an object's refcount is changed in its destructor.
return if $self->{_Destroyed}++;
+ if (in_global_destruction()) {
+ warn "Too late to safely run transaction-batch scrips! This is typically caused by using ticket objects at the top-level of a script which uses the RT API. Be sure to explicitly undef such ticket objects, or put them inside of a lexical scope.";
+ }
+
my $batch = $self->TransactionBatch;
return unless $batch && @$batch;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 8ee51bd..2b6025e 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -205,6 +205,7 @@ CSS::Squish 0.06
File::Glob
Devel::StackTrace 1.19
Text::Password::Pronounceable
+Devel::GlobalDestruction
.
$deps{'MASON'} = [ text_to_hash( << '.') ];
commit 5be9cc45bb5f33bb87e06107746b7b44a41dd100
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 3 15:52:10 2010 -0400
Kill an undef warning
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index a069995..9cd5bca 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -1168,7 +1168,7 @@ sub UpdateCustomFields {
foreach
my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values )
{
- next unless length($value);
+ next unless (defined($value) && length($value));
$self->_AddCustomFieldValue(
Field => $cfid,
Value => $value,
commit 5395569ae18e4739d30bba7a8e6f3f1204522b7b
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 3 15:53:04 2010 -0400
Teach RT about Encode's warnings.
diff --git a/t/mail/sendmail.t b/t/mail/sendmail.t
index ad9fa85..99d59cb 100644
--- a/t/mail/sendmail.t
+++ b/t/mail/sendmail.t
@@ -3,7 +3,8 @@
use strict;
use File::Spec ();
-use RT::Test tests => 138;
+use RT::Test tests => 139;
+use Test::Warn;
use RT::EmailParser;
use RT::Tickets;
@@ -315,12 +316,21 @@ sub text_html_redef_sendmessage {
$parser->ParseMIMEEntityFromScalar($content);
-
# be as much like the mail gateway as possible.
&text_html_redef_sendmessage;
%args = (message => $content, queue => 1, action => 'correspond');
+
+warnings_like {
RT::Interface::Email::Gateway(\%args);
+}
+[
+ qr/Encoding error: "\\x\{041f\}" does not map to iso-8859-1 .*/,
+ qr/Encoding error: "\\x\{041f\}" does not map to iso-8859-1 .*/
+ ],
+"The badly formed Russian spam we have isn't actually well-formed UTF8, which makes Encode (correctly) warn";
+
+
$tickets = RT::Tickets->new($RT::SystemUser);
$tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
$tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
diff --git a/t/mail/wrong_mime_charset.t b/t/mail/wrong_mime_charset.t
index b0079f8..47638ef 100644
--- a/t/mail/wrong_mime_charset.t
+++ b/t/mail/wrong_mime_charset.t
@@ -1,7 +1,8 @@
#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test nodb => 1, tests => 3;
+use RT::Test nodb => 1, tests => 4;
+use Test::Warn;
use_ok('RT::I18N');
use utf8;
@@ -15,8 +16,11 @@ my $mime = MIME::Entity->build(
# set the wrong charset mime in purpose
$mime->head->mime_attr( "Content-Type.charset" => 'utf8' );
+warnings_are {
+ RT::I18N::SetMIMEEntityToEncoding( $mime, 'iso-8859-1' );
+} ['Encoding error: "\x{fffd}" does not map to iso-8859-1'], " We can't encode something into the wrong encoding without Encode complaining";
+
-RT::I18N::SetMIMEEntityToEncoding( $mime, 'iso-8859-1' );
my $subject = decode( 'iso-8859-1', $mime->head->get('Subject') );
chomp $subject;
is( $subject, $test_string, 'subject is set to iso-8859-1' );
commit d885f6b4bf1565f78c519b144ec368032430b9c2
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 3 16:08:47 2010 -0400
Clean up the globaldestruction patches to not warn when run in test
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index ed91256..5440be7 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -3358,7 +3358,14 @@ sub DESTROY {
return if $self->{_Destroyed}++;
if (in_global_destruction()) {
- warn "Too late to safely run transaction-batch scrips! This is typically caused by using ticket objects at the top-level of a script which uses the RT API. Be sure to explicitly undef such ticket objects, or put them inside of a lexical scope.";
+ unless ($ENV{'HARNESS_ACTIVE'}) {
+ warn "Too late to safely run transaction-batch scrips!"
+ ." This is typically caused by using ticket objects"
+ ." at the top-level of a script which uses the RT API."
+ ." Be sure to explicitly undef such ticket objects,"
+ ." or put them inside of a lexical scope.";
+ }
+ return;
}
my $batch = $self->TransactionBatch;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list