[Bps-public-commit] RT-Extension-rt_cpan_org branch, master, updated. 3b5d80e577ae31436370317cb29aefa8df6487c7

Thomas Sibley trs at bestpractical.com
Thu Jul 25 13:14:33 EDT 2013


The branch, master has been updated
       via  3b5d80e577ae31436370317cb29aefa8df6487c7 (commit)
      from  dc519ff4d876413f062433163354336397fd5a89 (commit)

Summary of changes:
 Makefile.PL                                        |   2 +-
 patches/4.0.14-attachment-ordering.patch           |  58 -------
 patches/4.0.14-conservative-quote-folding.patch    |  86 ----------
 patches/4.0.14-currentuser-attributes.patch        |  49 ------
 patches/4.0.14-empty-order-by.patch                |  30 ----
 patches/4.0.14-joins-bundling.patch                | 185 ---------------------
 patches/4.0.14-session-locks.patch                 | 147 ----------------
 patches/4.0.14-session-store-errors.patch          |  33 ----
 ...dmin-queues.patch => 4.0.15-admin-queues.patch} |   0
 ...ople-box.patch => 4.0.15-link-people-box.patch} |   0
 10 files changed, 1 insertion(+), 589 deletions(-)
 delete mode 100644 patches/4.0.14-attachment-ordering.patch
 delete mode 100644 patches/4.0.14-conservative-quote-folding.patch
 delete mode 100644 patches/4.0.14-currentuser-attributes.patch
 delete mode 100644 patches/4.0.14-empty-order-by.patch
 delete mode 100644 patches/4.0.14-joins-bundling.patch
 delete mode 100644 patches/4.0.14-session-locks.patch
 delete mode 100644 patches/4.0.14-session-store-errors.patch
 rename patches/{4.0.14-admin-queues.patch => 4.0.15-admin-queues.patch} (100%)
 rename patches/{4.0.14-link-people-box.patch => 4.0.15-link-people-box.patch} (100%)

- Log -----------------------------------------------------------------
commit 3b5d80e577ae31436370317cb29aefa8df6487c7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jul 25 10:14:00 2013 -0700

    Require RT 4.0.14 to remove a bunch of patches
    
    A few patches didn't make 4.0.14 and are moved off (presumably) to 4.0.15.

diff --git a/Makefile.PL b/Makefile.PL
index 3930769..5140650 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,7 +4,7 @@ RTx('RT-Extension-rt_cpan_org');
 all_from        ('lib/RT/Extension/rt_cpan_org.pm');
 readme_from     ('lib/RT/Extension/rt_cpan_org.pm');
 
-requires_rt('4.0.12');
+requires_rt('4.0.14');
 
 # rt-cpan-export-db
 requires 'DBI';
diff --git a/patches/4.0.14-attachment-ordering.patch b/patches/4.0.14-attachment-ordering.patch
deleted file mode 100644
index 34cc6f6..0000000
--- a/patches/4.0.14-attachment-ordering.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 8dea1161afae6b5822c002abe5e7e04f4cf3e993 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 14 May 2013 16:34:59 -0700
-Subject: [PATCH] Display and add attachments in alphabetical order by name
-
-Without any sorting, the ordering is random and determined by Perl's
-internal hash key/value ordering.  While preserving upload order would
-probably be best for the cases touched in this commit, it would require
-a more invasive or hackish change not suitable for the 4.0 series.
-
-We already display attachments in alphabetical order in the ticket
-metadata.  Extend that same consistent ordering to the attachments list
-during ticket create/update and when adding the attachments to the
-create/update MIME entity.
----
- lib/RT/Interface/Web.pm                   | 5 +++--
- share/html/Ticket/Elements/AddAttachments | 2 +-
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
-index ba7b56d..dce1117 100644
---- a/lib/RT/Interface/Web.pm
-+++ b/lib/RT/Interface/Web.pm
-@@ -1754,7 +1754,7 @@ sub CreateTicket {
-         $RT::Logger->error("Couldn't make multipart message")
-             if !$rv || $rv !~ /^(?:DONE|ALREADY)$/;
- 
--        foreach ( values %{ $ARGS{'Attachments'} } ) {
-+        foreach ( map $ARGS{Attachments}->{$_}, sort keys %{ $ARGS{'Attachments'} } ) {
-             unless ($_) {
-                 $RT::Logger->error("Couldn't add empty attachemnt");
-                 next;
-@@ -1987,7 +1987,8 @@ sub ProcessUpdateMessage {
- 
-     if ( $args{ARGSRef}->{'UpdateAttachments'} ) {
-         $Message->make_multipart;
--        $Message->add_part($_) foreach values %{ $args{ARGSRef}->{'UpdateAttachments'} };
-+        $Message->add_part($_) foreach map $args{ARGSRef}->{UpdateAttachments}{$_},
-+                                  sort keys %{ $args{ARGSRef}->{'UpdateAttachments'} };
-     }
- 
-     if ( $args{ARGSRef}->{'AttachTickets'} ) {
-diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
-index d00a021..cdf6281 100644
---- a/share/html/Ticket/Elements/AddAttachments
-+++ b/share/html/Ticket/Elements/AddAttachments
-@@ -49,7 +49,7 @@
- <tr><td class="label"><&|/l&>Attached file</&>:</td>
- <td>
- <&|/l&>Check box to delete</&><br />
--% foreach my $attach_name (keys %{$session{'Attachments'}}) {
-+% foreach my $attach_name (sort keys %{$session{'Attachments'}}) {
- <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
- % } # end of foreach
- </td>
--- 
-1.8.2.2
-
diff --git a/patches/4.0.14-conservative-quote-folding.patch b/patches/4.0.14-conservative-quote-folding.patch
deleted file mode 100644
index c387193..0000000
--- a/patches/4.0.14-conservative-quote-folding.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 75d7f3a267e2a92751b63e11e4119405815479fc Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Mon, 29 Apr 2013 14:16:11 -0700
-Subject: [PATCH 1/2] Error handling for text and HTML quote extraction when
- displaying attachments
-
-Improves the error message by adding the attachment ID and directs bug
-reports to rt-bugs at bestpractical.com.
----
- .../Ticket/Elements/ShowTransactionAttachments     | 24 ++++++++++++++++++----
- 1 file changed, 20 insertions(+), 4 deletions(-)
-
-diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
-index 9ff6d10..f70f279 100644
---- a/share/html/Ticket/Elements/ShowTransactionAttachments
-+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
-@@ -216,8 +216,17 @@ my $render_attachment = sub {
-                     ticket  => $Ticket,
-                 );
- 
--                require HTML::Quoted;
--                $content = HTML::Quoted->extract($content) unless length $name;
-+                unless (length $name) {
-+                    eval {
-+                        require HTML::Quoted;
-+                        $content = HTML::Quoted->extract($content)
-+                    };
-+                    if ($@) {
-+                        RT->Logger->error(
-+                            "HTML::Quoted couldn't process attachment #@{[$message->id]}: $@."
-+                          . "  This is a bug, please report it to rt-bugs\@bestpractical.com.");
-+                    }
-+                }
- 
-                 $m->comp(
-                     'ShowMessageStanza',
-@@ -235,8 +244,15 @@ my $render_attachment = sub {
-             # It's a text type we don't have special handling for
-             else {
-                 unless ( length $name ) {
--                    eval { require Text::Quoted;  $content = Text::Quoted::extract($content); };
--                    if ($@) { $RT::Logger->warning( "Text::Quoted failed: $@" ) }
-+                    eval {
-+                        require Text::Quoted;
-+                        $content = Text::Quoted::extract($content);
-+                    };
-+                    if ($@) {
-+                        RT->Logger->error(
-+                            "Text::Quoted couldn't process attachment #@{[$message->id]}: $@."
-+                          . "  This is a bug, please report it to rt-bugs\@bestpractical.com.");
-+                    }
-                 }
- 
-                 $m->comp(
--- 
-1.8.2.2
-
-
-From 9299787baa49b7d824d82bd584b628a6fc253c0b Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Thu, 16 May 2013 14:50:09 -0700
-Subject: [PATCH 2/2] Only treat ">" as an email quoting character
-
-All of the other defaults (!, #, %, =, |, :) cause too many false
-positives and hardly any true use as a quote character.
----
- share/html/Ticket/Elements/ShowTransactionAttachments | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
-index f70f279..b219205 100644
---- a/share/html/Ticket/Elements/ShowTransactionAttachments
-+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
-@@ -246,6 +246,9 @@ my $render_attachment = sub {
-                 unless ( length $name ) {
-                     eval {
-                         require Text::Quoted;
-+                        # XXX: Deprecate ->can check in 4.2 and simply bump version requirement.
-+                        Text::Quoted::set_quote_characters(undef) # only use >
-+                            if Text::Quoted->can("set_quote_characters");
-                         $content = Text::Quoted::extract($content);
-                     };
-                     if ($@) {
--- 
-1.8.2.2
-
diff --git a/patches/4.0.14-currentuser-attributes.patch b/patches/4.0.14-currentuser-attributes.patch
deleted file mode 100644
index 4693e61..0000000
--- a/patches/4.0.14-currentuser-attributes.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 27fefc1a018b9a06a144e441bed7095c2ca4b7d1 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 7 May 2013 12:12:20 -0700
-Subject: [PATCH] RT::CurrentUser objects should access Attributes as an
- RT::User
-
-Otherwise attributes on the user object aren't found when accessed via
-an equivalent current user object.
-
-A larger, more invasive 4.2 fix for this should be introducing an
-_ObjectType method or similar which is provided by the superclass and
-used instead of ref().
----
- lib/RT/Attribute.pm  | 2 +-
- lib/RT/Attributes.pm | 5 ++++-
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
-index a0edb15..4350df0 100644
---- a/lib/RT/Attribute.pm
-+++ b/lib/RT/Attribute.pm
-@@ -148,7 +148,7 @@ sub Create {
- 		  @_);
- 
-     if ($args{Object} and UNIVERSAL::can($args{Object}, 'Id')) {
--	    $args{ObjectType} = ref($args{Object});
-+	    $args{ObjectType} = $args{Object}->isa("RT::CurrentUser") ? "RT::User" : ref($args{Object});
- 	    $args{ObjectId} = $args{Object}->Id;
-     } else {
-         return(0, $self->loc("Required parameter '[_1]' not specified", 'Object'));
-diff --git a/lib/RT/Attributes.pm b/lib/RT/Attributes.pm
-index 9c18c1a..997e376 100644
---- a/lib/RT/Attributes.pm
-+++ b/lib/RT/Attributes.pm
-@@ -210,7 +210,10 @@ sub LimitToObject {
-     unless (eval { $obj->id} ){
-         return undef;
-     }
--    $self->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => ref($obj), ENTRYAGGREGATOR => 'OR');
-+
-+    my $type = $obj->isa("RT::CurrentUser") ? "RT::User" : ref($obj);
-+
-+    $self->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => $type, ENTRYAGGREGATOR => 'OR');
-     $self->Limit(FIELD => 'ObjectId', OPERATOR=> '=', VALUE => $obj->id, ENTRYAGGREGATOR => 'OR', QUOTEVALUE => 0);
- 
- }
--- 
-1.8.2.2
-
diff --git a/patches/4.0.14-empty-order-by.patch b/patches/4.0.14-empty-order-by.patch
deleted file mode 100644
index a5b95ba..0000000
--- a/patches/4.0.14-empty-order-by.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1fdfabc9606dacf82535d52edbcdd98b6bbbc444 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 18 Jun 2013 17:03:26 -0700
-Subject: [PATCH] Always filter empty strings out of OrderBy
-
-Older OrderBy saved search preferences (which are arrays) may contain
-empty strings.  Passing them to OrderByCols() can cause invalid SQL.
----
- share/html/Elements/CollectionList | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
-index 7e4ba15..33e2de2 100644
---- a/share/html/Elements/CollectionList
-+++ b/share/html/Elements/CollectionList
-@@ -68,9 +68,10 @@ if ( $Rows ) {
- # collection is ordered or not
- if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) {
-     if ( $OrderBy[0] =~ /\|/ ) {
--        @OrderBy = grep length($_), split /\|/, $OrderBy[0];
-+        @OrderBy = split /\|/, $OrderBy[0];
-         @Order = split /\|/,$Order[0];
-     }
-+    @OrderBy = grep length, @OrderBy;
-     $Collection->OrderByCols(
-         map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
-         ( 0 .. $#OrderBy )
--- 
-1.8.3.1
-
diff --git a/patches/4.0.14-joins-bundling.patch b/patches/4.0.14-joins-bundling.patch
deleted file mode 100644
index f94ba20..0000000
--- a/patches/4.0.14-joins-bundling.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From bf5cd6adcbe857ed6ef5b6c2b3fa16effe174b80 Mon Sep 17 00:00:00 2001
-From: Ruslan Zakirov <ruz at bestpractical.com>
-Date: Thu, 4 Apr 2013 20:03:48 +0400
-Subject: [PATCH] bundle together watcher searches
-
-it's first attempt at wide bundling of watcher searches.
-So far it supports:
-
-* bundling of positive conditions (=, like, is null)
-* conditions can be mixed with conditions on other fields:
-
-    (Cc.foo = a AND Subject = s) OR (Cc.foo = b AND Subject = s)
-
-The following cases are not bundled while in theory they could:
-* Cc = 'foo' OR Requestor = 'bar'
-* Cc != 'foo' AND Cc != 'bar'
----
- lib/RT/Tickets.pm     | 18 ++++++++++------
- lib/RT/Tickets_SQL.pm | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---
- 2 files changed, 67 insertions(+), 9 deletions(-)
-
-diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
-index 3b834e0..416b4a8 100644
---- a/lib/RT/Tickets.pm
-+++ b/lib/RT/Tickets.pm
-@@ -939,13 +939,18 @@ sub _WatcherLimit {
-     }
-     $rest{SUBKEY} ||= 'EmailAddress';
- 
--    my $groups = $self->_RoleGroupsJoin( Type => $type, Class => $class, New => !$type );
-+    my ($groups, $group_members, $users);
-+    if ( $rest{'BUNDLE'} ) {
-+        ($groups, $group_members, $users) = @{ $rest{'BUNDLE'} };
-+    } else {
-+        $groups = $self->_RoleGroupsJoin( Type => $type, Class => $class, New => !$type );
-+    }
- 
-     $self->_OpenParen;
-     if ( $op =~ /^IS(?: NOT)?$/i ) {
-         # is [not] empty case
- 
--        my $group_members = $self->_GroupMembersJoin( GroupsAlias => $groups );
-+        $group_members ||= $self->_GroupMembersJoin( GroupsAlias => $groups );
-         # to avoid joining the table Users into the query, we just join GM
-         # and make sure we don't match records where group is member of itself
-         $self->SUPER::Limit(
-@@ -983,7 +988,7 @@ sub _WatcherLimit {
-         $users_obj->RowsPerPage(2);
-         my @users = @{ $users_obj->ItemsArrayRef };
- 
--        my $group_members = $self->_GroupMembersJoin( GroupsAlias => $groups );
-+        $group_members ||= $self->_GroupMembersJoin( GroupsAlias => $groups );
-         if ( @users <= 1 ) {
-             my $uid = 0;
-             $uid = $users[0]->id if @users;
-@@ -1008,7 +1013,7 @@ sub _WatcherLimit {
-                 VALUE      => "$group_members.MemberId",
-                 QUOTEVALUE => 0,
-             );
--            my $users = $self->Join(
-+            $users ||= $self->Join(
-                 TYPE            => 'LEFT',
-                 ALIAS1          => $group_members,
-                 FIELD1          => 'MemberId',
-@@ -1034,10 +1039,10 @@ sub _WatcherLimit {
-     } else {
-         # positive condition case
- 
--        my $group_members = $self->_GroupMembersJoin(
-+        $group_members ||= $self->_GroupMembersJoin(
-             GroupsAlias => $groups, New => 1, Left => 0
-         );
--        my $users = $self->Join(
-+        $users ||= $self->Join(
-             TYPE            => 'LEFT',
-             ALIAS1          => $group_members,
-             FIELD1          => 'MemberId',
-@@ -1054,6 +1059,7 @@ sub _WatcherLimit {
-         );
-     }
-     $self->_CloseParen;
-+    return ($groups, $group_members, $users);
- }
- 
- sub _RoleGroupsJoin {
-diff --git a/lib/RT/Tickets_SQL.pm b/lib/RT/Tickets_SQL.pm
-index 608862a..bd71ece 100644
---- a/lib/RT/Tickets_SQL.pm
-+++ b/lib/RT/Tickets_SQL.pm
-@@ -171,19 +171,40 @@ sub _parser {
-     my @bundle;
-     my $ea = '';
- 
-+    my %sub_tree;
-+    my $depth = 0;
-+
-     my %callback;
-     $callback{'OpenParen'} = sub {
-       $self->_close_bundle(@bundle); @bundle = ();
--      $self->_OpenParen
-+      $self->_OpenParen;
-+      $depth++;
-+      push @$_, '(' foreach values %sub_tree;
-     };
-     $callback{'CloseParen'} = sub {
-       $self->_close_bundle(@bundle); @bundle = ();
-       $self->_CloseParen;
-+      $depth--;
-+      foreach my $list ( values %sub_tree ) {
-+          if ( $list->[-1] eq '(' ) {
-+              pop @$list;
-+              pop @$list if $list->[-1] =~ /^(?:AND|OR)$/i;
-+          }
-+          else {
-+              pop @$list while $list->[-2] ne '(';
-+              $list->[-1] = pop @$list;
-+          }
-+      }
-+    };
-+    $callback{'EntryAggregator'} = sub {
-+      $ea = $_[0] || '';
-+      push @$_, $ea foreach values %sub_tree;
-     };
--    $callback{'EntryAggregator'} = sub { $ea = $_[0] || '' };
-     $callback{'Condition'} = sub {
-         my ($key, $op, $value) = @_;
- 
-+        my ($negative_op, $null_op, $inv_op, $range_op)
-+            = $self->ClassifySQLOperation( $op );
-         # key has dot then it's compound variant and we have subkey
-         my $subkey = '';
-         ($key, $subkey) = ($1, $2) if $key =~ /^([^\.]+)\.(.+)$/;
-@@ -225,10 +246,23 @@ sub _parser {
-         }
-         else {
-             $self->_close_bundle(@bundle); @bundle = ();
--            $sub->( $self, $key, $op, $value,
-+            my @res; my $bundle_with;
-+            if ( $class eq 'WATCHERFIELD' && $key ne 'Owner' && !$negative_op && (!$null_op || $subkey) ) {
-+                if ( !$sub_tree{$key} ) {
-+                  $sub_tree{$key} = [ ('(')x$depth, \@res ];
-+                } else {
-+                  $bundle_with = $self->_check_bundling_possibility( @{ $sub_tree{$key} } );
-+                  if ( !$bundle_with && $sub_tree{$key}[-1] eq '(' ) {
-+                        push @{ $sub_tree{$key} }, \@res;
-+                  }
-+                }
-+            }
-+            pop @$_ foreach grep @$_ && $_->[-1] =~ /^(?:AND|OR)$/i, values %sub_tree;
-+            @res = $sub->( $self, $key, $op, $value,
-                     SUBCLAUSE       => '',  # don't need anymore
-                     ENTRYAGGREGATOR => $ea,
-                     SUBKEY          => $subkey,
-+                    BUNDLE          => $bundle_with,
-                   );
-         }
-         $self->{_sql_looking_at}{lc $key} = 1;
-@@ -238,6 +272,24 @@ sub _parser {
-     $self->_close_bundle(@bundle); @bundle = ();
- }
- 
-+sub _check_bundling_possibility {
-+    my $self = shift;
-+    my @list = reverse @_;
-+    while (my $e = shift @list) {
-+        next if $e eq '(';
-+        if ( lc($e) eq 'and' ) {
-+            return undef;
-+        }
-+        elsif ( lc($e) eq 'or' ) {
-+            return shift @list;
-+        }
-+        else {
-+            die "boo";
-+        }
-+    }
-+    return undef;
-+}
-+
- =head2 ClausesToSQL
- 
- =cut
--- 
-1.7.11.3
-
diff --git a/patches/4.0.14-session-locks.patch b/patches/4.0.14-session-locks.patch
deleted file mode 100644
index d47775d..0000000
--- a/patches/4.0.14-session-locks.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 5ab23daca4db2ef54fb5973b0b7b886a299a9e18 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Thu, 16 May 2013 01:08:06 -0700
-Subject: [PATCH 1/2] Correct a misspelling in log messages
-
----
- lib/RT/Interface/Web/Session.pm | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
-index 4edd9bd..ddbcef5 100644
---- a/lib/RT/Interface/Web/Session.pm
-+++ b/lib/RT/Interface/Web/Session.pm
-@@ -192,7 +192,7 @@ sub _ClearOldDB {
-         die "couldn't execute query: ". $dbh->errstr unless defined $rows;
-     }
- 
--    $RT::Logger->info("successfuly deleted $rows sessions");
-+    $RT::Logger->info("successfully deleted $rows sessions");
-     return;
- }
- 
-@@ -222,7 +222,7 @@ sub _ClearOldDir {
-             next;
-         }
-         tied(%session)->delete;
--        $RT::Logger->info("successfuly deleted session '$id'");
-+        $RT::Logger->info("successfully deleted session '$id'");
-     }
- 
-     my $lock = Apache::Session::Lock::File->new;
-@@ -259,7 +259,7 @@ sub ClearByUser {
-             }
-         }
-         tied(%session)->delete;
--        $RT::Logger->info("successfuly deleted session '$id'");
-+        $RT::Logger->info("successfully deleted session '$id'");
-     }
- }
- 
--- 
-1.8.2.2
-
-
-From 125848b02327cf5f3f23084d786a8a8a8c127e85 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Thu, 16 May 2013 01:25:34 -0700
-Subject: [PATCH 2/2] Clean orphaned session file locks more aggressively
-
-When using file-based sessions, lock files are orphaned once the session
-is deleted through any call to tied(%session)->delete, such as logging
-out.  These lock files continue to accumulate until the session cleaner
-eventually picks them after a set age.
-
-Over the course of even a relatively short, and common, 7 day max age
-limit, the accumulated orphaned locks on a busy site (combined with all
-the active sessions + locks) can bloat the size of the session directory
-beyond the capacity of a standard ext3/4 filesystem directory entry.
-Once this happens, sessions will start to fail sporadically with "No
-space left on device" errors, despite plenty of disk space being
-available.
-
-Once a lock file is orphaned, it is safe to delete regardless of its
-age.  Aggressively remove such locks whenever the session cleaner runs.
-
-Arguably this should be handled inside Apache::Session when ->delete is
-called.  Until then, the extra cleaning is simple to implement.
----
- lib/RT/Interface/Web/Session.pm | 41 +++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 41 insertions(+)
-
-diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
-index ddbcef5..0d70ac7 100644
---- a/lib/RT/Interface/Web/Session.pm
-+++ b/lib/RT/Interface/Web/Session.pm
-@@ -225,12 +225,50 @@ sub _ClearOldDir {
-         $RT::Logger->info("successfully deleted session '$id'");
-     }
- 
-+    # Apache::Session::Lock::File will clean out locks older than X, but it
-+    # leaves around bogus locks if they're too new, even though they're
-+    # guaranteed dead.  On even just largeish installs, the accumulated number
-+    # of them may bump into ext3/4 filesystem limits since Apache::Session
-+    # doesn't use a fan-out tree.
-     my $lock = Apache::Session::Lock::File->new;
-     $lock->clean( $dir, $older_than );
- 
-+    # Take matters into our own hands and clear bogus locks hanging around
-+    # regardless of how recent they are.
-+    $self->ClearOrphanLockFiles($dir);
-+
-     return;
- }
- 
-+=head3 ClearOrphanLockFiles
-+
-+Takes a directory in which to look for L<Apache::Session::Lock::File> locks
-+which no longer have a corresponding session file.  If not provided, the
-+directory is taken from the session configuration data.
-+
-+=cut
-+
-+sub ClearOrphanLockFiles {
-+    my $class = shift;
-+    my $dir   = shift || $class->Attributes->{Directory}
-+        or return;
-+
-+    if (opendir my $dh, $dir) {
-+        for (readdir $dh) {
-+            next unless /^Apache-Session-([0-9a-f]{32})\.lock$/;
-+            next if -e "$dir/$1";
-+
-+            RT->Logger->debug("deleting orphaned session lockfile '$_'");
-+
-+            unlink "$dir/$_"
-+                or warn "Failed to unlink session lockfile $dir/$_: $!";
-+        }
-+        closedir $dh;
-+    } else {
-+        warn "Unable to open directory '$dir' for reading: $!";
-+    }
-+}
-+
- =head3 ClearByUser
- 
- Checks all sessions and if user has more then one session
-@@ -243,6 +281,7 @@ sub ClearByUser {
-     my $class = $self->Class;
-     my $attrs = $self->Attributes;
- 
-+    my $deleted;
-     my %seen = ();
-     foreach my $id( @{ $self->Ids } ) {
-         my %session;
-@@ -260,7 +299,9 @@ sub ClearByUser {
-         }
-         tied(%session)->delete;
-         $RT::Logger->info("successfully deleted session '$id'");
-+        $deleted++;
-     }
-+    $self->ClearOrphanLockFiles if $deleted;
- }
- 
- sub TIEHASH {
--- 
-1.8.2.2
-
diff --git a/patches/4.0.14-session-store-errors.patch b/patches/4.0.14-session-store-errors.patch
deleted file mode 100644
index a45409c..0000000
--- a/patches/4.0.14-session-store-errors.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 53fbab0f164591c564d3e786386b705443233c19 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 14 May 2013 15:37:13 -0700
-Subject: [PATCH] Correct a runtime error in our tied session error handler
-
-loc() isn't a function available from within the internals of the
-Session class, and especially not when we failed to store the current
-user's session.  Localization of this error doesn't make sense anyway
-since it now goes to the logs and not the end user.
----
- lib/RT/Interface/Web/Session.pm | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
-index 4edd9bd..7910d41 100644
---- a/lib/RT/Interface/Web/Session.pm
-+++ b/lib/RT/Interface/Web/Session.pm
-@@ -276,10 +276,8 @@ sub TIEHASH {
-     eval { tie %session, $class, $id, $attrs };
-     eval { tie %session, $class, undef, $attrs } if $@;
-     if ( $@ ) {
--        die loc("RT couldn't store your session.") . "\n"
--          . loc("This may mean that that the directory '[_1]' isn't writable or a database table is missing or corrupt.",
--            $RT::MasonSessionDir)
--          . "\n\n"
-+        die "RT couldn't store your session.  "
-+          . "This may mean that that the directory '$RT::MasonSessionDir' isn't writable or a database table is missing or corrupt.\n\n"
-           . $@;
-     }
- 
--- 
-1.8.2.2
-
diff --git a/patches/4.0.14-admin-queues.patch b/patches/4.0.15-admin-queues.patch
similarity index 100%
rename from patches/4.0.14-admin-queues.patch
rename to patches/4.0.15-admin-queues.patch
diff --git a/patches/4.0.14-link-people-box.patch b/patches/4.0.15-link-people-box.patch
similarity index 100%
rename from patches/4.0.14-link-people-box.patch
rename to patches/4.0.15-link-people-box.patch

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



More information about the Bps-public-commit mailing list