[Rt-commit] rt branch, 4.0.0-releng, updated. rt-4.0.0rc4-49-g212d9f4

Kevin Falcone falcone at bestpractical.com
Fri Feb 11 18:49:08 EST 2011


The branch, 4.0.0-releng has been updated
       via  212d9f4da59b0a935393c22ab5efe836f76bbe20 (commit)
       via  a8dd21c32cd4d8804e12834b40459f797b0d27b6 (commit)
       via  2f9cdfb178f5b3e8369064572516bbbc807b44ca (commit)
       via  8392d961dec46b242061ed17dbd281a8d16bb6c2 (commit)
       via  49bd564ca4a883a37af17711ba584a98bc1ca1e1 (commit)
       via  674c98bf2ed28b90e5fb1bf9f1a31091ef1d816c (commit)
       via  dd5310de7ad5db58e84bfbcb67d2f9d1fe9d379d (commit)
       via  58cc84676b86f7734e85245f405766e99bd4270d (commit)
       via  45e9c282733f23f473eeaa489c9551e39d02772c (commit)
       via  5dfa1847869db1040b685293af14858e3804abd1 (commit)
       via  1797fc48e8b08c3c5d466791ee34fa467a2c0ab7 (commit)
       via  b099e156ebaf9dc8372d1951763d7eb4cd2bf2c5 (commit)
       via  b8d8092e48a8868d8c95112fcc9092ff0f450fbd (commit)
       via  44a1d032bf39808ec8ce6cecfb32edcf6bfef8c3 (commit)
       via  bb0578369aed4fb9b797e05f6d323215cbc81389 (commit)
       via  13340221d6be810a758822f5c95d022fc3e64c58 (commit)
       via  21233b64b6a360b92b46d6fd5a8ce14696cb6db6 (commit)
       via  94891643aa410efbed473902bb129a5095653547 (commit)
       via  b151804a474a0b88f28cf551f3934cf6a3238f75 (commit)
       via  6d51aa7291506ef1c2796348d0157f4ba45b6dcc (commit)
       via  6f7b0e46f8cb3d6fcc80260b3e219fb2e5d11035 (commit)
       via  8b4fe7cc682c2b7ac94a8005c11c155b97d8fe14 (commit)
       via  a797a5a6723d377b3c0ba991a88a5751c3143be3 (commit)
       via  4c1fd8d44dc9e8de5cb835fb82619e9196a44895 (commit)
       via  70e268780b2f1138879f4386f6773189a4113c60 (commit)
       via  7065397bad7c3d9b9d963ec5899570d41a4070b6 (commit)
       via  fe8ee2e80da2204faafcdf21254e6481344b0928 (commit)
       via  4e177bb3f80a7a5777ef991dd2a7c04229f51bcf (commit)
       via  00d0791ec99185a7935de40fab963fa1934b473a (commit)
       via  d006664cc9a80278c6c3a4a9bf316c8b5aeda72e (commit)
       via  3acd55caa7fb2ec7ce6384a39a02d1518451ef5a (commit)
       via  ab8ff85909db3f72b19cd65da64fb68a9855a9ac (commit)
       via  0a2db037a6bfa778db9aef01e95d794bac45b3e1 (commit)
       via  e8123438030437050afba527a5fda70f584a388c (commit)
       via  ad00b28d921ffdc2ba18bf416ec7b7661440e6fb (commit)
       via  00e47c204aab9ddb91d16e04723f9e1c68614a25 (commit)
      from  ebfbb537ab0bcc6c932e33a49d08730a163130a0 (commit)

Summary of changes:
 bin/rt.in                                          |   13 ++---
 devel/extract-message-catalog                      |    6 +-
 devel/factory                                      |    4 +-
 devel/license_tag                                  |   20 ++++----
 etc/RT_Config.pm.in                                |    8 ++--
 etc/RT_SiteConfig.pm                               |    2 +
 etc/upgrade/generate-rtaddressregexp.in            |   38 +++++++++++++---
 lib/RT/Handle.pm                                   |    4 +-
 lib/RT/Installer.pm                                |    2 +-
 lib/RT/Interface/CLI.pm                            |    4 +-
 lib/RT/Interface/Email.pm                          |    2 +-
 lib/RT/Interface/Web.pm                            |   13 +++++-
 lib/RT/Squish/CSS.pm                               |    2 +-
 lib/RT/Test.pm                                     |   24 ++++++-----
 lib/RT/Test/Apache.pm                              |    6 +-
 lib/RT/Ticket.pm                                   |   22 +++++-----
 sbin/rt-setup-database.in                          |   10 ++--
 sbin/rt-setup-fulltext-index.in                    |    2 +-
 share/html/Admin/Global/Theme.html                 |    3 +-
 .../html/Admin/Tools/Shredder/Elements/PluginHelp  |    2 +-
 share/html/Elements/Footer                         |    2 +-
 share/html/Elements/QueueSummaryByStatus           |   46 +++++++++----------
 share/html/Elements/SelectOwnerAutocomplete        |    3 +
 share/html/Elements/Tabs                           |    4 +-
 share/html/Install/index.html                      |    2 +-
 share/html/NoAuth/css/{ => base}/farbtastic.css    |    0
 share/html/NoAuth/css/base/main.css                |    1 +
 share/html/NoAuth/js/util.js                       |    9 +++-
 share/html/Ticket/Elements/EditBasics              |   22 ++++-----
 share/html/Ticket/Elements/ShowRequestor           |    5 +-
 share/html/Ticket/Elements/UpdateCc                |   16 ++++---
 share/html/Ticket/ModifyAll.html                   |    2 +-
 share/html/Ticket/ModifyPeople.html                |    2 +-
 share/html/m/_elements/footer                      |    2 +-
 t/api/savedsearch.t                                |    6 +--
 t/mail/crypt-gnupg.t                               |    2 +-
 t/mail/gateway.t                                   |   14 +++---
 t/ticket/linking.t                                 |    6 +-
 t/ticket/scrips_batch.t                            |    2 +-
 t/web/attachment_encoding.t                        |    2 +-
 t/web/command_line.t                               |    2 +-
 t/web/ticket_owner_autocomplete.t                  |    2 +-
 42 files changed, 188 insertions(+), 151 deletions(-)
 rename share/html/NoAuth/css/{ => base}/farbtastic.css (100%)

- Log -----------------------------------------------------------------
commit 4c1fd8d44dc9e8de5cb835fb82619e9196a44895
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Fri Jan 28 12:50:15 2011 -0500

    Push farbtastic css into css/base.

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index ce50d2c..9b1628a 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -47,8 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <& /Admin/Elements/Header,
     Title => loc("Theme"),
-    LinkRel => { stylesheet => '/NoAuth/css/farbtastic.css' }
-    &>
+&>
 <& /Elements/Tabs &>
 <& /Elements/ListActions, actions => \@results &>
 
diff --git a/share/html/NoAuth/css/farbtastic.css b/share/html/NoAuth/css/base/farbtastic.css
similarity index 100%
rename from share/html/NoAuth/css/farbtastic.css
rename to share/html/NoAuth/css/base/farbtastic.css
diff --git a/share/html/NoAuth/css/base/main.css b/share/html/NoAuth/css/base/main.css
index 09bd68b..ba06ea4 100644
--- a/share/html/NoAuth/css/base/main.css
+++ b/share/html/NoAuth/css/base/main.css
@@ -53,6 +53,7 @@
 @import "superfish-navbar.css";
 @import "superfish-vertical.css";
 @import "tablesorter.css";
+ at import "farbtastic.css";
 @import "collection.css";
 @import "forms.css";
 @import "misc.css";

commit 6f7b0e46f8cb3d6fcc80260b3e219fb2e5d11035
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Jan 30 15:44:09 2011 -0500

    Prevent hangs during testing by removing a signals race condition
    
    Under high load, such as heavily concurrent testing, there is no
    guarantee that the parent process of the fork will have time to set up
    the signal handler before the shild finishes initialization.  Thus,
    receiving a USR1 signal causes it to die, leaving a zombie child
    process and the test wedged.
    
    Set up the signal handler before we fork, which guarantees that the
    child will not be able to force this race condition.  It leaves forked
    server processes with a USR1 signal handler, but there is little harm
    to this.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index d0d465e..5354fcc 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1208,14 +1208,16 @@ sub start_plack_server {
              kill 'USR1' => getppid();
          });
 
+    # We are expecting a USR1 from the child process after it's ready
+    # to listen.  We set this up _before_ we fork to avoid race
+    # conditions.
+    my $handled;
+    $SIG{USR1} = sub { $handled = 1};
+
     my $pid = fork();
     die "failed to fork" unless defined $pid;
 
     if ($pid) {
-        # We are expecting a USR1 from the child process after it's
-        # ready to listen.
-        my $handled;
-        $SIG{USR1} = sub { $handled = 1};
         sleep 15;
         Test::More::diag "did not get expected USR1 for test server readiness"
             unless $handled;

commit 6d51aa7291506ef1c2796348d0157f4ba45b6dcc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Jan 30 15:52:55 2011 -0500

    Avoid sleeping for 15s if the server is already ready
    
    It is possible for the server to have sent us the ready signal before
    the parent hits the sleep(); in this case, the parent would wait,
    uninterrupted by SIGUSR1, for 15s, despite the server being ready.
    
    Hence, only sleep if we have not already received the signal.  There
    is still a minute race condition between the "unless" check and the
    "sleep," but this reduces the window considerably, and the side
    effects to the race condition are merely a slower test.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 5354fcc..1e4ca7c 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1218,7 +1218,7 @@ sub start_plack_server {
     die "failed to fork" unless defined $pid;
 
     if ($pid) {
-        sleep 15;
+        sleep 15 unless $handled;
         Test::More::diag "did not get expected USR1 for test server readiness"
             unless $handled;
         push @SERVERS, $pid;

commit b151804a474a0b88f28cf551f3934cf6a3238f75
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Jan 31 15:23:12 2011 +0300

    localizing sighandler wouldn't do harm, %SIG stays clean

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 1e4ca7c..5c81228 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1212,7 +1212,7 @@ sub start_plack_server {
     # to listen.  We set this up _before_ we fork to avoid race
     # conditions.
     my $handled;
-    $SIG{USR1} = sub { $handled = 1};
+    local $SIG{USR1} = sub { $handled = 1};
 
     my $pid = fork();
     die "failed to fork" unless defined $pid;

commit 94891643aa410efbed473902bb129a5095653547
Merge: 8b4fe7c b151804
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 31 14:23:39 2011 -0500

    Merge branch '4.0/test-race-conditions' into 4.0-trunk


commit 21233b64b6a360b92b46d6fd5a8ce14696cb6db6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Jan 29 00:16:19 2011 -0500

    Default the AutoComplete SelectOwner to the current owner
    
    The empty box, while not incorrect, confuses end-users.  This also
    makes the Reply page mirror the functionality that is seen on the
    Basics and People pages.

diff --git a/share/html/Elements/SelectOwnerAutocomplete b/share/html/Elements/SelectOwnerAutocomplete
index 86fd9c0..d9fc871 100644
--- a/share/html/Elements/SelectOwnerAutocomplete
+++ b/share/html/Elements/SelectOwnerAutocomplete
@@ -50,6 +50,7 @@ $Name           => undef
 $Objects        => []
 $Default        => 0
 $ValueAttribute => 'Name'
+$TicketObj      => undef
 </%ARGS>
 <%INIT>
 $ValueAttribute = 'Name' unless $ValueAttribute =~ /^(?:id|Name)$/;
@@ -60,6 +61,8 @@ if ( $Default and not $Default =~ /\D/ ) {
     my $user = RT::User->new( $session{'CurrentUser'} );
     $user->Load($Default);
     $value = $user->$ValueAttribute;
+} elsif (defined $TicketObj) {
+    $value = $TicketObj->OwnerObj->$ValueAttribute;
 }
 
 # Map to a string of RT::Ticket-1|RT::Queue-5|...
diff --git a/t/web/ticket_owner_autocomplete.t b/t/web/ticket_owner_autocomplete.t
index 787c8fd..3aa3f28 100644
--- a/t/web/ticket_owner_autocomplete.t
+++ b/t/web/ticket_owner_autocomplete.t
@@ -131,7 +131,7 @@ diag "on reply correct owner is selected";
     $agent_a->follow_link_ok( { id => 'page-actions-reply' }, 'Reply' );
 
     my $form = $agent_a->form_number(3);
-    is $form->value('Owner'), '', 'empty value selected';
+    is $form->value('Owner'), 'user_b', 'current user selected';
     $agent_a->submit;
 
     $ticket = RT::Ticket->new( RT->SystemUser );

commit 13340221d6be810a758822f5c95d022fc3e64c58
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 31 16:04:22 2011 -0500

    jQuery can't select ids which contain "@" or ".", like email addresses have
    
    This restores the functionality of "clicking one-time cc checkboxes
    adds them to the textarea."  It was previously falling back to the
    non-JS version.

diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index 6c926f6..ef29240 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -186,7 +186,7 @@ function checkAllObjects()
 }
 
 function checkboxToInput(target,checkbox,val){    
-    var tar = jQuery('#'+target);
+    var tar = jQuery('#' + target);
     var box = jQuery('#' + checkbox);
     if(box.attr('checked')){
         if (tar.val()==''){
@@ -200,6 +200,7 @@ function checkboxToInput(target,checkbox,val){
         tar.val(tar.val().replace(val+', ',''));
         tar.val(tar.val().replace(val,''));
     }
+    jQuery('#UpdateIgnoreAddressCheckboxes').val(true);
 }
 
 // ahah for back compatibility as plugins may still use it
diff --git a/share/html/Ticket/Elements/UpdateCc b/share/html/Ticket/Elements/UpdateCc
index ba133ef..e8363c5 100644
--- a/share/html/Ticket/Elements/UpdateCc
+++ b/share/html/Ticket/Elements/UpdateCc
@@ -55,13 +55,16 @@
 <i class="label">(<&|/l&>check to add</&>)</i>
 %}
 %foreach my $addr ( @one_time_Ccs ) {
-<input 
-id="UpdateCc-<%$addr%>" 
-name="UpdateCc-<%$addr%>" 
-    type="checkbox" 
+% my $cleanid = $addr;
+% $cleanid =~ s/\W//g;
+<input
+    id="UpdateCc-<%$cleanid%>"
+    name="UpdateCc-<%$cleanid%>"
+    class="onetime onetimecc"
+    type="checkbox"
 % my $clean_addr = $txn_addresses{$addr}->format;
 % $clean_addr =~ s/'/\\'/g;
-    onClick="checkboxToInput('UpdateCc', 'UpdateCc-<%$addr%>','<%$clean_addr%>' ); $(UpdateIgnoreAddressCheckboxes).value=1"
+    onClick="checkboxToInput('UpdateCc', 'UpdateCc-<%$cleanid%>','<%$clean_addr%>' );"
     <% $ARGS{'UpdateCc-'.$addr} ? 'checked="checked"' : ''%> > <& /Elements/ShowUser, Address => $txn_addresses{$addr}&>
 %}
 </td></tr>
@@ -71,12 +74,15 @@ name="UpdateCc-<%$addr%>"
 %}
 %foreach my $addr ( @one_time_Ccs ) {
 <input
-    id="UpdateBcc-<%$addr%>"
-    name="UpdateBcc-<%$addr%>"
-    type="checkbox" 
+% my $cleanid = $addr;
+% $cleanid =~ s/\W//g;
+    id="UpdateBcc-<%$cleanid%>"
+    name="UpdateBcc-<%$cleanid%>"
+    class="onetime onetimebcc"
+    type="checkbox"
 % my $clean_addr = $txn_addresses{$addr}->format;
 % $clean_addr =~ s/'/\\'/g;
-    onClick="checkboxToInput('UpdateBcc', 'UpdateBcc-<%$addr%>','<%$clean_addr%>' ); $(UpdateIgnoreAddressCheckboxes).value=1"
+    onClick="checkboxToInput('UpdateBcc', 'UpdateBcc-<%$cleanid%>','<%$clean_addr%>' );"
         <% $ARGS{'UpdateBcc-'.$addr} ? 'checked="checked"' : ''%>> 
 <& /Elements/ShowUser, Address => $txn_addresses{$addr}&>
 %}

commit bb0578369aed4fb9b797e05f6d323215cbc81389
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 31 17:26:18 2011 -0500

    Instead of 1334022, escape the CSS selector instead

diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index ef29240..58855a6 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -186,8 +186,8 @@ function checkAllObjects()
 }
 
 function checkboxToInput(target,checkbox,val){    
-    var tar = jQuery('#' + target);
-    var box = jQuery('#' + checkbox);
+    var tar = jQuery('#' + escapeCssSelector(target));
+    var box = jQuery('#' + escapeCssSelector(checkbox));
     if(box.attr('checked')){
         if (tar.val()==''){
             tar.val(val);
@@ -341,3 +341,7 @@ function addprincipal_onchange(ev, ui) {
     }
 }
 
+
+function escapeCssSelector(str) {
+    return str.replace(/([^A-Za-z0-9_-])/g,'\\$1');
+}
diff --git a/share/html/Ticket/Elements/UpdateCc b/share/html/Ticket/Elements/UpdateCc
index e8363c5..c1518cd 100644
--- a/share/html/Ticket/Elements/UpdateCc
+++ b/share/html/Ticket/Elements/UpdateCc
@@ -55,16 +55,14 @@
 <i class="label">(<&|/l&>check to add</&>)</i>
 %}
 %foreach my $addr ( @one_time_Ccs ) {
-% my $cleanid = $addr;
-% $cleanid =~ s/\W//g;
 <input
-    id="UpdateCc-<%$cleanid%>"
-    name="UpdateCc-<%$cleanid%>"
+    id="UpdateCc-<%$addr%>"
+    name="UpdateCc-<%$addr%>"
     class="onetime onetimecc"
     type="checkbox"
 % my $clean_addr = $txn_addresses{$addr}->format;
 % $clean_addr =~ s/'/\\'/g;
-    onClick="checkboxToInput('UpdateCc', 'UpdateCc-<%$cleanid%>','<%$clean_addr%>' );"
+    onClick="checkboxToInput('UpdateCc', 'UpdateCc-<%$addr%>','<%$clean_addr%>' );"
     <% $ARGS{'UpdateCc-'.$addr} ? 'checked="checked"' : ''%> > <& /Elements/ShowUser, Address => $txn_addresses{$addr}&>
 %}
 </td></tr>
@@ -74,15 +72,13 @@
 %}
 %foreach my $addr ( @one_time_Ccs ) {
 <input
-% my $cleanid = $addr;
-% $cleanid =~ s/\W//g;
-    id="UpdateBcc-<%$cleanid%>"
-    name="UpdateBcc-<%$cleanid%>"
+    id="UpdateBcc-<%$addr%>"
+    name="UpdateBcc-<%$addr%>"
     class="onetime onetimebcc"
     type="checkbox"
 % my $clean_addr = $txn_addresses{$addr}->format;
 % $clean_addr =~ s/'/\\'/g;
-    onClick="checkboxToInput('UpdateBcc', 'UpdateBcc-<%$cleanid%>','<%$clean_addr%>' );"
+    onClick="checkboxToInput('UpdateBcc', 'UpdateBcc-<%$addr%>','<%$clean_addr%>' );"
         <% $ARGS{'UpdateBcc-'.$addr} ? 'checked="checked"' : ''%>> 
 <& /Elements/ShowUser, Address => $txn_addresses{$addr}&>
 %}

commit 44a1d032bf39808ec8ce6cecfb32edcf6bfef8c3
Merge: bb05783 21233b6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 31 17:51:22 2011 -0500

    Merge branch '4.0/owner-autocomplete-default' into 4.0-trunk


commit b8d8092e48a8868d8c95112fcc9092ff0f450fbd
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Feb 2 03:59:27 2011 +0300

    handle no-versions to upgrade to earlier

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index d104215..9610094 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -318,15 +318,15 @@ sub action_upgrade {
         if RT::Handle::cmp_version( $upgrading_from, $upgrading_to ) == 0;
 
     my @versions = get_versions_from_to($base_dir, $upgrading_from, undef);
+    return (1, "No DB changes since $upgrading_from")
+        unless @versions;
+
     if (RT::Handle::cmp_version($versions[-1], $upgrading_to) > 0) {
         print "\n***** There are upgrades for $versions[-1], which is later than $upgrading_to,\n";
         print   "***** which you are nominally upgrading to.  Upgrading to $versions[-1] instead.\n";
         $upgrading_to = $versions[-1];
     }
 
-    return (1, "No DB changes between $upgrading_from and $upgrading_to")
-        unless @versions;
-
     print "\nGoing to apply following upgrades:\n";
     print map "* $_\n", @versions;
 

commit b099e156ebaf9dc8372d1951763d7eb4cd2bf2c5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 4 11:33:47 2011 +0800

    we don't like 2 args open any more

diff --git a/devel/extract-message-catalog b/devel/extract-message-catalog
index 8f65233..6b231a6 100755
--- a/devel/extract-message-catalog
+++ b/devel/extract-message-catalog
@@ -133,7 +133,7 @@ sub extract_strings_from_code {
     $filename =~ s'^\./'';
     $filename =~ s'\.in$'';
 
-    unless (open _, $file) {
+    unless (open _, '<', $file) {
         print "Cannot open $file for reading ($!), skipping.\n";
         return;
     }
@@ -261,7 +261,7 @@ sub update {
     print "Updating $lang...\n";
 
     my @lines;
-    @lines = (<LEXICON>) if open (LEXICON, $file);
+    @lines = (<LEXICON>) if open LEXICON, '<', $file;
     @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
     while (@lines) {
         my $msghdr = "";
@@ -355,7 +355,7 @@ sub update {
         $out .= 'msgid ' . fmt($_) . "msgstr \"$Lexicon{$_}\"\n\n";
     }
 
-    open PO, ">$file" or die "Couldn't open '$file' for writing: $!";
+    open PO, '>', $file or die "Couldn't open '$file' for writing: $!";
     print PO $out;
     close PO;
 
diff --git a/devel/license_tag b/devel/license_tag
index b12f641..9861553 100755
--- a/devel/license_tag
+++ b/devel/license_tag
@@ -112,7 +112,7 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /images/ || $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -136,7 +136,7 @@ sub tag_mason {
 
 
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -145,7 +145,7 @@ sub tag_mason {
 
 sub tag_makefile {
         my $pm = shift;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -169,7 +169,7 @@ sub tag_makefile {
 
 
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -179,7 +179,7 @@ sub tag_makefile {
 sub tag_pm {
         my $pm = $_;
         next unless $pm =~ /\.pm/s;
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -203,7 +203,7 @@ sub tag_pm {
 
 
 
-        open (FILE, ">$pm") || die "couldn't write new file $pm";
+        open FILE, '>', $pm or die "couldn't write new file $pm";
         print FILE $file;
         close FILE;
 
@@ -213,7 +213,7 @@ sub tag_pm {
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open(FILE,"<$pm") || die "Failed to open $pm";
+        open FILE, '<', $pm or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -240,7 +240,7 @@ sub tag_script {
         print "\n";
 
 
-        open (FILE, ">$pm") || die "couldn't write new file";
+        open FILE, '>', $pm or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 49b5140..943d445 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -462,7 +462,7 @@ sub InsertSchema {
 
     my (@schema);
 
-    open my $fh_schema, "<$file";
+    open my $fh_schema, '<', $file or die $!;
 
     my $has_local = 0;
     open my $fh_schema_local, "<" . $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type )
diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index b57e0c3..21e23a9 100644
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -195,7 +195,7 @@ sub GetMessageContent {
     
     #Load the sourcefile, if it's been handed to us
     if ($source) {
-	open (SOURCE, "<$source");
+	open SOURCE, '<', $source or die $!;
 	@lines = (<SOURCE>);
 	close (SOURCE);
     }
@@ -221,7 +221,7 @@ sub GetMessageContent {
 	system ($ENV{'EDITOR'}, $filename);
     }	
     
-    open (READ, "<$filename");
+    open READ, '<', $filename or die $!;
     my @newlines = (<READ>);
     close (READ);
 
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 9ac96d7..e4e2643 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -445,7 +445,7 @@ sub SendEmail {
             # don't ignore CHLD signal to get proper exit code
             local $SIG{'CHLD'} = 'DEFAULT';
 
-            open my $mail, "|$path $args" or die "couldn't execute program: $!";
+            open my $mail, '|-', "$path $args" or die "couldn't execute program: $!";
 
             # if something wrong with $mail->print we will get PIPE signal, handle it
             local $SIG{'PIPE'} = sub { die "program unexpectedly closed pipe" };
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 49d8d06..7ec6139 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -837,7 +837,7 @@ sub SendStaticFile {
         $type ||= "application/octet-stream";
     }
     $HTML::Mason::Commands::r->content_type($type);
-    open my $fh, "<$file" or die "couldn't open file: $!";
+    open my $fh, '<', $file or die "couldn't open file: $!";
     binmode($fh);
     {
         local $/ = \16384;
diff --git a/t/mail/crypt-gnupg.t b/t/mail/crypt-gnupg.t
index 6b89aab..cf69985 100644
--- a/t/mail/crypt-gnupg.t
+++ b/t/mail/crypt-gnupg.t
@@ -304,7 +304,7 @@ diag 'wrong signed/encrypted parts: wrong proto';
 
 diag 'verify inline and in attachment signatures';
 {
-    open my $fh, "$homedir/signed_old_style_with_attachment.eml";
+    open my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" or die $!;
     my $parser = new MIME::Parser;
     my $entity = $parser->parse( $fh );
 
diff --git a/t/ticket/linking.t b/t/ticket/linking.t
index ea2d01b..d947fe5 100644
--- a/t/ticket/linking.t
+++ b/t/ticket/linking.t
@@ -38,13 +38,13 @@ my $q2 = RT::Queue->new(RT->SystemUser);
 ok ($id,$msg);
 
 my $commit_code = <<END;
-open my \$file, "<$filename" or die "couldn't open $filename";
+open my \$file, '<', "$filename" or die "couldn't open $filename";
 my \$data = <\$file>;
 \$data += 0;
 close \$file;
 \$RT::Logger->debug("Data is \$data");
 
-open \$file, ">$filename" or die "couldn't open $filename";
+open \$file, '>', "$filename" or die "couldn't open $filename";
 if (\$self->TransactionObj->Type eq 'AddLink') {
     \$RT::Logger->debug("AddLink");
     print \$file \$data+1, "\n";
@@ -391,7 +391,7 @@ ok($link->LocalBase   == 0, "LocalBase set correctly");
 
 sub link_count {
     my $file = shift;
-    open my $fh, "<$file" or die "couldn't open $file";
+    open my $fh, '<', $file or die "couldn't open $file";
     my $data = <$fh>;
     close $fh;
 
diff --git a/t/web/command_line.t b/t/web/command_line.t
index 805cf41..ee1ee7a 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -508,7 +508,7 @@ sub check_attachment {
     expect_handle->before() =~ $attachment_regex;
     my $attachment_id = $1;
     expect_send("show ticket/$ticket_id/attachments/$attachment_id/content","Fetching Attachment");
-    open (my $fh, $attachment_path) or die "Can't open $attachment_path: $!";
+    open my $fh, '<', $attachment_path or die "Can't open $attachment_path: $!";
     my $attachment_content = do { local($/); <$fh> };
     close $fh;
     chomp $attachment_content;

commit 1797fc48e8b08c3c5d466791ee34fa467a2c0ab7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 4 13:40:03 2011 +0800

    add parens for open() call to avoid confusion; also with left 2-arg => 3-arg change

diff --git a/bin/rt.in b/bin/rt.in
index e2b39dd..e397fef 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1171,8 +1171,7 @@ sub submit {
         my ($self, $file) = @_;
         $file ||= $self->{file};
 
-        open(my $handle, $file)
-            or return 0;
+        open( my $handle, '<', $file ) or return 0;
 
         $self->{file} = $file;
         my $sids = $self->{sids} = {};
@@ -1191,8 +1190,7 @@ sub submit {
         my ($self, $file) = shift;
         $file ||= $self->{file};
 
-        open(my $handle, ">$file")
-            or return 0;
+        open( my $handle, '>', "$file" ) or return 0;
 
         my $sids = $self->{sids};
         foreach my $server (keys %$sids) {
@@ -1433,8 +1431,7 @@ sub parse_config_file {
     my ($file) = @_;
     local $_; # $_ may be aliased to a constant, from line 1163
 
-    open(my $handle, $file)
-        or return;
+    open( my $handle, '<', $file ) or return;
 
     while (<$handle>) {
         chomp;
@@ -1483,13 +1480,13 @@ sub vi {
 
     local $/ = undef;
 
-    open(my $handle, ">$file") || die "$file: $!\n";
+    open( my $handle, '>', $file ) or die "$file: $!\n";
     print $handle $text;
     close($handle);
 
     system($editor, $file) && die "Couldn't run $editor.\n";
 
-    open($handle, $file) || die "$file: $!\n";
+    open( $handle, '<', $file ) or die "$file: $!\n";
     $text = <$handle>;
     close($handle);
 
diff --git a/devel/factory b/devel/factory
index d59923e..6e696f8 100755
--- a/devel/factory
+++ b/devel/factory
@@ -346,11 +346,11 @@ $ClassAccessible
     print "About to make $RecordClassPath, $CollectionClassPath\n";
     `mkdir -p $path`;
 
-    open( RECORD, ">>$RecordClassPath" );
+    open( RECORD, '>>', $RecordClassPath ) or die $!;
     print RECORD $RecordClass;
     close(RECORD);
 
-    open( COL, ">>$CollectionClassPath" );
+    open( COL, '>>', $CollectionClassPath ) or die $!;
     print COL $CollectionClass;
     close(COL);
 
diff --git a/devel/license_tag b/devel/license_tag
index 9861553..5ac7ee6 100755
--- a/devel/license_tag
+++ b/devel/license_tag
@@ -112,7 +112,7 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /images/ || $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open FILE, '<', $pm or die "Failed to open $pm";
+        open( FILE, '<', $pm ) or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -136,7 +136,7 @@ sub tag_mason {
 
 
 
-        open FILE, '>', $pm or die "couldn't write new file";
+        open( FILE, '>', $pm ) or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -145,7 +145,7 @@ sub tag_mason {
 
 sub tag_makefile {
         my $pm = shift;
-        open FILE, '<', $pm or die "Failed to open $pm";
+        open( FILE, '<', $pm ) or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -169,7 +169,7 @@ sub tag_makefile {
 
 
 
-        open FILE, '>', $pm or die "couldn't write new file";
+        open( FILE, '>', $pm ) or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
@@ -179,7 +179,7 @@ sub tag_makefile {
 sub tag_pm {
         my $pm = $_;
         next unless $pm =~ /\.pm/s;
-        open FILE, '<', $pm or die "Failed to open $pm";
+        open( FILE, '<', $pm ) or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -203,7 +203,7 @@ sub tag_pm {
 
 
 
-        open FILE, '>', $pm or die "couldn't write new file $pm";
+        open( FILE, '>', $pm ) or die "couldn't write new file $pm";
         print FILE $file;
         close FILE;
 
@@ -213,7 +213,7 @@ sub tag_pm {
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open FILE, '<', $pm or die "Failed to open $pm";
+        open( FILE, '<', $pm ) or die "Failed to open $pm";
         my $file = (join "", <FILE>);
         close (FILE);
         print "$pm - ";
@@ -240,7 +240,7 @@ sub tag_script {
         print "\n";
 
 
-        open FILE, '>', $pm or die "couldn't write new file";
+        open( FILE, '>', $pm ) or die "couldn't write new file";
         print FILE $file;
         close FILE;
 
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 943d445..8fd63a4 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -462,10 +462,10 @@ sub InsertSchema {
 
     my (@schema);
 
-    open my $fh_schema, '<', $file or die $!;
+    open( my $fh_schema, '<', $file ) or die $!;
 
     my $has_local = 0;
-    open my $fh_schema_local, "<" . $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type )
+    open( my $fh_schema_local, "<" . $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type ))
         and $has_local = 1;
 
     my $statement = "";
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index c9ab7dd..97d3595 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -264,7 +264,7 @@ sub SaveConfig {
 
     {
         local $/;
-        open my $fh, '<', $file or die $!;
+        open( my $fh, '<', $file ) or die $!;
         $content = <$fh>;
         $content =~ s/^\s*1;\s*$//m;
     }
diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index 21e23a9..1b044da 100644
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -195,7 +195,7 @@ sub GetMessageContent {
     
     #Load the sourcefile, if it's been handed to us
     if ($source) {
-	open SOURCE, '<', $source or die $!;
+	open( SOURCE, '<', $source ) or die $!;
 	@lines = (<SOURCE>);
 	close (SOURCE);
     }
@@ -221,7 +221,7 @@ sub GetMessageContent {
 	system ($ENV{'EDITOR'}, $filename);
     }	
     
-    open READ, '<', $filename or die $!;
+    open( READ, '<', $filename ) or die $!;
     my @newlines = (<READ>);
     close (READ);
 
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index e4e2643..d07f9ad 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -445,7 +445,7 @@ sub SendEmail {
             # don't ignore CHLD signal to get proper exit code
             local $SIG{'CHLD'} = 'DEFAULT';
 
-            open my $mail, '|-', "$path $args" or die "couldn't execute program: $!";
+            open( my $mail, '|-', "$path $args" ) or die "couldn't execute program: $!";
 
             # if something wrong with $mail->print we will get PIPE signal, handle it
             local $SIG{'PIPE'} = sub { die "program unexpectedly closed pipe" };
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 7ec6139..fc5bc56 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -837,7 +837,7 @@ sub SendStaticFile {
         $type ||= "application/octet-stream";
     }
     $HTML::Mason::Commands::r->content_type($type);
-    open my $fh, '<', $file or die "couldn't open file: $!";
+    open( my $fh, '<', $file ) or die "couldn't open file: $!";
     binmode($fh);
     {
         local $/ = \16384;
diff --git a/lib/RT/Squish/CSS.pm b/lib/RT/Squish/CSS.pm
index 15ffc04..166b8ef 100644
--- a/lib/RT/Squish/CSS.pm
+++ b/lib/RT/Squish/CSS.pm
@@ -88,7 +88,7 @@ sub file_handle {
     my $self    = shift;
     my $file    = shift;
     my $content = $HTML::Mason::Commands::m->scomp("/NoAuth/css/$file") || '';
-    open my $fh, '<', \$content or die "$!";
+    open( my $fh, '<', \$content ) or die $!;
     return $fh;
 }
 
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 5c81228..84d75c4 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -223,7 +223,7 @@ sub bootstrap_config {
     $tmp{'config'}{'RT'} = File::Spec->catfile(
         "$tmp{'directory'}", 'RT_SiteConfig.pm'
     );
-    open my $config, '>', $tmp{'config'}{'RT'}
+    open( my $config, '>', $tmp{'config'}{'RT'} )
         or die "Couldn't open $tmp{'config'}{'RT'}: $!";
 
     print $config qq{
@@ -261,7 +261,7 @@ Set( \$RTAddressRegexp , qr/^bad_re_that_doesnt_match\$/);
 Set( \$MailCommand, sub {
     my \$MIME = shift;
 
-    open my \$handle, '>>', '$mail_catcher'
+    open( my \$handle, '>>', '$mail_catcher' )
         or die "Unable to open '$mail_catcher' for appending: \$!";
 
     \$MIME->print(\$handle);
@@ -291,7 +291,7 @@ sub bootstrap_logging {
     $tmp{'log'}{'RT'} = File::Spec->catfile(
         "$tmp{'directory'}", 'rt.debug.log'
     );
-    open my $fh, '>', $tmp{'log'}{'RT'}
+    open( my $fh, '>', $tmp{'log'}{'RT'} )
         or die "Couldn't open $tmp{'config'}{'RT'}: $!";
     # make world writable so apache under different user
     # can write into it
@@ -322,7 +322,7 @@ sub set_config_wrapper {
                 SCALAR => '$',
             );
             my $sigil = $sigils{$type} || $sigils{'SCALAR'};
-            open my $fh, '>>', $tmp{'config'}{'RT'}
+            open( my $fh, '>>', $tmp{'config'}{'RT'} )
                 or die "Couldn't open config file: $!";
             require Data::Dumper;
             local $Data::Dumper::Terse = 1;
@@ -924,7 +924,7 @@ sub open_mailgate_ok {
     my $baseurl = shift;
     my $queue   = shift || 'general';
     my $action  = shift || 'correspond';
-    Test::More::ok(open(my $mail, "|$RT::BinPath/rt-mailgate --url $baseurl --queue $queue --action $action"), "Opened the mailgate - $!");
+    Test::More::ok(open(my $mail, '|-', "$RT::BinPath/rt-mailgate --url $baseurl --queue $queue --action $action"), "Opened the mailgate - $!");
     return $mail;
 }
 
@@ -1305,7 +1305,7 @@ sub file_content {
 
     Test::More::diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
 
-    open my $fh, "<:raw", $path
+    open( my $fh, "<:raw", $path )
         or do {
             warn "couldn't open file '$path': $!" unless $args{noexist};
             return ''
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index ae40e4c..db80e6f 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -21,7 +21,7 @@ sub start_server {
     my %info = $self->apache_server_info( variant => $variant );
 
     RT::Test::diag(do {
-        open my $fh, '<', $tmp{'config'}{'RT'};
+        open( my $fh, '<', $tmp{'config'}{'RT'} ) or die $!;
         local $/;
         <$fh>
     });
@@ -68,7 +68,7 @@ sub start_server {
         }
         Test::More::BAIL_OUT("Couldn't start apache server, no pid file")
             unless -e $opt{'pid_file'};
-        open my $pid_fh, '<', $opt{'pid_file'}
+        open( my $pid_fh, '<', $opt{'pid_file'} )
             or Test::More::BAIL_OUT("Couldn't open pid file: $!");
         my $pid = <$pid_fh>;
         chomp $pid;
@@ -186,7 +186,7 @@ sub process_in_file {
         ($out_fh, $out_conf) = tempfile();
     } else {
         $out_conf = $args{'out'};
-        open $out_fh, '>', $out_conf
+        open( $out_fh, '>', $out_conf )
             or die "couldn't open '$out_conf': $!";
     }
     print $out_fh $text;
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index d104215..43b2e6b 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -105,7 +105,7 @@ RT->InitClasses();
 # get customized root password
 my $root_password;
 if ( $args{'root-password-file'} ) {
-    open my $fh, '<', $args{'root-password-file'}
+    open( my $fh, '<', $args{'root-password-file'} )
       or die "Couldn't open 'args{'root-password-file'}' for reading: $!";
     $root_password = <$fh>;
     chomp $root_password;
@@ -394,7 +394,7 @@ sub action_upgrade {
 sub get_versions_from_to {
     my ($base_dir, $from, $to) = @_;
 
-    opendir my $dh, $base_dir or die "couldn't open dir: $!";
+    opendir( my $dh, $base_dir ) or die "couldn't open dir: $!";
     my @versions = grep -d "$base_dir/$_" && /\d+\.\d+\.\d+/, readdir $dh;
     closedir $dh;
 
diff --git a/sbin/rt-setup-fulltext-index.in b/sbin/rt-setup-fulltext-index.in
index 44947aa..5a48a22 100644
--- a/sbin/rt-setup-fulltext-index.in
+++ b/sbin/rt-setup-fulltext-index.in
@@ -390,7 +390,7 @@ sub ora_create_stop_list {
         undef, $name, 'BASIC_STOPLIST'
     );
 
-    open my $fh, '<:utf8', $file
+    open( my $fh, '<:utf8', $file )
         or die "couldn't open file '$file': $!";
     while ( my $word = <$fh> ) {
         chomp $word;
diff --git a/share/html/Admin/Tools/Shredder/Elements/PluginHelp b/share/html/Admin/Tools/Shredder/Elements/PluginHelp
index 491f955..a6ac9cf 100644
--- a/share/html/Admin/Tools/Shredder/Elements/PluginHelp
+++ b/share/html/Admin/Tools/Shredder/Elements/PluginHelp
@@ -65,7 +65,7 @@ unless( $file ) {
 
 use RT::Shredder::POD qw();
 my $text = '';
-open my $io_handle, ">:scalar", \$text or die "Can't open scalar for write: $!";
+open( my $io_handle, ">:scalar", \$text ) or die "Can't open scalar for write: $!";
 RT::Shredder::POD::plugin_html( $file, $io_handle );
 if ( $Plugin eq 'Base' ) {
     $file =~ s/\.pm$/\/Search.pm/;
diff --git a/share/html/Install/index.html b/share/html/Install/index.html
index cc94003..653b32d 100644
--- a/share/html/Install/index.html
+++ b/share/html/Install/index.html
@@ -95,7 +95,7 @@ my $file = File::Spec->catfile( $RT::EtcPath, 'RT_SiteConfig.pm' );
 
 if ( ! -e $file ) {
     # write a blank RT_SiteConfig.pm
-    open my $fh, '>', $file or die $!;
+    open( my $fh, '>', $file ) or die $!;
     close $fh;
 }
 elsif ( ! -w $file ) {
diff --git a/t/mail/crypt-gnupg.t b/t/mail/crypt-gnupg.t
index cf69985..7c47d51 100644
--- a/t/mail/crypt-gnupg.t
+++ b/t/mail/crypt-gnupg.t
@@ -304,7 +304,7 @@ diag 'wrong signed/encrypted parts: wrong proto';
 
 diag 'verify inline and in attachment signatures';
 {
-    open my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" or die $!;
+    open( my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" ) or die $!;
     my $parser = new MIME::Parser;
     my $entity = $parser->parse( $fh );
 
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index 279bbcd..9f0e669 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -656,7 +656,7 @@ ok( $id, 'new ticket created' );
 is( $tick->Owner, RT->Nobody->Id, 'owner of the new ticket is nobody' );
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] test
@@ -682,7 +682,7 @@ $m->no_warnings_ok;
 
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@");
 print MAIL <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] correspondence
@@ -709,7 +709,7 @@ $m->no_warnings_ok;
 
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] test
@@ -745,7 +745,7 @@ my $rtname = RT->Config->Get('rtname');
 $m->no_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
@@ -767,7 +767,7 @@ $m->next_warning_like(qr/Could not record email: Ticket not taken/);
 $m->no_leftover_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
@@ -786,7 +786,7 @@ $m->next_warning_like(qr/Could not record email: Ticket not taken/);
 $m->no_leftover_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
@@ -831,7 +831,7 @@ ok( $status, "successfuly granted right: $msg" );
 ok( $status, "successfuly granted right: $msg" );
 
 $! = 0;
-ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
+ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
 print MAIL <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
diff --git a/t/ticket/linking.t b/t/ticket/linking.t
index d947fe5..b18340d 100644
--- a/t/ticket/linking.t
+++ b/t/ticket/linking.t
@@ -38,13 +38,13 @@ my $q2 = RT::Queue->new(RT->SystemUser);
 ok ($id,$msg);
 
 my $commit_code = <<END;
-open my \$file, '<', "$filename" or die "couldn't open $filename";
+open( my \$file, '<', "$filename" ) or die "couldn't open $filename";
 my \$data = <\$file>;
 \$data += 0;
 close \$file;
 \$RT::Logger->debug("Data is \$data");
 
-open \$file, '>', "$filename" or die "couldn't open $filename";
+open( \$file, '>', "$filename" ) or die "couldn't open $filename";
 if (\$self->TransactionObj->Type eq 'AddLink') {
     \$RT::Logger->debug("AddLink");
     print \$file \$data+1, "\n";
@@ -391,7 +391,7 @@ ok($link->LocalBase   == 0, "LocalBase set correctly");
 
 sub link_count {
     my $file = shift;
-    open my $fh, '<', $file or die "couldn't open $file";
+    open( my $fh, '<', $file ) or die "couldn't open $file";
     my $data = <$fh>;
     close $fh;
 
diff --git a/t/ticket/scrips_batch.t b/t/ticket/scrips_batch.t
index 3edac53..1d28b67 100644
--- a/t/ticket/scrips_batch.t
+++ b/t/ticket/scrips_batch.t
@@ -43,7 +43,7 @@ my $sid;
     my ($tmp_fh, $tmp_fn) = tempfile();
 
     my $code = <<END;
-open my \$fh, '>', '$tmp_fn' or die "Couldn't open '$tmp_fn':\$!";
+open( my \$fh, '>', '$tmp_fn' ) or die "Couldn't open '$tmp_fn':\$!";
 
 my \$batch = \$self->TicketObj->TransactionBatch;
 unless ( \$batch && \@\$batch ) {
diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 992be17..2fe8200 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -46,7 +46,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
 
     my $file =
       File::Spec->catfile( File::Spec->tmpdir, encode_utf8 '附件.txt' );
-    open my $fh, '>', $file or die $!;
+    open( my $fh, '>', $file ) or die $!;
     binmode $fh, ':utf8';
     print $fh '附件';
     close $fh;
diff --git a/t/web/command_line.t b/t/web/command_line.t
index ee1ee7a..a1f0a19 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -508,7 +508,7 @@ sub check_attachment {
     expect_handle->before() =~ $attachment_regex;
     my $attachment_id = $1;
     expect_send("show ticket/$ticket_id/attachments/$attachment_id/content","Fetching Attachment");
-    open my $fh, '<', $attachment_path or die "Can't open $attachment_path: $!";
+    open( my $fh, '<', $attachment_path ) or die "Can't open $attachment_path: $!";
     my $attachment_content = do { local($/); <$fh> };
     close $fh;
     chomp $attachment_content;

commit 5dfa1847869db1040b685293af14858e3804abd1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Feb 7 15:54:04 2011 -0500

    Make ExternalAuth also respect the ?next=hash argument after logins

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index fc5bc56..15273c2 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -512,6 +512,7 @@ sub AttemptExternalAuth {
             $user =~ s/^\Q$NodeName\E\\//i;
         }
 
+        my $next = delete $HTML::Mason::Commands::session{'NextPage'}->{$ARGS->{'next'} || ''};
         InstantiateNewSession() unless _UserLoggedIn;
         $HTML::Mason::Commands::session{'CurrentUser'} = RT::CurrentUser->new();
         $HTML::Mason::Commands::session{'CurrentUser'}->$load_method($user);
@@ -559,6 +560,7 @@ sub AttemptExternalAuth {
 
         if ( _UserLoggedIn() ) {
             $m->callback( %$ARGS, CallbackName => 'ExternalAuthSuccessfulLogin', CallbackPage => '/autohandler' );
+            Redirect($next) if $next;
         } else {
             delete $HTML::Mason::Commands::session{'CurrentUser'};
             $user = $orig_user;

commit 45e9c282733f23f473eeaa489c9551e39d02772c
Merge: 1797fc4 b8d8092
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Feb 8 14:54:52 2011 -0500

    Merge branch '4.0/upgrade-no-db-changes-fix' into 4.0-trunk


commit 58cc84676b86f7734e85245f405766e99bd4270d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Feb 8 15:38:44 2011 -0500

    Setting groups limit to undef skips group display on MoreAboutRequestor
    
    Flip the default to 0 to maintain the same default behavior

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 6fa55e9..cc69e23 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -906,9 +906,9 @@ Set($MoreAboutRequestorExtraInfo, '');
 
 =item C<$MoreAboutRequestorGroupsLimit>
 
-By default, the 'More about requestor' box on Ticket/Display.html shows all
-the groups of the Requestor.
-Use this to limit the number of groups.
+By default, the 'More about requestor' box on Ticket/Display.html
+shows all the groups of the Requestor.  Use this to limit the number
+of groups; a value of undef removes the group display entirely.
 
 e.g.
 
@@ -916,7 +916,7 @@ Set($MoreAboutRequestorGroupsLimit, 10);
 
 =cut
 
-Set($MoreAboutRequestorGroupsLimit, undef);
+Set($MoreAboutRequestorGroupsLimit, 0);
 
 =item C<$AutocompleteOwners>
 
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index d0cedbd..0a605f8 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -116,7 +116,8 @@
 </div>
 % }
 
-% if ( $ShowGroups ) {
+% my $grouplimit = RT->Config->Get('MoreAboutRequestorGroupsLimit');
+% if ( $ShowGroups and defined $grouplimit ) {
 <div class="more-about-user-groups">
   <span class="label">
     <&|/l&>Groups this user belongs to</&>
@@ -126,7 +127,7 @@
   [<a href=<% RT->Config->Get('WebPath') . '/Admin/Users/Memberships.html?id=' . $requestor->id %> ><&|/l&>Edit</&></a>]
 % }
   </span>
-  <span class="value"><& /Elements/ShowMemberships, UserObj => $requestor, Limit => RT->Config->Get('MoreAboutRequestorGroupsLimit') &></span>
+  <span class="value"><& /Elements/ShowMemberships, UserObj => $requestor, Limit => $grouplimit &></span>
 </div>
 % }
 

commit dd5310de7ad5db58e84bfbcb67d2f9d1fe9d379d
Merge: 45e9c28 4c1fd8d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Feb 8 16:42:09 2011 -0500

    Merge branch '4.0/farbtastic-to-base' into 4.0-trunk


commit 674c98bf2ed28b90e5fb1bf9f1a31091ef1d816c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Feb 9 04:40:22 2011 +0300

    MUST NOT load any of RT::** classes before RT::Test
    
    RT::** may load site config and that would be a production one
    
    in this particular case we even don't need to load any
    of those modules as RT::Test loads them for us

diff --git a/t/api/savedsearch.t b/t/api/savedsearch.t
index d479d74..0aa67ee 100644
--- a/t/api/savedsearch.t
+++ b/t/api/savedsearch.t
@@ -1,13 +1,9 @@
 use strict;
 use warnings;
 BEGIN { $ENV{'LANG'} = 'C' }
-use RT;
-use RT::User;
-use RT::Group;
-use RT::Ticket;
-use RT::Queue;
 
 use RT::Test tests => 27;
+
 use_ok('RT::SavedSearch');
 use_ok('RT::SavedSearches');
 

commit 49bd564ca4a883a37af17711ba584a98bc1ca1e1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Feb 11 17:17:44 2011 -0500

    Provide some rationale in comments for the convoluted logic

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 15273c2..87d7e43 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -560,7 +560,15 @@ sub AttemptExternalAuth {
 
         if ( _UserLoggedIn() ) {
             $m->callback( %$ARGS, CallbackName => 'ExternalAuthSuccessfulLogin', CallbackPage => '/autohandler' );
+            # It is possible that we did a redirect to the login page,
+            # if the external auth allows lack of auth through with no
+            # REMOTE_USER set, instead of forcing a "permission
+            # denied" message.  Honor the $next.
             Redirect($next) if $next;
+            # Unlike AttemptPasswordAuthentication below, we do not
+            # force a redirect to / if $next is not set -- otherwise,
+            # straight-up external auth would always redirect to /
+            # when you first hit it.
         } else {
             delete $HTML::Mason::Commands::session{'CurrentUser'};
             $user = $orig_user;

commit 8392d961dec46b242061ed17dbd281a8d16bb6c2
Merge: dd5310d 58cc846
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 11 17:25:59 2011 -0500

    Merge branch '4.0/hide-requestor-groups' into 4.0-trunk


commit 2f9cdfb178f5b3e8369064572516bbbc807b44ca
Merge: 8392d96 49bd564
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 11 17:28:23 2011 -0500

    Merge branch '4.0/externalauth-use-next' into 4.0-trunk


commit a8dd21c32cd4d8804e12834b40459f797b0d27b6
Merge: 2f9cdfb 7065397
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 11 17:43:14 2011 -0500

    Merge branch '4.0/queue-summary' into 4.0-trunk


commit 212d9f4da59b0a935393c22ab5efe836f76bbe20
Merge: a8dd21c 674c98b
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 11 17:43:20 2011 -0500

    Merge branch '4.0/use-rt-test-first' into 4.0-trunk


-----------------------------------------------------------------------


More information about the Rt-commit mailing list